
software.amazon.awssdk.services.dynamodb.model.UpdateGlobalTableSettingsRequest 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.beans.Transient;
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.awscore.AwsRequestOverrideConfiguration;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateGlobalTableSettingsRequest extends DynamoDbRequest implements
ToCopyableBuilder {
private static final SdkField GLOBAL_TABLE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GlobalTableName").getter(getter(UpdateGlobalTableSettingsRequest::globalTableName))
.setter(setter(Builder::globalTableName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalTableName").build()).build();
private static final SdkField GLOBAL_TABLE_BILLING_MODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("GlobalTableBillingMode")
.getter(getter(UpdateGlobalTableSettingsRequest::globalTableBillingModeAsString))
.setter(setter(Builder::globalTableBillingMode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GlobalTableBillingMode").build())
.build();
private static final SdkField GLOBAL_TABLE_PROVISIONED_WRITE_CAPACITY_UNITS_FIELD = SdkField
. builder(MarshallingType.LONG)
.memberName("GlobalTableProvisionedWriteCapacityUnits")
.getter(getter(UpdateGlobalTableSettingsRequest::globalTableProvisionedWriteCapacityUnits))
.setter(setter(Builder::globalTableProvisionedWriteCapacityUnits))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("GlobalTableProvisionedWriteCapacityUnits").build()).build();
private static final SdkField GLOBAL_TABLE_PROVISIONED_WRITE_CAPACITY_AUTO_SCALING_SETTINGS_UPDATE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("GlobalTableProvisionedWriteCapacityAutoScalingSettingsUpdate")
.getter(getter(UpdateGlobalTableSettingsRequest::globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate))
.setter(setter(Builder::globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate))
.constructor(AutoScalingSettingsUpdate::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("GlobalTableProvisionedWriteCapacityAutoScalingSettingsUpdate").build()).build();
private static final SdkField> GLOBAL_TABLE_GLOBAL_SECONDARY_INDEX_SETTINGS_UPDATE_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("GlobalTableGlobalSecondaryIndexSettingsUpdate")
.getter(getter(UpdateGlobalTableSettingsRequest::globalTableGlobalSecondaryIndexSettingsUpdate))
.setter(setter(Builder::globalTableGlobalSecondaryIndexSettingsUpdate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("GlobalTableGlobalSecondaryIndexSettingsUpdate").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(GlobalTableGlobalSecondaryIndexSettingsUpdate::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> REPLICA_SETTINGS_UPDATE_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("ReplicaSettingsUpdate")
.getter(getter(UpdateGlobalTableSettingsRequest::replicaSettingsUpdate))
.setter(setter(Builder::replicaSettingsUpdate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReplicaSettingsUpdate").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ReplicaSettingsUpdate::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(GLOBAL_TABLE_NAME_FIELD,
GLOBAL_TABLE_BILLING_MODE_FIELD, GLOBAL_TABLE_PROVISIONED_WRITE_CAPACITY_UNITS_FIELD,
GLOBAL_TABLE_PROVISIONED_WRITE_CAPACITY_AUTO_SCALING_SETTINGS_UPDATE_FIELD,
GLOBAL_TABLE_GLOBAL_SECONDARY_INDEX_SETTINGS_UPDATE_FIELD, REPLICA_SETTINGS_UPDATE_FIELD));
private final String globalTableName;
private final String globalTableBillingMode;
private final Long globalTableProvisionedWriteCapacityUnits;
private final AutoScalingSettingsUpdate globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate;
private final List globalTableGlobalSecondaryIndexSettingsUpdate;
private final List replicaSettingsUpdate;
private UpdateGlobalTableSettingsRequest(BuilderImpl builder) {
super(builder);
this.globalTableName = builder.globalTableName;
this.globalTableBillingMode = builder.globalTableBillingMode;
this.globalTableProvisionedWriteCapacityUnits = builder.globalTableProvisionedWriteCapacityUnits;
this.globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate = builder.globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate;
this.globalTableGlobalSecondaryIndexSettingsUpdate = builder.globalTableGlobalSecondaryIndexSettingsUpdate;
this.replicaSettingsUpdate = builder.replicaSettingsUpdate;
}
/**
*
* The name of the global table
*
*
* @return The name of the global table
*/
public final String globalTableName() {
return globalTableName;
}
/**
*
* The billing mode of the global table. If GlobalTableBillingMode
is not specified, the global table
* defaults to PROVISIONED
capacity billing mode.
*
*
* -
*
* PROVISIONED
- We recommend using PROVISIONED
for predictable workloads.
* PROVISIONED
sets the billing mode to Provisioned Mode.
*
*
* -
*
* PAY_PER_REQUEST
- We recommend using PAY_PER_REQUEST
for unpredictable workloads.
* PAY_PER_REQUEST
sets the billing mode to On-Demand Mode.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #globalTableBillingMode} will return {@link BillingMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by
* the service is available from {@link #globalTableBillingModeAsString}.
*
*
* @return The billing mode of the global table. If GlobalTableBillingMode
is not specified, the global
* table defaults to PROVISIONED
capacity billing mode.
*
* -
*
* PROVISIONED
- We recommend using PROVISIONED
for predictable workloads.
* PROVISIONED
sets the billing mode to Provisioned Mode.
*
*
* -
*
* PAY_PER_REQUEST
- We recommend using PAY_PER_REQUEST
for unpredictable
* workloads. PAY_PER_REQUEST
sets the billing mode to On-Demand Mode.
*
*
* @see BillingMode
*/
public final BillingMode globalTableBillingMode() {
return BillingMode.fromValue(globalTableBillingMode);
}
/**
*
* The billing mode of the global table. If GlobalTableBillingMode
is not specified, the global table
* defaults to PROVISIONED
capacity billing mode.
*
*
* -
*
* PROVISIONED
- We recommend using PROVISIONED
for predictable workloads.
* PROVISIONED
sets the billing mode to Provisioned Mode.
*
*
* -
*
* PAY_PER_REQUEST
- We recommend using PAY_PER_REQUEST
for unpredictable workloads.
* PAY_PER_REQUEST
sets the billing mode to On-Demand Mode.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #globalTableBillingMode} will return {@link BillingMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by
* the service is available from {@link #globalTableBillingModeAsString}.
*
*
* @return The billing mode of the global table. If GlobalTableBillingMode
is not specified, the global
* table defaults to PROVISIONED
capacity billing mode.
*
* -
*
* PROVISIONED
- We recommend using PROVISIONED
for predictable workloads.
* PROVISIONED
sets the billing mode to Provisioned Mode.
*
*
* -
*
* PAY_PER_REQUEST
- We recommend using PAY_PER_REQUEST
for unpredictable
* workloads. PAY_PER_REQUEST
sets the billing mode to On-Demand Mode.
*
*
* @see BillingMode
*/
public final String globalTableBillingModeAsString() {
return globalTableBillingMode;
}
/**
*
* The maximum number of writes consumed per second before DynamoDB returns a ThrottlingException.
*
*
* @return The maximum number of writes consumed per second before DynamoDB returns a
* ThrottlingException.
*/
public final Long globalTableProvisionedWriteCapacityUnits() {
return globalTableProvisionedWriteCapacityUnits;
}
/**
*
* Auto scaling settings for managing provisioned write capacity for the global table.
*
*
* @return Auto scaling settings for managing provisioned write capacity for the global table.
*/
public final AutoScalingSettingsUpdate globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate() {
return globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate;
}
/**
* For responses, this returns true if the service returned a value for the
* GlobalTableGlobalSecondaryIndexSettingsUpdate 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 hasGlobalTableGlobalSecondaryIndexSettingsUpdate() {
return globalTableGlobalSecondaryIndexSettingsUpdate != null
&& !(globalTableGlobalSecondaryIndexSettingsUpdate instanceof SdkAutoConstructList);
}
/**
*
* Represents the settings of a global secondary index for a global table that will be modified.
*
*
* 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 #hasGlobalTableGlobalSecondaryIndexSettingsUpdate} method.
*
*
* @return Represents the settings of a global secondary index for a global table that will be modified.
*/
public final List globalTableGlobalSecondaryIndexSettingsUpdate() {
return globalTableGlobalSecondaryIndexSettingsUpdate;
}
/**
* For responses, this returns true if the service returned a value for the ReplicaSettingsUpdate 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 hasReplicaSettingsUpdate() {
return replicaSettingsUpdate != null && !(replicaSettingsUpdate instanceof SdkAutoConstructList);
}
/**
*
* Represents the settings for a global table in a Region that will be modified.
*
*
* 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 #hasReplicaSettingsUpdate} method.
*
*
* @return Represents the settings for a global table in a Region that will be modified.
*/
public final List replicaSettingsUpdate() {
return replicaSettingsUpdate;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(globalTableName());
hashCode = 31 * hashCode + Objects.hashCode(globalTableBillingModeAsString());
hashCode = 31 * hashCode + Objects.hashCode(globalTableProvisionedWriteCapacityUnits());
hashCode = 31 * hashCode + Objects.hashCode(globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate());
hashCode = 31
* hashCode
+ Objects
.hashCode(hasGlobalTableGlobalSecondaryIndexSettingsUpdate() ? globalTableGlobalSecondaryIndexSettingsUpdate()
: null);
hashCode = 31 * hashCode + Objects.hashCode(hasReplicaSettingsUpdate() ? replicaSettingsUpdate() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof UpdateGlobalTableSettingsRequest)) {
return false;
}
UpdateGlobalTableSettingsRequest other = (UpdateGlobalTableSettingsRequest) obj;
return Objects.equals(globalTableName(), other.globalTableName())
&& Objects.equals(globalTableBillingModeAsString(), other.globalTableBillingModeAsString())
&& Objects.equals(globalTableProvisionedWriteCapacityUnits(), other.globalTableProvisionedWriteCapacityUnits())
&& Objects.equals(globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate(),
other.globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate())
&& hasGlobalTableGlobalSecondaryIndexSettingsUpdate() == other.hasGlobalTableGlobalSecondaryIndexSettingsUpdate()
&& Objects.equals(globalTableGlobalSecondaryIndexSettingsUpdate(),
other.globalTableGlobalSecondaryIndexSettingsUpdate())
&& hasReplicaSettingsUpdate() == other.hasReplicaSettingsUpdate()
&& Objects.equals(replicaSettingsUpdate(), other.replicaSettingsUpdate());
}
/**
* 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("UpdateGlobalTableSettingsRequest")
.add("GlobalTableName", globalTableName())
.add("GlobalTableBillingMode", globalTableBillingModeAsString())
.add("GlobalTableProvisionedWriteCapacityUnits", globalTableProvisionedWriteCapacityUnits())
.add("GlobalTableProvisionedWriteCapacityAutoScalingSettingsUpdate",
globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate())
.add("GlobalTableGlobalSecondaryIndexSettingsUpdate",
hasGlobalTableGlobalSecondaryIndexSettingsUpdate() ? globalTableGlobalSecondaryIndexSettingsUpdate()
: null).add("ReplicaSettingsUpdate", hasReplicaSettingsUpdate() ? replicaSettingsUpdate() : null)
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "GlobalTableName":
return Optional.ofNullable(clazz.cast(globalTableName()));
case "GlobalTableBillingMode":
return Optional.ofNullable(clazz.cast(globalTableBillingModeAsString()));
case "GlobalTableProvisionedWriteCapacityUnits":
return Optional.ofNullable(clazz.cast(globalTableProvisionedWriteCapacityUnits()));
case "GlobalTableProvisionedWriteCapacityAutoScalingSettingsUpdate":
return Optional.ofNullable(clazz.cast(globalTableProvisionedWriteCapacityAutoScalingSettingsUpdate()));
case "GlobalTableGlobalSecondaryIndexSettingsUpdate":
return Optional.ofNullable(clazz.cast(globalTableGlobalSecondaryIndexSettingsUpdate()));
case "ReplicaSettingsUpdate":
return Optional.ofNullable(clazz.cast(replicaSettingsUpdate()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function