com.amazonaws.services.dynamodbv2.model.ConsumedCapacity Maven / Gradle / Ivy
/*
* Copyright 2016-2021 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 com.amazonaws.services.dynamodbv2.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* The capacity units consumed by an operation. The data returned includes the total provisioned throughput consumed,
* along with statistics for the table and any indexes involved in the operation. ConsumedCapacity
is only
* returned if the request asked for it. For more information, see Provisioned
* Throughput in the Amazon DynamoDB Developer Guide.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ConsumedCapacity implements Serializable, Cloneable, StructuredPojo {
/**
*
* The name of the table that was affected by the operation.
*
*/
private String tableName;
/**
*
* The total number of capacity units consumed by the operation.
*
*/
private Double capacityUnits;
/**
*
* The total number of read capacity units consumed by the operation.
*
*/
private Double readCapacityUnits;
/**
*
* The total number of write capacity units consumed by the operation.
*
*/
private Double writeCapacityUnits;
/**
*
* The amount of throughput consumed on the table affected by the operation.
*
*/
private Capacity table;
/**
*
* The amount of throughput consumed on each local index affected by the operation.
*
*/
private java.util.Map localSecondaryIndexes;
/**
*
* The amount of throughput consumed on each global index affected by the operation.
*
*/
private java.util.Map globalSecondaryIndexes;
/**
*
* The name of the table that was affected by the operation.
*
*
* @param tableName
* The name of the table that was affected by the operation.
*/
public void setTableName(String tableName) {
this.tableName = tableName;
}
/**
*
* The name of the table that was affected by the operation.
*
*
* @return The name of the table that was affected by the operation.
*/
public String getTableName() {
return this.tableName;
}
/**
*
* The name of the table that was affected by the operation.
*
*
* @param tableName
* The name of the table that was affected by the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ConsumedCapacity withTableName(String tableName) {
setTableName(tableName);
return this;
}
/**
*
* The total number of capacity units consumed by the operation.
*
*
* @param capacityUnits
* The total number of capacity units consumed by the operation.
*/
public void setCapacityUnits(Double capacityUnits) {
this.capacityUnits = capacityUnits;
}
/**
*
* The total number of capacity units consumed by the operation.
*
*
* @return The total number of capacity units consumed by the operation.
*/
public Double getCapacityUnits() {
return this.capacityUnits;
}
/**
*
* The total number of capacity units consumed by the operation.
*
*
* @param capacityUnits
* The total number of capacity units consumed by the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ConsumedCapacity withCapacityUnits(Double capacityUnits) {
setCapacityUnits(capacityUnits);
return this;
}
/**
*
* The total number of read capacity units consumed by the operation.
*
*
* @param readCapacityUnits
* The total number of read capacity units consumed by the operation.
*/
public void setReadCapacityUnits(Double readCapacityUnits) {
this.readCapacityUnits = readCapacityUnits;
}
/**
*
* The total number of read capacity units consumed by the operation.
*
*
* @return The total number of read capacity units consumed by the operation.
*/
public Double getReadCapacityUnits() {
return this.readCapacityUnits;
}
/**
*
* The total number of read capacity units consumed by the operation.
*
*
* @param readCapacityUnits
* The total number of read capacity units consumed by the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ConsumedCapacity withReadCapacityUnits(Double readCapacityUnits) {
setReadCapacityUnits(readCapacityUnits);
return this;
}
/**
*
* The total number of write capacity units consumed by the operation.
*
*
* @param writeCapacityUnits
* The total number of write capacity units consumed by the operation.
*/
public void setWriteCapacityUnits(Double writeCapacityUnits) {
this.writeCapacityUnits = writeCapacityUnits;
}
/**
*
* The total number of write capacity units consumed by the operation.
*
*
* @return The total number of write capacity units consumed by the operation.
*/
public Double getWriteCapacityUnits() {
return this.writeCapacityUnits;
}
/**
*
* The total number of write capacity units consumed by the operation.
*
*
* @param writeCapacityUnits
* The total number of write capacity units consumed by the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ConsumedCapacity withWriteCapacityUnits(Double writeCapacityUnits) {
setWriteCapacityUnits(writeCapacityUnits);
return this;
}
/**
*
* The amount of throughput consumed on the table affected by the operation.
*
*
* @param table
* The amount of throughput consumed on the table affected by the operation.
*/
public void setTable(Capacity table) {
this.table = table;
}
/**
*
* The amount of throughput consumed on the table affected by the operation.
*
*
* @return The amount of throughput consumed on the table affected by the operation.
*/
public Capacity getTable() {
return this.table;
}
/**
*
* The amount of throughput consumed on the table affected by the operation.
*
*
* @param table
* The amount of throughput consumed on the table affected by the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ConsumedCapacity withTable(Capacity table) {
setTable(table);
return this;
}
/**
*
* The amount of throughput consumed on each local index affected by the operation.
*
*
* @return The amount of throughput consumed on each local index affected by the operation.
*/
public java.util.Map getLocalSecondaryIndexes() {
return localSecondaryIndexes;
}
/**
*
* The amount of throughput consumed on each local index affected by the operation.
*
*
* @param localSecondaryIndexes
* The amount of throughput consumed on each local index affected by the operation.
*/
public void setLocalSecondaryIndexes(java.util.Map localSecondaryIndexes) {
this.localSecondaryIndexes = localSecondaryIndexes;
}
/**
*
* The amount of throughput consumed on each local index affected by the operation.
*
*
* @param localSecondaryIndexes
* The amount of throughput consumed on each local index affected by the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ConsumedCapacity withLocalSecondaryIndexes(java.util.Map localSecondaryIndexes) {
setLocalSecondaryIndexes(localSecondaryIndexes);
return this;
}
/**
* Add a single LocalSecondaryIndexes entry
*
* @see ConsumedCapacity#withLocalSecondaryIndexes
* @returns a reference to this object so that method calls can be chained together.
*/
public ConsumedCapacity addLocalSecondaryIndexesEntry(String key, Capacity value) {
if (null == this.localSecondaryIndexes) {
this.localSecondaryIndexes = new java.util.HashMap();
}
if (this.localSecondaryIndexes.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.localSecondaryIndexes.put(key, value);
return this;
}
/**
* Removes all the entries added into LocalSecondaryIndexes.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ConsumedCapacity clearLocalSecondaryIndexesEntries() {
this.localSecondaryIndexes = null;
return this;
}
/**
*
* The amount of throughput consumed on each global index affected by the operation.
*
*
* @return The amount of throughput consumed on each global index affected by the operation.
*/
public java.util.Map getGlobalSecondaryIndexes() {
return globalSecondaryIndexes;
}
/**
*
* The amount of throughput consumed on each global index affected by the operation.
*
*
* @param globalSecondaryIndexes
* The amount of throughput consumed on each global index affected by the operation.
*/
public void setGlobalSecondaryIndexes(java.util.Map globalSecondaryIndexes) {
this.globalSecondaryIndexes = globalSecondaryIndexes;
}
/**
*
* The amount of throughput consumed on each global index affected by the operation.
*
*
* @param globalSecondaryIndexes
* The amount of throughput consumed on each global index affected by the operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ConsumedCapacity withGlobalSecondaryIndexes(java.util.Map globalSecondaryIndexes) {
setGlobalSecondaryIndexes(globalSecondaryIndexes);
return this;
}
/**
* Add a single GlobalSecondaryIndexes entry
*
* @see ConsumedCapacity#withGlobalSecondaryIndexes
* @returns a reference to this object so that method calls can be chained together.
*/
public ConsumedCapacity addGlobalSecondaryIndexesEntry(String key, Capacity value) {
if (null == this.globalSecondaryIndexes) {
this.globalSecondaryIndexes = new java.util.HashMap();
}
if (this.globalSecondaryIndexes.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.globalSecondaryIndexes.put(key, value);
return this;
}
/**
* Removes all the entries added into GlobalSecondaryIndexes.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ConsumedCapacity clearGlobalSecondaryIndexesEntries() {
this.globalSecondaryIndexes = null;
return this;
}
/**
* 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.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getTableName() != null)
sb.append("TableName: ").append(getTableName()).append(",");
if (getCapacityUnits() != null)
sb.append("CapacityUnits: ").append(getCapacityUnits()).append(",");
if (getReadCapacityUnits() != null)
sb.append("ReadCapacityUnits: ").append(getReadCapacityUnits()).append(",");
if (getWriteCapacityUnits() != null)
sb.append("WriteCapacityUnits: ").append(getWriteCapacityUnits()).append(",");
if (getTable() != null)
sb.append("Table: ").append(getTable()).append(",");
if (getLocalSecondaryIndexes() != null)
sb.append("LocalSecondaryIndexes: ").append(getLocalSecondaryIndexes()).append(",");
if (getGlobalSecondaryIndexes() != null)
sb.append("GlobalSecondaryIndexes: ").append(getGlobalSecondaryIndexes());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ConsumedCapacity == false)
return false;
ConsumedCapacity other = (ConsumedCapacity) obj;
if (other.getTableName() == null ^ this.getTableName() == null)
return false;
if (other.getTableName() != null && other.getTableName().equals(this.getTableName()) == false)
return false;
if (other.getCapacityUnits() == null ^ this.getCapacityUnits() == null)
return false;
if (other.getCapacityUnits() != null && other.getCapacityUnits().equals(this.getCapacityUnits()) == false)
return false;
if (other.getReadCapacityUnits() == null ^ this.getReadCapacityUnits() == null)
return false;
if (other.getReadCapacityUnits() != null && other.getReadCapacityUnits().equals(this.getReadCapacityUnits()) == false)
return false;
if (other.getWriteCapacityUnits() == null ^ this.getWriteCapacityUnits() == null)
return false;
if (other.getWriteCapacityUnits() != null && other.getWriteCapacityUnits().equals(this.getWriteCapacityUnits()) == false)
return false;
if (other.getTable() == null ^ this.getTable() == null)
return false;
if (other.getTable() != null && other.getTable().equals(this.getTable()) == false)
return false;
if (other.getLocalSecondaryIndexes() == null ^ this.getLocalSecondaryIndexes() == null)
return false;
if (other.getLocalSecondaryIndexes() != null && other.getLocalSecondaryIndexes().equals(this.getLocalSecondaryIndexes()) == false)
return false;
if (other.getGlobalSecondaryIndexes() == null ^ this.getGlobalSecondaryIndexes() == null)
return false;
if (other.getGlobalSecondaryIndexes() != null && other.getGlobalSecondaryIndexes().equals(this.getGlobalSecondaryIndexes()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getTableName() == null) ? 0 : getTableName().hashCode());
hashCode = prime * hashCode + ((getCapacityUnits() == null) ? 0 : getCapacityUnits().hashCode());
hashCode = prime * hashCode + ((getReadCapacityUnits() == null) ? 0 : getReadCapacityUnits().hashCode());
hashCode = prime * hashCode + ((getWriteCapacityUnits() == null) ? 0 : getWriteCapacityUnits().hashCode());
hashCode = prime * hashCode + ((getTable() == null) ? 0 : getTable().hashCode());
hashCode = prime * hashCode + ((getLocalSecondaryIndexes() == null) ? 0 : getLocalSecondaryIndexes().hashCode());
hashCode = prime * hashCode + ((getGlobalSecondaryIndexes() == null) ? 0 : getGlobalSecondaryIndexes().hashCode());
return hashCode;
}
@Override
public ConsumedCapacity clone() {
try {
return (ConsumedCapacity) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.dynamodbv2.model.transform.ConsumedCapacityMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}