
software.amazon.awssdk.services.qldb.model.S3EncryptionConfiguration 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.qldb.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.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;
/**
*
* The encryption settings that are used by a journal export job to write data in an Amazon Simple Storage Service
* (Amazon S3) bucket.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class S3EncryptionConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField OBJECT_ENCRYPTION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ObjectEncryptionType").getter(getter(S3EncryptionConfiguration::objectEncryptionTypeAsString))
.setter(setter(Builder::objectEncryptionType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ObjectEncryptionType").build())
.build();
private static final SdkField KMS_KEY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("KmsKeyArn").getter(getter(S3EncryptionConfiguration::kmsKeyArn)).setter(setter(Builder::kmsKeyArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KmsKeyArn").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(OBJECT_ENCRYPTION_TYPE_FIELD,
KMS_KEY_ARN_FIELD));
private static final long serialVersionUID = 1L;
private final String objectEncryptionType;
private final String kmsKeyArn;
private S3EncryptionConfiguration(BuilderImpl builder) {
this.objectEncryptionType = builder.objectEncryptionType;
this.kmsKeyArn = builder.kmsKeyArn;
}
/**
*
* The Amazon S3 object encryption type.
*
*
* To learn more about server-side encryption options in Amazon S3, see Protecting Data Using
* Server-Side Encryption in the Amazon S3 Developer Guide.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #objectEncryptionType} will return {@link S3ObjectEncryptionType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #objectEncryptionTypeAsString}.
*
*
* @return The Amazon S3 object encryption type.
*
* To learn more about server-side encryption options in Amazon S3, see Protecting Data Using
* Server-Side Encryption in the Amazon S3 Developer Guide.
* @see S3ObjectEncryptionType
*/
public final S3ObjectEncryptionType objectEncryptionType() {
return S3ObjectEncryptionType.fromValue(objectEncryptionType);
}
/**
*
* The Amazon S3 object encryption type.
*
*
* To learn more about server-side encryption options in Amazon S3, see Protecting Data Using
* Server-Side Encryption in the Amazon S3 Developer Guide.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #objectEncryptionType} will return {@link S3ObjectEncryptionType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #objectEncryptionTypeAsString}.
*
*
* @return The Amazon S3 object encryption type.
*
* To learn more about server-side encryption options in Amazon S3, see Protecting Data Using
* Server-Side Encryption in the Amazon S3 Developer Guide.
* @see S3ObjectEncryptionType
*/
public final String objectEncryptionTypeAsString() {
return objectEncryptionType;
}
/**
*
* The Amazon Resource Name (ARN) of a symmetric encryption key in Key Management Service (KMS). Amazon S3 does not
* support asymmetric KMS keys.
*
*
* You must provide a KmsKeyArn
if you specify SSE_KMS
as the
* ObjectEncryptionType
.
*
*
* KmsKeyArn
is not required if you specify SSE_S3
as the
* ObjectEncryptionType
.
*
*
* @return The Amazon Resource Name (ARN) of a symmetric encryption key in Key Management Service (KMS). Amazon S3
* does not support asymmetric KMS keys.
*
* You must provide a KmsKeyArn
if you specify SSE_KMS
as the
* ObjectEncryptionType
.
*
*
* KmsKeyArn
is not required if you specify SSE_S3
as the
* ObjectEncryptionType
.
*/
public final String kmsKeyArn() {
return kmsKeyArn;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(objectEncryptionTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(kmsKeyArn());
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 S3EncryptionConfiguration)) {
return false;
}
S3EncryptionConfiguration other = (S3EncryptionConfiguration) obj;
return Objects.equals(objectEncryptionTypeAsString(), other.objectEncryptionTypeAsString())
&& Objects.equals(kmsKeyArn(), other.kmsKeyArn());
}
/**
* 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("S3EncryptionConfiguration").add("ObjectEncryptionType", objectEncryptionTypeAsString())
.add("KmsKeyArn", kmsKeyArn()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ObjectEncryptionType":
return Optional.ofNullable(clazz.cast(objectEncryptionTypeAsString()));
case "KmsKeyArn":
return Optional.ofNullable(clazz.cast(kmsKeyArn()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* To learn more about server-side encryption options in Amazon S3, see Protecting Data Using
* Server-Side Encryption in the Amazon S3 Developer Guide.
* @see S3ObjectEncryptionType
* @return Returns a reference to this object so that method calls can be chained together.
* @see S3ObjectEncryptionType
*/
Builder objectEncryptionType(String objectEncryptionType);
/**
*
* The Amazon S3 object encryption type.
*
*
* To learn more about server-side encryption options in Amazon S3, see Protecting Data Using
* Server-Side Encryption in the Amazon S3 Developer Guide.
*
*
* @param objectEncryptionType
* The Amazon S3 object encryption type.
*
* To learn more about server-side encryption options in Amazon S3, see Protecting Data Using
* Server-Side Encryption in the Amazon S3 Developer Guide.
* @see S3ObjectEncryptionType
* @return Returns a reference to this object so that method calls can be chained together.
* @see S3ObjectEncryptionType
*/
Builder objectEncryptionType(S3ObjectEncryptionType objectEncryptionType);
/**
*
* The Amazon Resource Name (ARN) of a symmetric encryption key in Key Management Service (KMS). Amazon S3 does
* not support asymmetric KMS keys.
*
*
* You must provide a KmsKeyArn
if you specify SSE_KMS
as the
* ObjectEncryptionType
.
*
*
* KmsKeyArn
is not required if you specify SSE_S3
as the
* ObjectEncryptionType
.
*
*
* @param kmsKeyArn
* The Amazon Resource Name (ARN) of a symmetric encryption key in Key Management Service (KMS). Amazon
* S3 does not support asymmetric KMS keys.
*
* You must provide a KmsKeyArn
if you specify SSE_KMS
as the
* ObjectEncryptionType
.
*
*
* KmsKeyArn
is not required if you specify SSE_S3
as the
* ObjectEncryptionType
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder kmsKeyArn(String kmsKeyArn);
}
static final class BuilderImpl implements Builder {
private String objectEncryptionType;
private String kmsKeyArn;
private BuilderImpl() {
}
private BuilderImpl(S3EncryptionConfiguration model) {
objectEncryptionType(model.objectEncryptionType);
kmsKeyArn(model.kmsKeyArn);
}
public final String getObjectEncryptionType() {
return objectEncryptionType;
}
public final void setObjectEncryptionType(String objectEncryptionType) {
this.objectEncryptionType = objectEncryptionType;
}
@Override
public final Builder objectEncryptionType(String objectEncryptionType) {
this.objectEncryptionType = objectEncryptionType;
return this;
}
@Override
public final Builder objectEncryptionType(S3ObjectEncryptionType objectEncryptionType) {
this.objectEncryptionType(objectEncryptionType == null ? null : objectEncryptionType.toString());
return this;
}
public final String getKmsKeyArn() {
return kmsKeyArn;
}
public final void setKmsKeyArn(String kmsKeyArn) {
this.kmsKeyArn = kmsKeyArn;
}
@Override
public final Builder kmsKeyArn(String kmsKeyArn) {
this.kmsKeyArn = kmsKeyArn;
return this;
}
@Override
public S3EncryptionConfiguration build() {
return new S3EncryptionConfiguration(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}