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

software.amazon.awssdk.services.dynamodb.model.CreateReplicationGroupMemberAction Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon DynamoDB module holds the client classes that are used for communicating with Amazon DynamoDB Service

There is a newer version: 2.28.3
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.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 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 getter(Function g) { return obj -> g.apply((CreateReplicationGroupMemberAction) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The Region where the new replica will be created. *

* * @param regionName * The Region where the new replica will be created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder regionName(String 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. *

* * @param kmsMasterKeyId * 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 Returns a reference to this object so that method calls can be chained together. */ Builder kmsMasterKeyId(String kmsMasterKeyId); /** *

* Replica-specific provisioned throughput. If not specified, uses the source table's provisioned throughput * settings. *

* * @param provisionedThroughputOverride * Replica-specific provisioned throughput. If not specified, uses the source table's provisioned * throughput settings. * @return Returns a reference to this object so that method calls can be chained together. */ Builder provisionedThroughputOverride(ProvisionedThroughputOverride provisionedThroughputOverride); /** *

* Replica-specific provisioned throughput. If not specified, uses the source table's provisioned throughput * settings. *

* This is a convenience method that creates an instance of the {@link ProvisionedThroughputOverride.Builder} * avoiding the need to create one manually via {@link ProvisionedThroughputOverride#builder()}. * *

* When the {@link Consumer} completes, {@link ProvisionedThroughputOverride.Builder#build()} is called * immediately and its result is passed to {@link #provisionedThroughputOverride(ProvisionedThroughputOverride)}. * * @param provisionedThroughputOverride * a consumer that will call methods on {@link ProvisionedThroughputOverride.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #provisionedThroughputOverride(ProvisionedThroughputOverride) */ default Builder provisionedThroughputOverride( Consumer provisionedThroughputOverride) { return provisionedThroughputOverride(ProvisionedThroughputOverride.builder() .applyMutation(provisionedThroughputOverride).build()); } /** *

* 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. *

* * @param onDemandThroughputOverride * 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 Returns a reference to this object so that method calls can be chained together. */ Builder onDemandThroughputOverride(OnDemandThroughputOverride onDemandThroughputOverride); /** *

* 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. *

* This is a convenience method that creates an instance of the {@link OnDemandThroughputOverride.Builder} * avoiding the need to create one manually via {@link OnDemandThroughputOverride#builder()}. * *

* When the {@link Consumer} completes, {@link OnDemandThroughputOverride.Builder#build()} is called immediately * and its result is passed to {@link #onDemandThroughputOverride(OnDemandThroughputOverride)}. * * @param onDemandThroughputOverride * a consumer that will call methods on {@link OnDemandThroughputOverride.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #onDemandThroughputOverride(OnDemandThroughputOverride) */ default Builder onDemandThroughputOverride(Consumer onDemandThroughputOverride) { return onDemandThroughputOverride(OnDemandThroughputOverride.builder().applyMutation(onDemandThroughputOverride) .build()); } /** *

* Replica-specific global secondary index settings. *

* * @param globalSecondaryIndexes * Replica-specific global secondary index settings. * @return Returns a reference to this object so that method calls can be chained together. */ Builder globalSecondaryIndexes(Collection globalSecondaryIndexes); /** *

* Replica-specific global secondary index settings. *

* * @param globalSecondaryIndexes * Replica-specific global secondary index settings. * @return Returns a reference to this object so that method calls can be chained together. */ Builder globalSecondaryIndexes(ReplicaGlobalSecondaryIndex... globalSecondaryIndexes); /** *

* Replica-specific global secondary index settings. *

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

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.dynamodb.model.ReplicaGlobalSecondaryIndex.Builder#build()} is called * immediately and its result is passed to {@link #globalSecondaryIndexes(List)}. * * @param globalSecondaryIndexes * a consumer that will call methods on * {@link software.amazon.awssdk.services.dynamodb.model.ReplicaGlobalSecondaryIndex.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #globalSecondaryIndexes(java.util.Collection) */ Builder globalSecondaryIndexes(Consumer... globalSecondaryIndexes); /** *

* Replica-specific table class. If not specified, uses the source table's table class. *

* * @param tableClassOverride * Replica-specific table class. If not specified, uses the source table's table class. * @see TableClass * @return Returns a reference to this object so that method calls can be chained together. * @see TableClass */ Builder tableClassOverride(String tableClassOverride); /** *

* Replica-specific table class. If not specified, uses the source table's table class. *

* * @param tableClassOverride * Replica-specific table class. If not specified, uses the source table's table class. * @see TableClass * @return Returns a reference to this object so that method calls can be chained together. * @see TableClass */ Builder tableClassOverride(TableClass tableClassOverride); } static final class BuilderImpl implements Builder { private String regionName; private String kmsMasterKeyId; private ProvisionedThroughputOverride provisionedThroughputOverride; private OnDemandThroughputOverride onDemandThroughputOverride; private List globalSecondaryIndexes = DefaultSdkAutoConstructList.getInstance(); private String tableClassOverride; private BuilderImpl() { } private BuilderImpl(CreateReplicationGroupMemberAction model) { regionName(model.regionName); kmsMasterKeyId(model.kmsMasterKeyId); provisionedThroughputOverride(model.provisionedThroughputOverride); onDemandThroughputOverride(model.onDemandThroughputOverride); globalSecondaryIndexes(model.globalSecondaryIndexes); tableClassOverride(model.tableClassOverride); } public final String getRegionName() { return regionName; } public final void setRegionName(String regionName) { this.regionName = regionName; } @Override public final Builder regionName(String regionName) { this.regionName = regionName; return this; } public final String getKmsMasterKeyId() { return kmsMasterKeyId; } public final void setKmsMasterKeyId(String kmsMasterKeyId) { this.kmsMasterKeyId = kmsMasterKeyId; } @Override public final Builder kmsMasterKeyId(String kmsMasterKeyId) { this.kmsMasterKeyId = kmsMasterKeyId; return this; } public final ProvisionedThroughputOverride.Builder getProvisionedThroughputOverride() { return provisionedThroughputOverride != null ? provisionedThroughputOverride.toBuilder() : null; } public final void setProvisionedThroughputOverride(ProvisionedThroughputOverride.BuilderImpl provisionedThroughputOverride) { this.provisionedThroughputOverride = provisionedThroughputOverride != null ? provisionedThroughputOverride.build() : null; } @Override public final Builder provisionedThroughputOverride(ProvisionedThroughputOverride provisionedThroughputOverride) { this.provisionedThroughputOverride = provisionedThroughputOverride; return this; } public final OnDemandThroughputOverride.Builder getOnDemandThroughputOverride() { return onDemandThroughputOverride != null ? onDemandThroughputOverride.toBuilder() : null; } public final void setOnDemandThroughputOverride(OnDemandThroughputOverride.BuilderImpl onDemandThroughputOverride) { this.onDemandThroughputOverride = onDemandThroughputOverride != null ? onDemandThroughputOverride.build() : null; } @Override public final Builder onDemandThroughputOverride(OnDemandThroughputOverride onDemandThroughputOverride) { this.onDemandThroughputOverride = onDemandThroughputOverride; return this; } public final List getGlobalSecondaryIndexes() { List result = ReplicaGlobalSecondaryIndexListCopier .copyToBuilder(this.globalSecondaryIndexes); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setGlobalSecondaryIndexes(Collection globalSecondaryIndexes) { this.globalSecondaryIndexes = ReplicaGlobalSecondaryIndexListCopier.copyFromBuilder(globalSecondaryIndexes); } @Override public final Builder globalSecondaryIndexes(Collection globalSecondaryIndexes) { this.globalSecondaryIndexes = ReplicaGlobalSecondaryIndexListCopier.copy(globalSecondaryIndexes); return this; } @Override @SafeVarargs public final Builder globalSecondaryIndexes(ReplicaGlobalSecondaryIndex... globalSecondaryIndexes) { globalSecondaryIndexes(Arrays.asList(globalSecondaryIndexes)); return this; } @Override @SafeVarargs public final Builder globalSecondaryIndexes(Consumer... globalSecondaryIndexes) { globalSecondaryIndexes(Stream.of(globalSecondaryIndexes) .map(c -> ReplicaGlobalSecondaryIndex.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final String getTableClassOverride() { return tableClassOverride; } public final void setTableClassOverride(String tableClassOverride) { this.tableClassOverride = tableClassOverride; } @Override public final Builder tableClassOverride(String tableClassOverride) { this.tableClassOverride = tableClassOverride; return this; } @Override public final Builder tableClassOverride(TableClass tableClassOverride) { this.tableClassOverride(tableClassOverride == null ? null : tableClassOverride.toString()); return this; } @Override public CreateReplicationGroupMemberAction build() { return new CreateReplicationGroupMemberAction(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy