Java 类com.amazonaws.services.dynamodbv2.model.UpdateTableResult 实例源码

项目:dynamodb-streams-kafka    文件:KafkaDynamoStreamAdapter.java   
private String enableStreamForTable(AmazonDynamoDBClient client, StreamViewType viewType, String tableName) {
    DescribeTableRequest describeTableRequest = new DescribeTableRequest()
        .withTableName(tableName);
    DescribeTableResult describeResult = client.describeTable(describeTableRequest);
    if (describeResult.getTable().getStreamSpecification().isStreamEnabled()) {
        //TODO: what if the viewtype doesn't match
        return describeResult.getTable().getLatestStreamId();
    }

    StreamSpecification streamSpecification = new StreamSpecification();
    streamSpecification.setStreamEnabled(true);
    streamSpecification.setStreamViewType(viewType);
    UpdateTableRequest updateTableRequest = new UpdateTableRequest()
        .withTableName(tableName)
        .withStreamSpecification(streamSpecification);

    UpdateTableResult result = client.updateTable(updateTableRequest);
    return result.getTableDescription().getLatestStreamId();
}
项目:dynamodb-streams-kafka    文件:StreamAdapterDemoHelper.java   
public static String enableStreamForTable(AmazonDynamoDBClient client, StreamViewType viewType, String tableName) {
    DescribeTableRequest describeTableRequest = new DescribeTableRequest()
        .withTableName(tableName);
    DescribeTableResult describeResult = client.describeTable(describeTableRequest);
    if (describeResult.getTable().getStreamSpecification().isStreamEnabled()) {
        //TODO: what if the viewtype doesn't match
        return describeResult.getTable().getLatestStreamId();
    }

    StreamSpecification streamSpecification = new StreamSpecification();
    streamSpecification.setStreamEnabled(true);
    streamSpecification.setStreamViewType(viewType);
    UpdateTableRequest updateTableRequest = new UpdateTableRequest()
        .withTableName(tableName)
        .withStreamSpecification(streamSpecification);

    UpdateTableResult result = client.updateTable(updateTableRequest);
    return result.getTableDescription().getLatestStreamId();
}
项目:aws-java-sdk-stubs    文件:AmazonDynamoDBStubTest.java   
@Test
public void test_updateTable() throws Exception {
  createTable();

  DescribeTableResult describeResult = dynamoDb.describeTable(TEST_TABLE_NAME);
  Long readUnits = describeResult.getTable().getProvisionedThroughput().getReadCapacityUnits();

  assertThat(readUnits, equalTo(UNITS));

  UpdateTableResult updateResult = dynamoDb.updateTable(TEST_TABLE_NAME, new ProvisionedThroughput()
    .withReadCapacityUnits(new Long(200))
    .withWriteCapacityUnits(new Long(200)));
  String tableName = updateResult.getTableDescription().getTableName();

  assertThat(tableName, equalTo(TEST_TABLE_NAME));

  ListTablesResult listResult = listTables();

  describeResult = dynamoDb.describeTable(TEST_TABLE_NAME);
  readUnits = describeResult.getTable().getProvisionedThroughput().getReadCapacityUnits();

  assertThat(readUnits, equalTo(new Long(200)));
}
项目:Camel    文件:AmazonDDBClientMock.java   
@Override
public UpdateTableResult updateTable(UpdateTableRequest updateTableRequest) {
    this.updateTableRequest = updateTableRequest;
    return null;
}