
software.amazon.awssdk.services.dynamodb.model.SSEDescription 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.dynamodb.model;
import java.io.Serializable;
import java.time.Instant;
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 description of the server-side encryption status on the specified table.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SSEDescription implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(SSEDescription::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField SSE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SSEType").getter(getter(SSEDescription::sseTypeAsString)).setter(setter(Builder::sseType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SSEType").build()).build();
private static final SdkField KMS_MASTER_KEY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("KMSMasterKeyArn").getter(getter(SSEDescription::kmsMasterKeyArn))
.setter(setter(Builder::kmsMasterKeyArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KMSMasterKeyArn").build()).build();
private static final SdkField INACCESSIBLE_ENCRYPTION_DATE_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("InaccessibleEncryptionDateTime")
.getter(getter(SSEDescription::inaccessibleEncryptionDateTime))
.setter(setter(Builder::inaccessibleEncryptionDateTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InaccessibleEncryptionDateTime")
.build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(STATUS_FIELD, SSE_TYPE_FIELD,
KMS_MASTER_KEY_ARN_FIELD, INACCESSIBLE_ENCRYPTION_DATE_TIME_FIELD));
private static final long serialVersionUID = 1L;
private final String status;
private final String sseType;
private final String kmsMasterKeyArn;
private final Instant inaccessibleEncryptionDateTime;
private SSEDescription(BuilderImpl builder) {
this.status = builder.status;
this.sseType = builder.sseType;
this.kmsMasterKeyArn = builder.kmsMasterKeyArn;
this.inaccessibleEncryptionDateTime = builder.inaccessibleEncryptionDateTime;
}
/**
*
* Represents the current state of server-side encryption. The only supported values are:
*
*
* -
*
* ENABLED
- Server-side encryption is enabled.
*
*
* -
*
* UPDATING
- Server-side encryption is being updated.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link SSEStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return Represents the current state of server-side encryption. The only supported values are:
*
* -
*
* ENABLED
- Server-side encryption is enabled.
*
*
* -
*
* UPDATING
- Server-side encryption is being updated.
*
*
* @see SSEStatus
*/
public final SSEStatus status() {
return SSEStatus.fromValue(status);
}
/**
*
* Represents the current state of server-side encryption. The only supported values are:
*
*
* -
*
* ENABLED
- Server-side encryption is enabled.
*
*
* -
*
* UPDATING
- Server-side encryption is being updated.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link SSEStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return Represents the current state of server-side encryption. The only supported values are:
*
* -
*
* ENABLED
- Server-side encryption is enabled.
*
*
* -
*
* UPDATING
- Server-side encryption is being updated.
*
*
* @see SSEStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* Server-side encryption type. The only supported value is:
*
*
* -
*
* KMS
- Server-side encryption that uses AWS Key Management Service. The key is stored in your account
* and is managed by AWS KMS (AWS KMS charges apply).
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #sseType} will
* return {@link SSEType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #sseTypeAsString}.
*
*
* @return Server-side encryption type. The only supported value is:
*
* -
*
* KMS
- Server-side encryption that uses AWS Key Management Service. The key is stored in your
* account and is managed by AWS KMS (AWS KMS charges apply).
*
*
* @see SSEType
*/
public final SSEType sseType() {
return SSEType.fromValue(sseType);
}
/**
*
* Server-side encryption type. The only supported value is:
*
*
* -
*
* KMS
- Server-side encryption that uses AWS Key Management Service. The key is stored in your account
* and is managed by AWS KMS (AWS KMS charges apply).
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #sseType} will
* return {@link SSEType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #sseTypeAsString}.
*
*
* @return Server-side encryption type. The only supported value is:
*
* -
*
* KMS
- Server-side encryption that uses AWS Key Management Service. The key is stored in your
* account and is managed by AWS KMS (AWS KMS charges apply).
*
*
* @see SSEType
*/
public final String sseTypeAsString() {
return sseType;
}
/**
*
* The AWS KMS customer master key (CMK) ARN used for the AWS KMS encryption.
*
*
* @return The AWS KMS customer master key (CMK) ARN used for the AWS KMS encryption.
*/
public final String kmsMasterKeyArn() {
return kmsMasterKeyArn;
}
/**
*
* Indicates the time, in UNIX epoch date format, when DynamoDB detected that the table's AWS KMS key was
* inaccessible. This attribute will automatically be cleared when DynamoDB detects that the table's AWS KMS key is
* accessible again. DynamoDB will initiate the table archival process when table's AWS KMS key remains inaccessible
* for more than seven days from this date.
*
*
* @return Indicates the time, in UNIX epoch date format, when DynamoDB detected that the table's AWS KMS key was
* inaccessible. This attribute will automatically be cleared when DynamoDB detects that the table's AWS KMS
* key is accessible again. DynamoDB will initiate the table archival process when table's AWS KMS key
* remains inaccessible for more than seven days from this date.
*/
public final Instant inaccessibleEncryptionDateTime() {
return inaccessibleEncryptionDateTime;
}
@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(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(sseTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(kmsMasterKeyArn());
hashCode = 31 * hashCode + Objects.hashCode(inaccessibleEncryptionDateTime());
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 SSEDescription)) {
return false;
}
SSEDescription other = (SSEDescription) obj;
return Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(sseTypeAsString(), other.sseTypeAsString())
&& Objects.equals(kmsMasterKeyArn(), other.kmsMasterKeyArn())
&& Objects.equals(inaccessibleEncryptionDateTime(), other.inaccessibleEncryptionDateTime());
}
/**
* 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("SSEDescription").add("Status", statusAsString()).add("SSEType", sseTypeAsString())
.add("KMSMasterKeyArn", kmsMasterKeyArn())
.add("InaccessibleEncryptionDateTime", inaccessibleEncryptionDateTime()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "SSEType":
return Optional.ofNullable(clazz.cast(sseTypeAsString()));
case "KMSMasterKeyArn":
return Optional.ofNullable(clazz.cast(kmsMasterKeyArn()));
case "InaccessibleEncryptionDateTime":
return Optional.ofNullable(clazz.cast(inaccessibleEncryptionDateTime()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function