software.amazon.awssdk.services.dynamodb.model.ReplicaGlobalSecondaryIndexSettingsDescription 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.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 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;
/**
*
* Represents the properties of a global secondary index.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ReplicaGlobalSecondaryIndexSettingsDescription implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField INDEX_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IndexName").getter(getter(ReplicaGlobalSecondaryIndexSettingsDescription::indexName))
.setter(setter(Builder::indexName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IndexName").build()).build();
private static final SdkField INDEX_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IndexStatus").getter(getter(ReplicaGlobalSecondaryIndexSettingsDescription::indexStatusAsString))
.setter(setter(Builder::indexStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IndexStatus").build()).build();
private static final SdkField PROVISIONED_READ_CAPACITY_UNITS_FIELD = SdkField
. builder(MarshallingType.LONG)
.memberName("ProvisionedReadCapacityUnits")
.getter(getter(ReplicaGlobalSecondaryIndexSettingsDescription::provisionedReadCapacityUnits))
.setter(setter(Builder::provisionedReadCapacityUnits))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProvisionedReadCapacityUnits")
.build()).build();
private static final SdkField PROVISIONED_READ_CAPACITY_AUTO_SCALING_SETTINGS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("ProvisionedReadCapacityAutoScalingSettings")
.getter(getter(ReplicaGlobalSecondaryIndexSettingsDescription::provisionedReadCapacityAutoScalingSettings))
.setter(setter(Builder::provisionedReadCapacityAutoScalingSettings))
.constructor(AutoScalingSettingsDescription::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("ProvisionedReadCapacityAutoScalingSettings").build()).build();
private static final SdkField PROVISIONED_WRITE_CAPACITY_UNITS_FIELD = SdkField
. builder(MarshallingType.LONG)
.memberName("ProvisionedWriteCapacityUnits")
.getter(getter(ReplicaGlobalSecondaryIndexSettingsDescription::provisionedWriteCapacityUnits))
.setter(setter(Builder::provisionedWriteCapacityUnits))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProvisionedWriteCapacityUnits")
.build()).build();
private static final SdkField PROVISIONED_WRITE_CAPACITY_AUTO_SCALING_SETTINGS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("ProvisionedWriteCapacityAutoScalingSettings")
.getter(getter(ReplicaGlobalSecondaryIndexSettingsDescription::provisionedWriteCapacityAutoScalingSettings))
.setter(setter(Builder::provisionedWriteCapacityAutoScalingSettings))
.constructor(AutoScalingSettingsDescription::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("ProvisionedWriteCapacityAutoScalingSettings").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INDEX_NAME_FIELD,
INDEX_STATUS_FIELD, PROVISIONED_READ_CAPACITY_UNITS_FIELD, PROVISIONED_READ_CAPACITY_AUTO_SCALING_SETTINGS_FIELD,
PROVISIONED_WRITE_CAPACITY_UNITS_FIELD, PROVISIONED_WRITE_CAPACITY_AUTO_SCALING_SETTINGS_FIELD));
private static final long serialVersionUID = 1L;
private final String indexName;
private final String indexStatus;
private final Long provisionedReadCapacityUnits;
private final AutoScalingSettingsDescription provisionedReadCapacityAutoScalingSettings;
private final Long provisionedWriteCapacityUnits;
private final AutoScalingSettingsDescription provisionedWriteCapacityAutoScalingSettings;
private ReplicaGlobalSecondaryIndexSettingsDescription(BuilderImpl builder) {
this.indexName = builder.indexName;
this.indexStatus = builder.indexStatus;
this.provisionedReadCapacityUnits = builder.provisionedReadCapacityUnits;
this.provisionedReadCapacityAutoScalingSettings = builder.provisionedReadCapacityAutoScalingSettings;
this.provisionedWriteCapacityUnits = builder.provisionedWriteCapacityUnits;
this.provisionedWriteCapacityAutoScalingSettings = builder.provisionedWriteCapacityAutoScalingSettings;
}
/**
*
* The name of the global secondary index. The name must be unique among all other indexes on this table.
*
*
* @return The name of the global secondary index. The name must be unique among all other indexes on this table.
*/
public final String indexName() {
return indexName;
}
/**
*
* The current status of the global secondary index:
*
*
* -
*
* CREATING
- The global secondary index is being created.
*
*
* -
*
* UPDATING
- The global secondary index is being updated.
*
*
* -
*
* DELETING
- The global secondary index is being deleted.
*
*
* -
*
* ACTIVE
- The global secondary index is ready for use.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #indexStatus} will
* return {@link IndexStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #indexStatusAsString}.
*
*
* @return The current status of the global secondary index:
*
* -
*
* CREATING
- The global secondary index is being created.
*
*
* -
*
* UPDATING
- The global secondary index is being updated.
*
*
* -
*
* DELETING
- The global secondary index is being deleted.
*
*
* -
*
* ACTIVE
- The global secondary index is ready for use.
*
*
* @see IndexStatus
*/
public final IndexStatus indexStatus() {
return IndexStatus.fromValue(indexStatus);
}
/**
*
* The current status of the global secondary index:
*
*
* -
*
* CREATING
- The global secondary index is being created.
*
*
* -
*
* UPDATING
- The global secondary index is being updated.
*
*
* -
*
* DELETING
- The global secondary index is being deleted.
*
*
* -
*
* ACTIVE
- The global secondary index is ready for use.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #indexStatus} will
* return {@link IndexStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #indexStatusAsString}.
*
*
* @return The current status of the global secondary index:
*
* -
*
* CREATING
- The global secondary index is being created.
*
*
* -
*
* UPDATING
- The global secondary index is being updated.
*
*
* -
*
* DELETING
- The global secondary index is being deleted.
*
*
* -
*
* ACTIVE
- The global secondary index is ready for use.
*
*
* @see IndexStatus
*/
public final String indexStatusAsString() {
return indexStatus;
}
/**
*
* The maximum number of strongly consistent reads consumed per second before DynamoDB returns a
* ThrottlingException
.
*
*
* @return The maximum number of strongly consistent reads consumed per second before DynamoDB returns a
* ThrottlingException
.
*/
public final Long provisionedReadCapacityUnits() {
return provisionedReadCapacityUnits;
}
/**
*
* Auto scaling settings for a global secondary index replica's read capacity units.
*
*
* @return Auto scaling settings for a global secondary index replica's read capacity units.
*/
public final AutoScalingSettingsDescription provisionedReadCapacityAutoScalingSettings() {
return provisionedReadCapacityAutoScalingSettings;
}
/**
*
* 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 provisionedWriteCapacityUnits() {
return provisionedWriteCapacityUnits;
}
/**
*
* Auto scaling settings for a global secondary index replica's write capacity units.
*
*
* @return Auto scaling settings for a global secondary index replica's write capacity units.
*/
public final AutoScalingSettingsDescription provisionedWriteCapacityAutoScalingSettings() {
return provisionedWriteCapacityAutoScalingSettings;
}
@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(indexName());
hashCode = 31 * hashCode + Objects.hashCode(indexStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(provisionedReadCapacityUnits());
hashCode = 31 * hashCode + Objects.hashCode(provisionedReadCapacityAutoScalingSettings());
hashCode = 31 * hashCode + Objects.hashCode(provisionedWriteCapacityUnits());
hashCode = 31 * hashCode + Objects.hashCode(provisionedWriteCapacityAutoScalingSettings());
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 ReplicaGlobalSecondaryIndexSettingsDescription)) {
return false;
}
ReplicaGlobalSecondaryIndexSettingsDescription other = (ReplicaGlobalSecondaryIndexSettingsDescription) obj;
return Objects.equals(indexName(), other.indexName())
&& Objects.equals(indexStatusAsString(), other.indexStatusAsString())
&& Objects.equals(provisionedReadCapacityUnits(), other.provisionedReadCapacityUnits())
&& Objects.equals(provisionedReadCapacityAutoScalingSettings(),
other.provisionedReadCapacityAutoScalingSettings())
&& Objects.equals(provisionedWriteCapacityUnits(), other.provisionedWriteCapacityUnits())
&& Objects.equals(provisionedWriteCapacityAutoScalingSettings(),
other.provisionedWriteCapacityAutoScalingSettings());
}
/**
* 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("ReplicaGlobalSecondaryIndexSettingsDescription").add("IndexName", indexName())
.add("IndexStatus", indexStatusAsString()).add("ProvisionedReadCapacityUnits", provisionedReadCapacityUnits())
.add("ProvisionedReadCapacityAutoScalingSettings", provisionedReadCapacityAutoScalingSettings())
.add("ProvisionedWriteCapacityUnits", provisionedWriteCapacityUnits())
.add("ProvisionedWriteCapacityAutoScalingSettings", provisionedWriteCapacityAutoScalingSettings()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "IndexName":
return Optional.ofNullable(clazz.cast(indexName()));
case "IndexStatus":
return Optional.ofNullable(clazz.cast(indexStatusAsString()));
case "ProvisionedReadCapacityUnits":
return Optional.ofNullable(clazz.cast(provisionedReadCapacityUnits()));
case "ProvisionedReadCapacityAutoScalingSettings":
return Optional.ofNullable(clazz.cast(provisionedReadCapacityAutoScalingSettings()));
case "ProvisionedWriteCapacityUnits":
return Optional.ofNullable(clazz.cast(provisionedWriteCapacityUnits()));
case "ProvisionedWriteCapacityAutoScalingSettings":
return Optional.ofNullable(clazz.cast(provisionedWriteCapacityAutoScalingSettings()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function