All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.cloudwatchlogs.model.CreateDeliveryRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon CloudWatch Logs module holds the client classes that are used for communicating with Amazon CloudWatch Logs Service

There is a newer version: 2.30.1
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.cloudwatchlogs.model;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class CreateDeliveryRequest extends CloudWatchLogsRequest implements
        ToCopyableBuilder {
    private static final SdkField DELIVERY_SOURCE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("deliverySourceName").getter(getter(CreateDeliveryRequest::deliverySourceName))
            .setter(setter(Builder::deliverySourceName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deliverySourceName").build())
            .build();

    private static final SdkField DELIVERY_DESTINATION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("deliveryDestinationArn").getter(getter(CreateDeliveryRequest::deliveryDestinationArn))
            .setter(setter(Builder::deliveryDestinationArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deliveryDestinationArn").build())
            .build();

    private static final SdkField> RECORD_FIELDS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("recordFields")
            .getter(getter(CreateDeliveryRequest::recordFields))
            .setter(setter(Builder::recordFields))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("recordFields").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField FIELD_DELIMITER_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("fieldDelimiter").getter(getter(CreateDeliveryRequest::fieldDelimiter))
            .setter(setter(Builder::fieldDelimiter))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("fieldDelimiter").build()).build();

    private static final SdkField S3_DELIVERY_CONFIGURATION_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("s3DeliveryConfiguration")
            .getter(getter(CreateDeliveryRequest::s3DeliveryConfiguration)).setter(setter(Builder::s3DeliveryConfiguration))
            .constructor(S3DeliveryConfiguration::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("s3DeliveryConfiguration").build())
            .build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("tags")
            .getter(getter(CreateDeliveryRequest::tags))
            .setter(setter(Builder::tags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
                    MapTrait.builder()
                            .keyLocationName("key")
                            .valueLocationName("value")
                            .valueFieldInfo(
                                    SdkField. builder(MarshallingType.STRING)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("value").build()).build()).build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DELIVERY_SOURCE_NAME_FIELD,
            DELIVERY_DESTINATION_ARN_FIELD, RECORD_FIELDS_FIELD, FIELD_DELIMITER_FIELD, S3_DELIVERY_CONFIGURATION_FIELD,
            TAGS_FIELD));

    private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();

    private final String deliverySourceName;

    private final String deliveryDestinationArn;

    private final List recordFields;

    private final String fieldDelimiter;

    private final S3DeliveryConfiguration s3DeliveryConfiguration;

    private final Map tags;

    private CreateDeliveryRequest(BuilderImpl builder) {
        super(builder);
        this.deliverySourceName = builder.deliverySourceName;
        this.deliveryDestinationArn = builder.deliveryDestinationArn;
        this.recordFields = builder.recordFields;
        this.fieldDelimiter = builder.fieldDelimiter;
        this.s3DeliveryConfiguration = builder.s3DeliveryConfiguration;
        this.tags = builder.tags;
    }

    /**
     * 

* The name of the delivery source to use for this delivery. *

* * @return The name of the delivery source to use for this delivery. */ public final String deliverySourceName() { return deliverySourceName; } /** *

* The ARN of the delivery destination to use for this delivery. *

* * @return The ARN of the delivery destination to use for this delivery. */ public final String deliveryDestinationArn() { return deliveryDestinationArn; } /** * For responses, this returns true if the service returned a value for the RecordFields property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasRecordFields() { return recordFields != null && !(recordFields instanceof SdkAutoConstructList); } /** *

* The list of record fields to be delivered to the destination, in order. If the delivery's log source has * mandatory fields, they must be included in this list. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasRecordFields} method. *

* * @return The list of record fields to be delivered to the destination, in order. If the delivery's log source has * mandatory fields, they must be included in this list. */ public final List recordFields() { return recordFields; } /** *

* The field delimiter to use between record fields when the final output format of a delivery is in * Plain, W3C, or Raw format. *

* * @return The field delimiter to use between record fields when the final output format of a delivery is in * Plain, W3C, or Raw format. */ public final String fieldDelimiter() { return fieldDelimiter; } /** *

* This structure contains parameters that are valid only when the delivery's delivery destination is an S3 bucket. *

* * @return This structure contains parameters that are valid only when the delivery's delivery destination is an S3 * bucket. */ public final S3DeliveryConfiguration s3DeliveryConfiguration() { return s3DeliveryConfiguration; } /** * For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that * the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful * because the SDK will never return a null collection or map, but you may need to differentiate between the service * returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true * if a value for the property was specified in the request builder, and false if a value was not specified. */ public final boolean hasTags() { return tags != null && !(tags instanceof SdkAutoConstructMap); } /** *

* An optional list of key-value pairs to associate with the resource. *

*

* For more information about tagging, see Tagging Amazon Web Services resources *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasTags} method. *

* * @return An optional list of key-value pairs to associate with the resource.

*

* For more information about tagging, see Tagging Amazon Web Services * resources */ public final Map tags() { return tags; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(deliverySourceName()); hashCode = 31 * hashCode + Objects.hashCode(deliveryDestinationArn()); hashCode = 31 * hashCode + Objects.hashCode(hasRecordFields() ? recordFields() : null); hashCode = 31 * hashCode + Objects.hashCode(fieldDelimiter()); hashCode = 31 * hashCode + Objects.hashCode(s3DeliveryConfiguration()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof CreateDeliveryRequest)) { return false; } CreateDeliveryRequest other = (CreateDeliveryRequest) obj; return Objects.equals(deliverySourceName(), other.deliverySourceName()) && Objects.equals(deliveryDestinationArn(), other.deliveryDestinationArn()) && hasRecordFields() == other.hasRecordFields() && Objects.equals(recordFields(), other.recordFields()) && Objects.equals(fieldDelimiter(), other.fieldDelimiter()) && Objects.equals(s3DeliveryConfiguration(), other.s3DeliveryConfiguration()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public final String toString() { return ToString.builder("CreateDeliveryRequest").add("DeliverySourceName", deliverySourceName()) .add("DeliveryDestinationArn", deliveryDestinationArn()) .add("RecordFields", hasRecordFields() ? recordFields() : null).add("FieldDelimiter", fieldDelimiter()) .add("S3DeliveryConfiguration", s3DeliveryConfiguration()).add("Tags", hasTags() ? tags() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "deliverySourceName": return Optional.ofNullable(clazz.cast(deliverySourceName())); case "deliveryDestinationArn": return Optional.ofNullable(clazz.cast(deliveryDestinationArn())); case "recordFields": return Optional.ofNullable(clazz.cast(recordFields())); case "fieldDelimiter": return Optional.ofNullable(clazz.cast(fieldDelimiter())); case "s3DeliveryConfiguration": return Optional.ofNullable(clazz.cast(s3DeliveryConfiguration())); case "tags": return Optional.ofNullable(clazz.cast(tags())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("deliverySourceName", DELIVERY_SOURCE_NAME_FIELD); map.put("deliveryDestinationArn", DELIVERY_DESTINATION_ARN_FIELD); map.put("recordFields", RECORD_FIELDS_FIELD); map.put("fieldDelimiter", FIELD_DELIMITER_FIELD); map.put("s3DeliveryConfiguration", S3_DELIVERY_CONFIGURATION_FIELD); map.put("tags", TAGS_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((CreateDeliveryRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends CloudWatchLogsRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The name of the delivery source to use for this delivery. *

* * @param deliverySourceName * The name of the delivery source to use for this delivery. * @return Returns a reference to this object so that method calls can be chained together. */ Builder deliverySourceName(String deliverySourceName); /** *

* The ARN of the delivery destination to use for this delivery. *

* * @param deliveryDestinationArn * The ARN of the delivery destination to use for this delivery. * @return Returns a reference to this object so that method calls can be chained together. */ Builder deliveryDestinationArn(String deliveryDestinationArn); /** *

* The list of record fields to be delivered to the destination, in order. If the delivery's log source has * mandatory fields, they must be included in this list. *

* * @param recordFields * The list of record fields to be delivered to the destination, in order. If the delivery's log source * has mandatory fields, they must be included in this list. * @return Returns a reference to this object so that method calls can be chained together. */ Builder recordFields(Collection recordFields); /** *

* The list of record fields to be delivered to the destination, in order. If the delivery's log source has * mandatory fields, they must be included in this list. *

* * @param recordFields * The list of record fields to be delivered to the destination, in order. If the delivery's log source * has mandatory fields, they must be included in this list. * @return Returns a reference to this object so that method calls can be chained together. */ Builder recordFields(String... recordFields); /** *

* The field delimiter to use between record fields when the final output format of a delivery is in * Plain, W3C, or Raw format. *

* * @param fieldDelimiter * The field delimiter to use between record fields when the final output format of a delivery is in * Plain, W3C, or Raw format. * @return Returns a reference to this object so that method calls can be chained together. */ Builder fieldDelimiter(String fieldDelimiter); /** *

* This structure contains parameters that are valid only when the delivery's delivery destination is an S3 * bucket. *

* * @param s3DeliveryConfiguration * This structure contains parameters that are valid only when the delivery's delivery destination is an * S3 bucket. * @return Returns a reference to this object so that method calls can be chained together. */ Builder s3DeliveryConfiguration(S3DeliveryConfiguration s3DeliveryConfiguration); /** *

* This structure contains parameters that are valid only when the delivery's delivery destination is an S3 * bucket. *

* This is a convenience method that creates an instance of the {@link S3DeliveryConfiguration.Builder} avoiding * the need to create one manually via {@link S3DeliveryConfiguration#builder()}. * *

* When the {@link Consumer} completes, {@link S3DeliveryConfiguration.Builder#build()} is called immediately * and its result is passed to {@link #s3DeliveryConfiguration(S3DeliveryConfiguration)}. * * @param s3DeliveryConfiguration * a consumer that will call methods on {@link S3DeliveryConfiguration.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #s3DeliveryConfiguration(S3DeliveryConfiguration) */ default Builder s3DeliveryConfiguration(Consumer s3DeliveryConfiguration) { return s3DeliveryConfiguration(S3DeliveryConfiguration.builder().applyMutation(s3DeliveryConfiguration).build()); } /** *

* An optional list of key-value pairs to associate with the resource. *

*

* For more information about tagging, see Tagging Amazon Web Services * resources *

* * @param tags * An optional list of key-value pairs to associate with the resource.

*

* For more information about tagging, see Tagging Amazon Web Services * resources * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Map tags); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends CloudWatchLogsRequest.BuilderImpl implements Builder { private String deliverySourceName; private String deliveryDestinationArn; private List recordFields = DefaultSdkAutoConstructList.getInstance(); private String fieldDelimiter; private S3DeliveryConfiguration s3DeliveryConfiguration; private Map tags = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(CreateDeliveryRequest model) { super(model); deliverySourceName(model.deliverySourceName); deliveryDestinationArn(model.deliveryDestinationArn); recordFields(model.recordFields); fieldDelimiter(model.fieldDelimiter); s3DeliveryConfiguration(model.s3DeliveryConfiguration); tags(model.tags); } public final String getDeliverySourceName() { return deliverySourceName; } public final void setDeliverySourceName(String deliverySourceName) { this.deliverySourceName = deliverySourceName; } @Override public final Builder deliverySourceName(String deliverySourceName) { this.deliverySourceName = deliverySourceName; return this; } public final String getDeliveryDestinationArn() { return deliveryDestinationArn; } public final void setDeliveryDestinationArn(String deliveryDestinationArn) { this.deliveryDestinationArn = deliveryDestinationArn; } @Override public final Builder deliveryDestinationArn(String deliveryDestinationArn) { this.deliveryDestinationArn = deliveryDestinationArn; return this; } public final Collection getRecordFields() { if (recordFields instanceof SdkAutoConstructList) { return null; } return recordFields; } public final void setRecordFields(Collection recordFields) { this.recordFields = RecordFieldsCopier.copy(recordFields); } @Override public final Builder recordFields(Collection recordFields) { this.recordFields = RecordFieldsCopier.copy(recordFields); return this; } @Override @SafeVarargs public final Builder recordFields(String... recordFields) { recordFields(Arrays.asList(recordFields)); return this; } public final String getFieldDelimiter() { return fieldDelimiter; } public final void setFieldDelimiter(String fieldDelimiter) { this.fieldDelimiter = fieldDelimiter; } @Override public final Builder fieldDelimiter(String fieldDelimiter) { this.fieldDelimiter = fieldDelimiter; return this; } public final S3DeliveryConfiguration.Builder getS3DeliveryConfiguration() { return s3DeliveryConfiguration != null ? s3DeliveryConfiguration.toBuilder() : null; } public final void setS3DeliveryConfiguration(S3DeliveryConfiguration.BuilderImpl s3DeliveryConfiguration) { this.s3DeliveryConfiguration = s3DeliveryConfiguration != null ? s3DeliveryConfiguration.build() : null; } @Override public final Builder s3DeliveryConfiguration(S3DeliveryConfiguration s3DeliveryConfiguration) { this.s3DeliveryConfiguration = s3DeliveryConfiguration; return this; } public final Map getTags() { if (tags instanceof SdkAutoConstructMap) { return null; } return tags; } public final void setTags(Map tags) { this.tags = TagsCopier.copy(tags); } @Override public final Builder tags(Map tags) { this.tags = TagsCopier.copy(tags); return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public CreateDeliveryRequest build() { return new CreateDeliveryRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy