software.amazon.awssdk.services.firehose.model.DeliveryStreamEncryptionConfiguration Maven / Gradle / Ivy
Show all versions of firehose Show documentation
/*
* 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.firehose.model;
import java.io.Serializable;
import java.util.Arrays;
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.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;
/**
*
* Contains information about the server-side encryption (SSE) status for the delivery stream, the type customer master
* key (CMK) in use, if any, and the ARN of the CMK. You can get DeliveryStreamEncryptionConfiguration
by
* invoking the DescribeDeliveryStream operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DeliveryStreamEncryptionConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField KEY_ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("KeyARN")
.getter(getter(DeliveryStreamEncryptionConfiguration::keyARN)).setter(setter(Builder::keyARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KeyARN").build()).build();
private static final SdkField KEY_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("KeyType").getter(getter(DeliveryStreamEncryptionConfiguration::keyTypeAsString))
.setter(setter(Builder::keyType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KeyType").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(DeliveryStreamEncryptionConfiguration::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField FAILURE_DESCRIPTION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("FailureDescription")
.getter(getter(DeliveryStreamEncryptionConfiguration::failureDescription))
.setter(setter(Builder::failureDescription)).constructor(FailureDescription::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureDescription").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(KEY_ARN_FIELD, KEY_TYPE_FIELD,
STATUS_FIELD, FAILURE_DESCRIPTION_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final String keyARN;
private final String keyType;
private final String status;
private final FailureDescription failureDescription;
private DeliveryStreamEncryptionConfiguration(BuilderImpl builder) {
this.keyARN = builder.keyARN;
this.keyType = builder.keyType;
this.status = builder.status;
this.failureDescription = builder.failureDescription;
}
/**
*
* If KeyType
is CUSTOMER_MANAGED_CMK
, this field contains the ARN of the customer managed
* CMK. If KeyType
is Amazon Web Services_OWNED_CMK
,
* DeliveryStreamEncryptionConfiguration
doesn't contain a value for KeyARN
.
*
*
* @return If KeyType
is CUSTOMER_MANAGED_CMK
, this field contains the ARN of the customer
* managed CMK. If KeyType
is Amazon Web Services_OWNED_CMK
,
* DeliveryStreamEncryptionConfiguration
doesn't contain a value for KeyARN
.
*/
public final String keyARN() {
return keyARN;
}
/**
*
* Indicates the type of customer master key (CMK) that is used for encryption. The default setting is
* Amazon Web Services_OWNED_CMK
. For more information about CMKs, see Customer Master Keys
* (CMKs).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #keyType} will
* return {@link KeyType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #keyTypeAsString}.
*
*
* @return Indicates the type of customer master key (CMK) that is used for encryption. The default setting is
* Amazon Web Services_OWNED_CMK
. For more information about CMKs, see Customer Master
* Keys (CMKs).
* @see KeyType
*/
public final KeyType keyType() {
return KeyType.fromValue(keyType);
}
/**
*
* Indicates the type of customer master key (CMK) that is used for encryption. The default setting is
* Amazon Web Services_OWNED_CMK
. For more information about CMKs, see Customer Master Keys
* (CMKs).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #keyType} will
* return {@link KeyType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #keyTypeAsString}.
*
*
* @return Indicates the type of customer master key (CMK) that is used for encryption. The default setting is
* Amazon Web Services_OWNED_CMK
. For more information about CMKs, see Customer Master
* Keys (CMKs).
* @see KeyType
*/
public final String keyTypeAsString() {
return keyType;
}
/**
*
* This is the server-side encryption (SSE) status for the Firehose stream. For a full description of the different
* values of this status, see StartDeliveryStreamEncryption and StopDeliveryStreamEncryption. If this
* status is ENABLING_FAILED
or DISABLING_FAILED
, it is the status of the most recent
* attempt to enable or disable SSE, respectively.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link DeliveryStreamEncryptionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #statusAsString}.
*
*
* @return This is the server-side encryption (SSE) status for the Firehose stream. For a full description of the
* different values of this status, see StartDeliveryStreamEncryption and
* StopDeliveryStreamEncryption. If this status is ENABLING_FAILED
or
* DISABLING_FAILED
, it is the status of the most recent attempt to enable or disable SSE,
* respectively.
* @see DeliveryStreamEncryptionStatus
*/
public final DeliveryStreamEncryptionStatus status() {
return DeliveryStreamEncryptionStatus.fromValue(status);
}
/**
*
* This is the server-side encryption (SSE) status for the Firehose stream. For a full description of the different
* values of this status, see StartDeliveryStreamEncryption and StopDeliveryStreamEncryption. If this
* status is ENABLING_FAILED
or DISABLING_FAILED
, it is the status of the most recent
* attempt to enable or disable SSE, respectively.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link DeliveryStreamEncryptionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #statusAsString}.
*
*
* @return This is the server-side encryption (SSE) status for the Firehose stream. For a full description of the
* different values of this status, see StartDeliveryStreamEncryption and
* StopDeliveryStreamEncryption. If this status is ENABLING_FAILED
or
* DISABLING_FAILED
, it is the status of the most recent attempt to enable or disable SSE,
* respectively.
* @see DeliveryStreamEncryptionStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* Provides details in case one of the following operations fails due to an error related to KMS:
* CreateDeliveryStream, DeleteDeliveryStream, StartDeliveryStreamEncryption,
* StopDeliveryStreamEncryption.
*
*
* @return Provides details in case one of the following operations fails due to an error related to KMS:
* CreateDeliveryStream, DeleteDeliveryStream, StartDeliveryStreamEncryption,
* StopDeliveryStreamEncryption.
*/
public final FailureDescription failureDescription() {
return failureDescription;
}
@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(keyARN());
hashCode = 31 * hashCode + Objects.hashCode(keyTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(failureDescription());
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 DeliveryStreamEncryptionConfiguration)) {
return false;
}
DeliveryStreamEncryptionConfiguration other = (DeliveryStreamEncryptionConfiguration) obj;
return Objects.equals(keyARN(), other.keyARN()) && Objects.equals(keyTypeAsString(), other.keyTypeAsString())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(failureDescription(), other.failureDescription());
}
/**
* 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("DeliveryStreamEncryptionConfiguration").add("KeyARN", keyARN())
.add("KeyType", keyTypeAsString()).add("Status", statusAsString())
.add("FailureDescription", failureDescription()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "KeyARN":
return Optional.ofNullable(clazz.cast(keyARN()));
case "KeyType":
return Optional.ofNullable(clazz.cast(keyTypeAsString()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "FailureDescription":
return Optional.ofNullable(clazz.cast(failureDescription()));
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("KeyARN", KEY_ARN_FIELD);
map.put("KeyType", KEY_TYPE_FIELD);
map.put("Status", STATUS_FIELD);
map.put("FailureDescription", FAILURE_DESCRIPTION_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function