Search in sources :

Example 1 with UpdateTableRequest

use of software.amazon.awssdk.services.dynamodb.model.UpdateTableRequest in project aws-doc-sdk-examples by awsdocs.

the class UpdateTable method updateDynamoDBTable.

// snippet-start:[dynamodb.java2.update_table.main]
public static void updateDynamoDBTable(DynamoDbClient ddb, String tableName, Long readCapacity, Long writeCapacity) {
    System.out.format("Updating %s with new provisioned throughput values\n", tableName);
    System.out.format("Read capacity : %d\n", readCapacity);
    System.out.format("Write capacity : %d\n", writeCapacity);
    ProvisionedThroughput tableThroughput = ProvisionedThroughput.builder().readCapacityUnits(readCapacity).writeCapacityUnits(writeCapacity).build();
    UpdateTableRequest request = UpdateTableRequest.builder().provisionedThroughput(tableThroughput).tableName(tableName).build();
    try {
        ddb.updateTable(request);
    } catch (DynamoDbException e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
    System.out.println("Done!");
}
Also used : UpdateTableRequest(software.amazon.awssdk.services.dynamodb.model.UpdateTableRequest) DynamoDbException(software.amazon.awssdk.services.dynamodb.model.DynamoDbException) ProvisionedThroughput(software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput)

Aggregations

DynamoDbException (software.amazon.awssdk.services.dynamodb.model.DynamoDbException)1 ProvisionedThroughput (software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput)1 UpdateTableRequest (software.amazon.awssdk.services.dynamodb.model.UpdateTableRequest)1