software.amazon.awssdk.services.dynamodb.model.CreateReplicationGroupMemberAction Maven / Gradle / Ivy
Show all versions of dynamodb 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.dynamodb.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;
/**
*
* Represents a replica to be created.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateReplicationGroupMemberAction implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField REGION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RegionName").getter(getter(CreateReplicationGroupMemberAction::regionName))
.setter(setter(Builder::regionName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RegionName").build()).build();
private static final SdkField KMS_MASTER_KEY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("KMSMasterKeyId").getter(getter(CreateReplicationGroupMemberAction::kmsMasterKeyId))
.setter(setter(Builder::kmsMasterKeyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KMSMasterKeyId").build()).build();
private static final SdkField PROVISIONED_THROUGHPUT_OVERRIDE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("ProvisionedThroughputOverride")
.getter(getter(CreateReplicationGroupMemberAction::provisionedThroughputOverride))
.setter(setter(Builder::provisionedThroughputOverride))
.constructor(ProvisionedThroughputOverride::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProvisionedThroughputOverride")
.build()).build();
private static final SdkField ON_DEMAND_THROUGHPUT_OVERRIDE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("OnDemandThroughputOverride")
.getter(getter(CreateReplicationGroupMemberAction::onDemandThroughputOverride))
.setter(setter(Builder::onDemandThroughputOverride))
.constructor(OnDemandThroughputOverride::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OnDemandThroughputOverride").build())
.build();
private static final SdkField> GLOBAL_SECONDARY_INDEXES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("GlobalSecondaryIndexes")
.getter(getter(CreateReplicationGroupMemberAction::globalSecondaryIndexes))
.setter(setter(Builder::globalSecondaryIndexes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalSecondaryIndexes").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ReplicaGlobalSecondaryIndex::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField TABLE_CLASS_OVERRIDE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TableClassOverride").getter(getter(CreateReplicationGroupMemberAction::tableClassOverrideAsString))
.setter(setter(Builder::tableClassOverride))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TableClassOverride").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(REGION_NAME_FIELD,
KMS_MASTER_KEY_ID_FIELD, PROVISIONED_THROUGHPUT_OVERRIDE_FIELD, ON_DEMAND_THROUGHPUT_OVERRIDE_FIELD,
GLOBAL_SECONDARY_INDEXES_FIELD, TABLE_CLASS_OVERRIDE_FIELD));
private static final long serialVersionUID = 1L;
private final String regionName;
private final String kmsMasterKeyId;
private final ProvisionedThroughputOverride provisionedThroughputOverride;
private final OnDemandThroughputOverride onDemandThroughputOverride;
private final List globalSecondaryIndexes;
private final String tableClassOverride;
private CreateReplicationGroupMemberAction(BuilderImpl builder) {
this.regionName = builder.regionName;
this.kmsMasterKeyId = builder.kmsMasterKeyId;
this.provisionedThroughputOverride = builder.provisionedThroughputOverride;
this.onDemandThroughputOverride = builder.onDemandThroughputOverride;
this.globalSecondaryIndexes = builder.globalSecondaryIndexes;
this.tableClassOverride = builder.tableClassOverride;
}
/**
*
* The Region where the new replica will be created.
*
*
* @return The Region where the new replica will be created.
*/
public final String regionName() {
return regionName;
}
/**
*
* The KMS key that should be used for KMS encryption in the new replica. To specify a key, use its key ID, Amazon
* Resource Name (ARN), alias name, or alias ARN. Note that you should only provide this parameter if the key is
* different from the default DynamoDB KMS key alias/aws/dynamodb
.
*
*
* @return The KMS key that should be used for KMS encryption in the new replica. To specify a key, use its key ID,
* Amazon Resource Name (ARN), alias name, or alias ARN. Note that you should only provide this parameter if
* the key is different from the default DynamoDB KMS key alias/aws/dynamodb
.
*/
public final String kmsMasterKeyId() {
return kmsMasterKeyId;
}
/**
*
* Replica-specific provisioned throughput. If not specified, uses the source table's provisioned throughput
* settings.
*
*
* @return Replica-specific provisioned throughput. If not specified, uses the source table's provisioned throughput
* settings.
*/
public final ProvisionedThroughputOverride provisionedThroughputOverride() {
return provisionedThroughputOverride;
}
/**
*
* The maximum on-demand throughput settings for the specified replica table being created. You can only modify
* MaxReadRequestUnits
, because you can't modify MaxWriteRequestUnits
for individual
* replica tables.
*
*
* @return The maximum on-demand throughput settings for the specified replica table being created. You can only
* modify MaxReadRequestUnits
, because you can't modify MaxWriteRequestUnits
for
* individual replica tables.
*/
public final OnDemandThroughputOverride onDemandThroughputOverride() {
return onDemandThroughputOverride;
}
/**
* For responses, this returns true if the service returned a value for the GlobalSecondaryIndexes 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 hasGlobalSecondaryIndexes() {
return globalSecondaryIndexes != null && !(globalSecondaryIndexes instanceof SdkAutoConstructList);
}
/**
*
* Replica-specific global secondary index settings.
*
*
* 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 #hasGlobalSecondaryIndexes} method.
*
*
* @return Replica-specific global secondary index settings.
*/
public final List globalSecondaryIndexes() {
return globalSecondaryIndexes;
}
/**
*
* Replica-specific table class. If not specified, uses the source table's table class.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #tableClassOverride} will return {@link TableClass#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the
* service is available from {@link #tableClassOverrideAsString}.
*
*
* @return Replica-specific table class. If not specified, uses the source table's table class.
* @see TableClass
*/
public final TableClass tableClassOverride() {
return TableClass.fromValue(tableClassOverride);
}
/**
*
* Replica-specific table class. If not specified, uses the source table's table class.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #tableClassOverride} will return {@link TableClass#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the
* service is available from {@link #tableClassOverrideAsString}.
*
*
* @return Replica-specific table class. If not specified, uses the source table's table class.
* @see TableClass
*/
public final String tableClassOverrideAsString() {
return tableClassOverride;
}
@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(regionName());
hashCode = 31 * hashCode + Objects.hashCode(kmsMasterKeyId());
hashCode = 31 * hashCode + Objects.hashCode(provisionedThroughputOverride());
hashCode = 31 * hashCode + Objects.hashCode(onDemandThroughputOverride());
hashCode = 31 * hashCode + Objects.hashCode(hasGlobalSecondaryIndexes() ? globalSecondaryIndexes() : null);
hashCode = 31 * hashCode + Objects.hashCode(tableClassOverrideAsString());
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 CreateReplicationGroupMemberAction)) {
return false;
}
CreateReplicationGroupMemberAction other = (CreateReplicationGroupMemberAction) obj;
return Objects.equals(regionName(), other.regionName()) && Objects.equals(kmsMasterKeyId(), other.kmsMasterKeyId())
&& Objects.equals(provisionedThroughputOverride(), other.provisionedThroughputOverride())
&& Objects.equals(onDemandThroughputOverride(), other.onDemandThroughputOverride())
&& hasGlobalSecondaryIndexes() == other.hasGlobalSecondaryIndexes()
&& Objects.equals(globalSecondaryIndexes(), other.globalSecondaryIndexes())
&& Objects.equals(tableClassOverrideAsString(), other.tableClassOverrideAsString());
}
/**
* 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("CreateReplicationGroupMemberAction").add("RegionName", regionName())
.add("KMSMasterKeyId", kmsMasterKeyId()).add("ProvisionedThroughputOverride", provisionedThroughputOverride())
.add("OnDemandThroughputOverride", onDemandThroughputOverride())
.add("GlobalSecondaryIndexes", hasGlobalSecondaryIndexes() ? globalSecondaryIndexes() : null)
.add("TableClassOverride", tableClassOverrideAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "RegionName":
return Optional.ofNullable(clazz.cast(regionName()));
case "KMSMasterKeyId":
return Optional.ofNullable(clazz.cast(kmsMasterKeyId()));
case "ProvisionedThroughputOverride":
return Optional.ofNullable(clazz.cast(provisionedThroughputOverride()));
case "OnDemandThroughputOverride":
return Optional.ofNullable(clazz.cast(onDemandThroughputOverride()));
case "GlobalSecondaryIndexes":
return Optional.ofNullable(clazz.cast(globalSecondaryIndexes()));
case "TableClassOverride":
return Optional.ofNullable(clazz.cast(tableClassOverrideAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function