
software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput Maven / Gradle / Ivy
/*
* Copyright 2013-2018 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.util.Objects;
import java.util.Optional;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.services.dynamodb.transform.ProvisionedThroughputMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents the provisioned throughput settings for a specified table or index. The settings can be modified using the
* UpdateTable
operation.
*
*
* For current minimum and maximum provisioned throughput values, see Limits in the Amazon
* DynamoDB Developer Guide.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ProvisionedThroughput implements StructuredPojo,
ToCopyableBuilder {
private final Long readCapacityUnits;
private final Long writeCapacityUnits;
private ProvisionedThroughput(BuilderImpl builder) {
this.readCapacityUnits = builder.readCapacityUnits;
this.writeCapacityUnits = builder.writeCapacityUnits;
}
/**
*
* The maximum number of strongly consistent reads consumed per second before DynamoDB returns a
* ThrottlingException
. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide.
*
*
* @return The maximum number of strongly consistent reads consumed per second before DynamoDB returns a
* ThrottlingException
. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide.
*/
public Long readCapacityUnits() {
return readCapacityUnits;
}
/**
*
* The maximum number of writes consumed per second before DynamoDB returns a ThrottlingException
. For
* more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide.
*
*
* @return The maximum number of writes consumed per second before DynamoDB returns a
* ThrottlingException
. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide.
*/
public Long writeCapacityUnits() {
return writeCapacityUnits;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(readCapacityUnits());
hashCode = 31 * hashCode + Objects.hashCode(writeCapacityUnits());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ProvisionedThroughput)) {
return false;
}
ProvisionedThroughput other = (ProvisionedThroughput) obj;
return Objects.equals(readCapacityUnits(), other.readCapacityUnits())
&& Objects.equals(writeCapacityUnits(), other.writeCapacityUnits());
}
@Override
public String toString() {
return ToString.builder("ProvisionedThroughput").add("ReadCapacityUnits", readCapacityUnits())
.add("WriteCapacityUnits", writeCapacityUnits()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ReadCapacityUnits":
return Optional.ofNullable(clazz.cast(readCapacityUnits()));
case "WriteCapacityUnits":
return Optional.ofNullable(clazz.cast(writeCapacityUnits()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
ProvisionedThroughputMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The maximum number of strongly consistent reads consumed per second before DynamoDB returns a
* ThrottlingException
. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide.
*
*
* @param readCapacityUnits
* The maximum number of strongly consistent reads consumed per second before DynamoDB returns a
* ThrottlingException
. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder readCapacityUnits(Long readCapacityUnits);
/**
*
* The maximum number of writes consumed per second before DynamoDB returns a ThrottlingException
.
* For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide.
*
*
* @param writeCapacityUnits
* The maximum number of writes consumed per second before DynamoDB returns a
* ThrottlingException
. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder writeCapacityUnits(Long writeCapacityUnits);
}
static final class BuilderImpl implements Builder {
private Long readCapacityUnits;
private Long writeCapacityUnits;
private BuilderImpl() {
}
private BuilderImpl(ProvisionedThroughput model) {
readCapacityUnits(model.readCapacityUnits);
writeCapacityUnits(model.writeCapacityUnits);
}
public final Long getReadCapacityUnits() {
return readCapacityUnits;
}
@Override
public final Builder readCapacityUnits(Long readCapacityUnits) {
this.readCapacityUnits = readCapacityUnits;
return this;
}
public final void setReadCapacityUnits(Long readCapacityUnits) {
this.readCapacityUnits = readCapacityUnits;
}
public final Long getWriteCapacityUnits() {
return writeCapacityUnits;
}
@Override
public final Builder writeCapacityUnits(Long writeCapacityUnits) {
this.writeCapacityUnits = writeCapacityUnits;
return this;
}
public final void setWriteCapacityUnits(Long writeCapacityUnits) {
this.writeCapacityUnits = writeCapacityUnits;
}
@Override
public ProvisionedThroughput build() {
return new ProvisionedThroughput(this);
}
}
}