
software.amazon.awssdk.services.ssm.model.ResourceDataSyncS3Destination Maven / Gradle / Ivy
/*
* 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.ssm.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
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.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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Information about the target S3 bucket for the Resource Data Sync.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ResourceDataSyncS3Destination implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField BUCKET_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ResourceDataSyncS3Destination::bucketName)).setter(setter(Builder::bucketName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BucketName").build()).build();
private static final SdkField PREFIX_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ResourceDataSyncS3Destination::prefix)).setter(setter(Builder::prefix))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Prefix").build()).build();
private static final SdkField SYNC_FORMAT_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ResourceDataSyncS3Destination::syncFormatAsString)).setter(setter(Builder::syncFormat))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SyncFormat").build()).build();
private static final SdkField REGION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ResourceDataSyncS3Destination::region)).setter(setter(Builder::region))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Region").build()).build();
private static final SdkField AWSKMS_KEY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ResourceDataSyncS3Destination::awskmsKeyARN)).setter(setter(Builder::awskmsKeyARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AWSKMSKeyARN").build()).build();
private static final SdkField DESTINATION_DATA_SHARING_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.getter(getter(ResourceDataSyncS3Destination::destinationDataSharing))
.setter(setter(Builder::destinationDataSharing)).constructor(ResourceDataSyncDestinationDataSharing::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DestinationDataSharing").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BUCKET_NAME_FIELD,
PREFIX_FIELD, SYNC_FORMAT_FIELD, REGION_FIELD, AWSKMS_KEY_ARN_FIELD, DESTINATION_DATA_SHARING_FIELD));
private static final long serialVersionUID = 1L;
private final String bucketName;
private final String prefix;
private final String syncFormat;
private final String region;
private final String awskmsKeyARN;
private final ResourceDataSyncDestinationDataSharing destinationDataSharing;
private ResourceDataSyncS3Destination(BuilderImpl builder) {
this.bucketName = builder.bucketName;
this.prefix = builder.prefix;
this.syncFormat = builder.syncFormat;
this.region = builder.region;
this.awskmsKeyARN = builder.awskmsKeyARN;
this.destinationDataSharing = builder.destinationDataSharing;
}
/**
*
* The name of the S3 bucket where the aggregated data is stored.
*
*
* @return The name of the S3 bucket where the aggregated data is stored.
*/
public String bucketName() {
return bucketName;
}
/**
*
* An Amazon S3 prefix for the bucket.
*
*
* @return An Amazon S3 prefix for the bucket.
*/
public String prefix() {
return prefix;
}
/**
*
* A supported sync format. The following format is currently supported: JsonSerDe
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #syncFormat} will
* return {@link ResourceDataSyncS3Format#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #syncFormatAsString}.
*
*
* @return A supported sync format. The following format is currently supported: JsonSerDe
* @see ResourceDataSyncS3Format
*/
public ResourceDataSyncS3Format syncFormat() {
return ResourceDataSyncS3Format.fromValue(syncFormat);
}
/**
*
* A supported sync format. The following format is currently supported: JsonSerDe
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #syncFormat} will
* return {@link ResourceDataSyncS3Format#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #syncFormatAsString}.
*
*
* @return A supported sync format. The following format is currently supported: JsonSerDe
* @see ResourceDataSyncS3Format
*/
public String syncFormatAsString() {
return syncFormat;
}
/**
*
* The AWS Region with the S3 bucket targeted by the Resource Data Sync.
*
*
* @return The AWS Region with the S3 bucket targeted by the Resource Data Sync.
*/
public String region() {
return region;
}
/**
*
* The ARN of an encryption key for a destination in Amazon S3. Must belong to the same Region as the destination S3
* bucket.
*
*
* @return The ARN of an encryption key for a destination in Amazon S3. Must belong to the same Region as the
* destination S3 bucket.
*/
public String awskmsKeyARN() {
return awskmsKeyARN;
}
/**
*
* Enables destination data sharing. By default, this field is null
.
*
*
* @return Enables destination data sharing. By default, this field is null
.
*/
public ResourceDataSyncDestinationDataSharing destinationDataSharing() {
return destinationDataSharing;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(bucketName());
hashCode = 31 * hashCode + Objects.hashCode(prefix());
hashCode = 31 * hashCode + Objects.hashCode(syncFormatAsString());
hashCode = 31 * hashCode + Objects.hashCode(region());
hashCode = 31 * hashCode + Objects.hashCode(awskmsKeyARN());
hashCode = 31 * hashCode + Objects.hashCode(destinationDataSharing());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ResourceDataSyncS3Destination)) {
return false;
}
ResourceDataSyncS3Destination other = (ResourceDataSyncS3Destination) obj;
return Objects.equals(bucketName(), other.bucketName()) && Objects.equals(prefix(), other.prefix())
&& Objects.equals(syncFormatAsString(), other.syncFormatAsString()) && Objects.equals(region(), other.region())
&& Objects.equals(awskmsKeyARN(), other.awskmsKeyARN())
&& Objects.equals(destinationDataSharing(), other.destinationDataSharing());
}
/**
* 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 String toString() {
return ToString.builder("ResourceDataSyncS3Destination").add("BucketName", bucketName()).add("Prefix", prefix())
.add("SyncFormat", syncFormatAsString()).add("Region", region()).add("AWSKMSKeyARN", awskmsKeyARN())
.add("DestinationDataSharing", destinationDataSharing()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BucketName":
return Optional.ofNullable(clazz.cast(bucketName()));
case "Prefix":
return Optional.ofNullable(clazz.cast(prefix()));
case "SyncFormat":
return Optional.ofNullable(clazz.cast(syncFormatAsString()));
case "Region":
return Optional.ofNullable(clazz.cast(region()));
case "AWSKMSKeyARN":
return Optional.ofNullable(clazz.cast(awskmsKeyARN()));
case "DestinationDataSharing":
return Optional.ofNullable(clazz.cast(destinationDataSharing()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function