@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getLastIncreaseDateTime() == null) ? 0 : getLastIncreaseDateTime().hashCode()); hashCode = prime * hashCode + ((getLastDecreaseDateTime() == null) ? 0 : getLastDecreaseDateTime().hashCode()); hashCode = prime * hashCode + ((getNumberOfDecreasesToday() == null) ? 0 : getNumberOfDecreasesToday().hashCode()); hashCode = prime * hashCode + ((getReadCapacityUnits() == null) ? 0 : getReadCapacityUnits().hashCode()); hashCode = prime * hashCode + ((getWriteCapacityUnits() == null) ? 0 : getWriteCapacityUnits().hashCode()); return hashCode; }
/** * 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 (getLastIncreaseDateTime() != null) sb.append("LastIncreaseDateTime: ").append(getLastIncreaseDateTime()).append(","); if (getLastDecreaseDateTime() != null) sb.append("LastDecreaseDateTime: ").append(getLastDecreaseDateTime()).append(","); if (getNumberOfDecreasesToday() != null) sb.append("NumberOfDecreasesToday: ").append(getNumberOfDecreasesToday()).append(","); if (getReadCapacityUnits() != null) sb.append("ReadCapacityUnits: ").append(getReadCapacityUnits()).append(","); if (getWriteCapacityUnits() != null) sb.append("WriteCapacityUnits: ").append(getWriteCapacityUnits()); sb.append("}"); return sb.toString(); }
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; return true;
/** * Marshall the given parameter object. */ public void marshall(ProvisionedThroughputDescription provisionedThroughputDescription, ProtocolMarshaller protocolMarshaller) { if (provisionedThroughputDescription == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(provisionedThroughputDescription.getLastIncreaseDateTime(), LASTINCREASEDATETIME_BINDING); protocolMarshaller.marshall(provisionedThroughputDescription.getLastDecreaseDateTime(), LASTDECREASEDATETIME_BINDING); protocolMarshaller.marshall(provisionedThroughputDescription.getNumberOfDecreasesToday(), NUMBEROFDECREASESTODAY_BINDING); protocolMarshaller.marshall(provisionedThroughputDescription.getReadCapacityUnits(), READCAPACITYUNITS_BINDING); protocolMarshaller.marshall(provisionedThroughputDescription.getWriteCapacityUnits(), WRITECAPACITYUNITS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getLastIncreaseDateTime() != null) sb.append("LastIncreaseDateTime: " + getLastIncreaseDateTime() + ","); if (getLastDecreaseDateTime() != null) sb.append("LastDecreaseDateTime: " + getLastDecreaseDateTime() + ","); if (getNumberOfDecreasesToday() != null) sb.append("NumberOfDecreasesToday: " + getNumberOfDecreasesToday() + ","); if (getReadCapacityUnits() != null) sb.append("ReadCapacityUnits: " + getReadCapacityUnits() + ","); if (getWriteCapacityUnits() != null) sb.append("WriteCapacityUnits: " + getWriteCapacityUnits()); sb.append("}"); return sb.toString(); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getLastIncreaseDateTime() == null) ? 0 : getLastIncreaseDateTime().hashCode()); hashCode = prime * hashCode + ((getLastDecreaseDateTime() == null) ? 0 : getLastDecreaseDateTime().hashCode()); hashCode = prime * hashCode + ((getNumberOfDecreasesToday() == null) ? 0 : getNumberOfDecreasesToday() .hashCode()); hashCode = prime * hashCode + ((getReadCapacityUnits() == null) ? 0 : getReadCapacityUnits().hashCode()); hashCode = prime * hashCode + ((getWriteCapacityUnits() == null) ? 0 : getWriteCapacityUnits().hashCode()); return hashCode; }
&& 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; return true;
jsonWriter.value(readCapacityUnits); if (provisionedThroughputDescription.getWriteCapacityUnits() != null) { Long writeCapacityUnits = provisionedThroughputDescription.getWriteCapacityUnits(); jsonWriter.name("WriteCapacityUnits"); jsonWriter.value(writeCapacityUnits);
private double getThroughput() { ProvisionedThroughputDescription provisionedThroughput = dynamoDBClient .describeTable(tableName) .getProvisionedThroughput(); return provisionedThroughput.getWriteCapacityUnits(); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getLastIncreaseDateTime() == null) ? 0 : getLastIncreaseDateTime().hashCode()); hashCode = prime * hashCode + ((getLastDecreaseDateTime() == null) ? 0 : getLastDecreaseDateTime().hashCode()); hashCode = prime * hashCode + ((getNumberOfDecreasesToday() == null) ? 0 : getNumberOfDecreasesToday().hashCode()); hashCode = prime * hashCode + ((getReadCapacityUnits() == null) ? 0 : getReadCapacityUnits().hashCode()); hashCode = prime * hashCode + ((getWriteCapacityUnits() == null) ? 0 : getWriteCapacityUnits().hashCode()); return hashCode; }
/** * 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 (getLastIncreaseDateTime() != null) sb.append("LastIncreaseDateTime: ").append(getLastIncreaseDateTime()).append(","); if (getLastDecreaseDateTime() != null) sb.append("LastDecreaseDateTime: ").append(getLastDecreaseDateTime()).append(","); if (getNumberOfDecreasesToday() != null) sb.append("NumberOfDecreasesToday: ").append(getNumberOfDecreasesToday()).append(","); if (getReadCapacityUnits() != null) sb.append("ReadCapacityUnits: ").append(getReadCapacityUnits()).append(","); if (getWriteCapacityUnits() != null) sb.append("WriteCapacityUnits: ").append(getWriteCapacityUnits()); sb.append("}"); return sb.toString(); }
private long getProvisionedWrites() { return dynamoClient.describeTable(this.tableName).getTable().getProvisionedThroughput().getWriteCapacityUnits(); }
/** * returns the provisioned throughput based on the input ratio and the * specified DynamoDB table provisioned throughput. */ private static double calculateThroughput( TableDescription tableDescription, double throughputRatio, boolean read) { if (read) { return tableDescription.getProvisionedThroughput() .getReadCapacityUnits() * throughputRatio; } return tableDescription.getProvisionedThroughput() .getWriteCapacityUnits() * throughputRatio; }
private double getThroughput() { TableDescription tableDescription = dynamoDBClient.describeTable(tableName); if (tableDescription.getBillingModeSummary() != null && tableDescription.getBillingModeSummary() .getBillingMode().equalsIgnoreCase(DynamoDBConstants.BILLING_MODE_PROVISIONED)) { ProvisionedThroughputDescription provisionedThroughput = tableDescription.getProvisionedThroughput(); return provisionedThroughput.getWriteCapacityUnits(); } return DynamoDBConstants.DEFAULT_CAPACITY_FOR_ON_DEMAND; }
private static boolean areGsisSameConfiguration(final GlobalSecondaryIndexDescription g1, final GlobalSecondaryIndexDescription g2) { if (g1 == null ^ g2 == null) { return false; } if (g1 == g2) { return true; } final EqualsBuilder builder = new EqualsBuilder(); builder.append(g1.getIndexName(), g2.getIndexName()); builder.append(g1.getKeySchema(), g2.getKeySchema()); builder.append(g1.getProjection().getProjectionType(), g2.getProjection().getProjectionType()); builder.append(g1.getProvisionedThroughput().getReadCapacityUnits(), g2.getProvisionedThroughput().getReadCapacityUnits()); builder.append(g1.getProvisionedThroughput().getWriteCapacityUnits(), g2.getProvisionedThroughput().getWriteCapacityUnits()); final Set<String> projectionNonKeyAttributesG1 = new HashSet<>(Optional.ofNullable(g1.getProjection().getNonKeyAttributes()).orElse(Collections.emptyList())); final Set<String> projectionNonKeyAttributesG2 = new HashSet<>(Optional.ofNullable(g2.getProjection().getNonKeyAttributes()).orElse(Collections.emptyList())); builder.append(projectionNonKeyAttributesG1, projectionNonKeyAttributesG2); return builder.build(); }
@Override @Retries.OnceRaw public void updateParameters(Map<String, String> parameters) throws IOException { Preconditions.checkNotNull(table, "Not initialized"); TableDescription desc = getTableDescription(true); ProvisionedThroughputDescription current = desc.getProvisionedThroughput(); long currentRead = current.getReadCapacityUnits(); long newRead = getLongParam(parameters, S3GUARD_DDB_TABLE_CAPACITY_READ_KEY, currentRead); long currentWrite = current.getWriteCapacityUnits(); long newWrite = getLongParam(parameters, S3GUARD_DDB_TABLE_CAPACITY_WRITE_KEY, currentWrite); if (newRead != currentRead || newWrite != currentWrite) { LOG.info("Current table capacity is read: {}, write: {}", currentRead, currentWrite); LOG.info("Changing capacity of table to read: {}, write: {}", newRead, newWrite); provisionTableBlocking(newRead, newWrite); } else { LOG.info("Table capacity unchanged at read: {}, write: {}", newRead, newWrite); } }
static void getTableInformation() { System.out.println("Describing " + tableName); TableDescription tableDescription = dynamoDB.getTable(tableName).describe(); System.out.format("Name: %s:\n" + "Status: %s \n" + "Provisioned Throughput (read capacity units/sec): %d \n" + "Provisioned Throughput (write capacity units/sec): %d \n", tableDescription.getTableName(), tableDescription.getTableStatus(), tableDescription.getProvisionedThroughput().getReadCapacityUnits(), tableDescription.getProvisionedThroughput().getWriteCapacityUnits()); }
/** * Marshall the given parameter object. */ public void marshall(ProvisionedThroughputDescription provisionedThroughputDescription, ProtocolMarshaller protocolMarshaller) { if (provisionedThroughputDescription == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(provisionedThroughputDescription.getLastIncreaseDateTime(), LASTINCREASEDATETIME_BINDING); protocolMarshaller.marshall(provisionedThroughputDescription.getLastDecreaseDateTime(), LASTDECREASEDATETIME_BINDING); protocolMarshaller.marshall(provisionedThroughputDescription.getNumberOfDecreasesToday(), NUMBEROFDECREASESTODAY_BINDING); protocolMarshaller.marshall(provisionedThroughputDescription.getReadCapacityUnits(), READCAPACITYUNITS_BINDING); protocolMarshaller.marshall(provisionedThroughputDescription.getWriteCapacityUnits(), WRITECAPACITYUNITS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } }
static void getTableInformation() { TableDescription tableDescription = client.describeTable( new DescribeTableRequest().withTableName(tableName)).getTable(); System.out.format("Name: %s:\n" + "Status: %s \n" + "Provisioned Throughput (read capacity units/sec): %d \n" + "Provisioned Throughput (write capacity units/sec): %d \n", tableDescription.getTableName(), tableDescription.getTableStatus(), tableDescription.getProvisionedThroughput().getReadCapacityUnits(), tableDescription.getProvisionedThroughput().getWriteCapacityUnits()); }
public DynamoGSI(GlobalSecondaryIndexDescription desc) { gsiName = desc.getIndexName(); readCapacityUnits = desc.getProvisionedThroughput().getReadCapacityUnits(); writeCapacityUnits = desc.getProvisionedThroughput().getWriteCapacityUnits(); itemCount = desc.getItemCount(); indexSizeBytes = desc.getIndexSizeBytes(); indexStatus = desc.getIndexStatus(); backfilling = desc.getBackfilling(); indexArn = desc.getIndexArn(); } }