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

software.amazon.awssdk.services.dataexchange.model.S3DataAccessAsset Maven / Gradle / Ivy

Go to download

The AWS Java SDK for DataExchange module holds the client classes that are used for communicating with DataExchange.

There is a newer version: 2.28.5
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.dataexchange.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* The Amazon S3 data access that is the asset. *

*/ @Generated("software.amazon.awssdk:codegen") public final class S3DataAccessAsset implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField BUCKET_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Bucket") .getter(getter(S3DataAccessAsset::bucket)).setter(setter(Builder::bucket)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Bucket").build()).build(); private static final SdkField> KEY_PREFIXES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("KeyPrefixes") .getter(getter(S3DataAccessAsset::keyPrefixes)) .setter(setter(Builder::keyPrefixes)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KeyPrefixes").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> KEYS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Keys") .getter(getter(S3DataAccessAsset::keys)) .setter(setter(Builder::keys)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Keys").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 S3_ACCESS_POINT_ALIAS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("S3AccessPointAlias").getter(getter(S3DataAccessAsset::s3AccessPointAlias)) .setter(setter(Builder::s3AccessPointAlias)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3AccessPointAlias").build()) .build(); private static final SdkField S3_ACCESS_POINT_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("S3AccessPointArn").getter(getter(S3DataAccessAsset::s3AccessPointArn)) .setter(setter(Builder::s3AccessPointArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3AccessPointArn").build()).build(); private static final SdkField> KMS_KEYS_TO_GRANT_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("KmsKeysToGrant") .getter(getter(S3DataAccessAsset::kmsKeysToGrant)) .setter(setter(Builder::kmsKeysToGrant)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KmsKeysToGrant").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(KmsKeyToGrant::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BUCKET_FIELD, KEY_PREFIXES_FIELD, KEYS_FIELD, S3_ACCESS_POINT_ALIAS_FIELD, S3_ACCESS_POINT_ARN_FIELD, KMS_KEYS_TO_GRANT_FIELD)); private static final long serialVersionUID = 1L; private final String bucket; private final List keyPrefixes; private final List keys; private final String s3AccessPointAlias; private final String s3AccessPointArn; private final List kmsKeysToGrant; private S3DataAccessAsset(BuilderImpl builder) { this.bucket = builder.bucket; this.keyPrefixes = builder.keyPrefixes; this.keys = builder.keys; this.s3AccessPointAlias = builder.s3AccessPointAlias; this.s3AccessPointArn = builder.s3AccessPointArn; this.kmsKeysToGrant = builder.kmsKeysToGrant; } /** *

* The Amazon S3 bucket hosting data to be shared in the S3 data access. *

* * @return The Amazon S3 bucket hosting data to be shared in the S3 data access. */ public final String bucket() { return bucket; } /** * For responses, this returns true if the service returned a value for the KeyPrefixes 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 hasKeyPrefixes() { return keyPrefixes != null && !(keyPrefixes instanceof SdkAutoConstructList); } /** *

* The Amazon S3 bucket used for hosting shared data in the Amazon S3 data access. *

*

* 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 #hasKeyPrefixes} method. *

* * @return The Amazon S3 bucket used for hosting shared data in the Amazon S3 data access. */ public final List keyPrefixes() { return keyPrefixes; } /** * For responses, this returns true if the service returned a value for the Keys 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 hasKeys() { return keys != null && !(keys instanceof SdkAutoConstructList); } /** *

* S3 keys made available using this asset. *

*

* 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 #hasKeys} method. *

* * @return S3 keys made available using this asset. */ public final List keys() { return keys; } /** *

* The automatically-generated bucket-style alias for your Amazon S3 Access Point. Customers can access their * entitled data using the S3 Access Point alias. *

* * @return The automatically-generated bucket-style alias for your Amazon S3 Access Point. Customers can access * their entitled data using the S3 Access Point alias. */ public final String s3AccessPointAlias() { return s3AccessPointAlias; } /** *

* The ARN for your Amazon S3 Access Point. Customers can also access their entitled data using the S3 Access Point * ARN. *

* * @return The ARN for your Amazon S3 Access Point. Customers can also access their entitled data using the S3 * Access Point ARN. */ public final String s3AccessPointArn() { return s3AccessPointArn; } /** * For responses, this returns true if the service returned a value for the KmsKeysToGrant 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 hasKmsKeysToGrant() { return kmsKeysToGrant != null && !(kmsKeysToGrant instanceof SdkAutoConstructList); } /** *

* List of AWS KMS CMKs (Key Management System Customer Managed Keys) and ARNs used to encrypt S3 objects being * shared in this S3 Data Access asset. Providers must include all AWS KMS keys used to encrypt these shared S3 * objects. *

*

* 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 #hasKmsKeysToGrant} method. *

* * @return List of AWS KMS CMKs (Key Management System Customer Managed Keys) and ARNs used to encrypt S3 objects * being shared in this S3 Data Access asset. Providers must include all AWS KMS keys used to encrypt these * shared S3 objects. */ public final List kmsKeysToGrant() { return kmsKeysToGrant; } @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 + Objects.hashCode(bucket()); hashCode = 31 * hashCode + Objects.hashCode(hasKeyPrefixes() ? keyPrefixes() : null); hashCode = 31 * hashCode + Objects.hashCode(hasKeys() ? keys() : null); hashCode = 31 * hashCode + Objects.hashCode(s3AccessPointAlias()); hashCode = 31 * hashCode + Objects.hashCode(s3AccessPointArn()); hashCode = 31 * hashCode + Objects.hashCode(hasKmsKeysToGrant() ? kmsKeysToGrant() : null); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof S3DataAccessAsset)) { return false; } S3DataAccessAsset other = (S3DataAccessAsset) obj; return Objects.equals(bucket(), other.bucket()) && hasKeyPrefixes() == other.hasKeyPrefixes() && Objects.equals(keyPrefixes(), other.keyPrefixes()) && hasKeys() == other.hasKeys() && Objects.equals(keys(), other.keys()) && Objects.equals(s3AccessPointAlias(), other.s3AccessPointAlias()) && Objects.equals(s3AccessPointArn(), other.s3AccessPointArn()) && hasKmsKeysToGrant() == other.hasKmsKeysToGrant() && Objects.equals(kmsKeysToGrant(), other.kmsKeysToGrant()); } /** * 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("S3DataAccessAsset").add("Bucket", bucket()) .add("KeyPrefixes", hasKeyPrefixes() ? keyPrefixes() : null).add("Keys", hasKeys() ? keys() : null) .add("S3AccessPointAlias", s3AccessPointAlias()).add("S3AccessPointArn", s3AccessPointArn()) .add("KmsKeysToGrant", hasKmsKeysToGrant() ? kmsKeysToGrant() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Bucket": return Optional.ofNullable(clazz.cast(bucket())); case "KeyPrefixes": return Optional.ofNullable(clazz.cast(keyPrefixes())); case "Keys": return Optional.ofNullable(clazz.cast(keys())); case "S3AccessPointAlias": return Optional.ofNullable(clazz.cast(s3AccessPointAlias())); case "S3AccessPointArn": return Optional.ofNullable(clazz.cast(s3AccessPointArn())); case "KmsKeysToGrant": return Optional.ofNullable(clazz.cast(kmsKeysToGrant())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((S3DataAccessAsset) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The Amazon S3 bucket hosting data to be shared in the S3 data access. *

* * @param bucket * The Amazon S3 bucket hosting data to be shared in the S3 data access. * @return Returns a reference to this object so that method calls can be chained together. */ Builder bucket(String bucket); /** *

* The Amazon S3 bucket used for hosting shared data in the Amazon S3 data access. *

* * @param keyPrefixes * The Amazon S3 bucket used for hosting shared data in the Amazon S3 data access. * @return Returns a reference to this object so that method calls can be chained together. */ Builder keyPrefixes(Collection keyPrefixes); /** *

* The Amazon S3 bucket used for hosting shared data in the Amazon S3 data access. *

* * @param keyPrefixes * The Amazon S3 bucket used for hosting shared data in the Amazon S3 data access. * @return Returns a reference to this object so that method calls can be chained together. */ Builder keyPrefixes(String... keyPrefixes); /** *

* S3 keys made available using this asset. *

* * @param keys * S3 keys made available using this asset. * @return Returns a reference to this object so that method calls can be chained together. */ Builder keys(Collection keys); /** *

* S3 keys made available using this asset. *

* * @param keys * S3 keys made available using this asset. * @return Returns a reference to this object so that method calls can be chained together. */ Builder keys(String... keys); /** *

* The automatically-generated bucket-style alias for your Amazon S3 Access Point. Customers can access their * entitled data using the S3 Access Point alias. *

* * @param s3AccessPointAlias * The automatically-generated bucket-style alias for your Amazon S3 Access Point. Customers can access * their entitled data using the S3 Access Point alias. * @return Returns a reference to this object so that method calls can be chained together. */ Builder s3AccessPointAlias(String s3AccessPointAlias); /** *

* The ARN for your Amazon S3 Access Point. Customers can also access their entitled data using the S3 Access * Point ARN. *

* * @param s3AccessPointArn * The ARN for your Amazon S3 Access Point. Customers can also access their entitled data using the S3 * Access Point ARN. * @return Returns a reference to this object so that method calls can be chained together. */ Builder s3AccessPointArn(String s3AccessPointArn); /** *

* List of AWS KMS CMKs (Key Management System Customer Managed Keys) and ARNs used to encrypt S3 objects being * shared in this S3 Data Access asset. Providers must include all AWS KMS keys used to encrypt these shared S3 * objects. *

* * @param kmsKeysToGrant * List of AWS KMS CMKs (Key Management System Customer Managed Keys) and ARNs used to encrypt S3 objects * being shared in this S3 Data Access asset. Providers must include all AWS KMS keys used to encrypt * these shared S3 objects. * @return Returns a reference to this object so that method calls can be chained together. */ Builder kmsKeysToGrant(Collection kmsKeysToGrant); /** *

* List of AWS KMS CMKs (Key Management System Customer Managed Keys) and ARNs used to encrypt S3 objects being * shared in this S3 Data Access asset. Providers must include all AWS KMS keys used to encrypt these shared S3 * objects. *

* * @param kmsKeysToGrant * List of AWS KMS CMKs (Key Management System Customer Managed Keys) and ARNs used to encrypt S3 objects * being shared in this S3 Data Access asset. Providers must include all AWS KMS keys used to encrypt * these shared S3 objects. * @return Returns a reference to this object so that method calls can be chained together. */ Builder kmsKeysToGrant(KmsKeyToGrant... kmsKeysToGrant); /** *

* List of AWS KMS CMKs (Key Management System Customer Managed Keys) and ARNs used to encrypt S3 objects being * shared in this S3 Data Access asset. Providers must include all AWS KMS keys used to encrypt these shared S3 * objects. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.dataexchange.model.KmsKeyToGrant.Builder} avoiding the need to create * one manually via {@link software.amazon.awssdk.services.dataexchange.model.KmsKeyToGrant#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.dataexchange.model.KmsKeyToGrant.Builder#build()} is called * immediately and its result is passed to {@link #kmsKeysToGrant(List)}. * * @param kmsKeysToGrant * a consumer that will call methods on * {@link software.amazon.awssdk.services.dataexchange.model.KmsKeyToGrant.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #kmsKeysToGrant(java.util.Collection) */ Builder kmsKeysToGrant(Consumer... kmsKeysToGrant); } static final class BuilderImpl implements Builder { private String bucket; private List keyPrefixes = DefaultSdkAutoConstructList.getInstance(); private List keys = DefaultSdkAutoConstructList.getInstance(); private String s3AccessPointAlias; private String s3AccessPointArn; private List kmsKeysToGrant = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(S3DataAccessAsset model) { bucket(model.bucket); keyPrefixes(model.keyPrefixes); keys(model.keys); s3AccessPointAlias(model.s3AccessPointAlias); s3AccessPointArn(model.s3AccessPointArn); kmsKeysToGrant(model.kmsKeysToGrant); } public final String getBucket() { return bucket; } public final void setBucket(String bucket) { this.bucket = bucket; } @Override public final Builder bucket(String bucket) { this.bucket = bucket; return this; } public final Collection getKeyPrefixes() { if (keyPrefixes instanceof SdkAutoConstructList) { return null; } return keyPrefixes; } public final void setKeyPrefixes(Collection keyPrefixes) { this.keyPrefixes = ListOf__stringCopier.copy(keyPrefixes); } @Override public final Builder keyPrefixes(Collection keyPrefixes) { this.keyPrefixes = ListOf__stringCopier.copy(keyPrefixes); return this; } @Override @SafeVarargs public final Builder keyPrefixes(String... keyPrefixes) { keyPrefixes(Arrays.asList(keyPrefixes)); return this; } public final Collection getKeys() { if (keys instanceof SdkAutoConstructList) { return null; } return keys; } public final void setKeys(Collection keys) { this.keys = ListOf__stringCopier.copy(keys); } @Override public final Builder keys(Collection keys) { this.keys = ListOf__stringCopier.copy(keys); return this; } @Override @SafeVarargs public final Builder keys(String... keys) { keys(Arrays.asList(keys)); return this; } public final String getS3AccessPointAlias() { return s3AccessPointAlias; } public final void setS3AccessPointAlias(String s3AccessPointAlias) { this.s3AccessPointAlias = s3AccessPointAlias; } @Override public final Builder s3AccessPointAlias(String s3AccessPointAlias) { this.s3AccessPointAlias = s3AccessPointAlias; return this; } public final String getS3AccessPointArn() { return s3AccessPointArn; } public final void setS3AccessPointArn(String s3AccessPointArn) { this.s3AccessPointArn = s3AccessPointArn; } @Override public final Builder s3AccessPointArn(String s3AccessPointArn) { this.s3AccessPointArn = s3AccessPointArn; return this; } public final List getKmsKeysToGrant() { List result = ListOfKmsKeysToGrantCopier.copyToBuilder(this.kmsKeysToGrant); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setKmsKeysToGrant(Collection kmsKeysToGrant) { this.kmsKeysToGrant = ListOfKmsKeysToGrantCopier.copyFromBuilder(kmsKeysToGrant); } @Override public final Builder kmsKeysToGrant(Collection kmsKeysToGrant) { this.kmsKeysToGrant = ListOfKmsKeysToGrantCopier.copy(kmsKeysToGrant); return this; } @Override @SafeVarargs public final Builder kmsKeysToGrant(KmsKeyToGrant... kmsKeysToGrant) { kmsKeysToGrant(Arrays.asList(kmsKeysToGrant)); return this; } @Override @SafeVarargs public final Builder kmsKeysToGrant(Consumer... kmsKeysToGrant) { kmsKeysToGrant(Stream.of(kmsKeysToGrant).map(c -> KmsKeyToGrant.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } @Override public S3DataAccessAsset build() { return new S3DataAccessAsset(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy