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

项目: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();
}
项目:para    文件:AWSDynamoUtils.java   
/**
 * Updates the table settings (read and write capacities).
 * @param appid name of the {@link com.erudika.para.core.App}
 * @param readCapacity read capacity
 * @param writeCapacity write capacity
 * @return true if updated
 */
public static boolean updateTable(String appid, long readCapacity, long writeCapacity) {
    if (StringUtils.isBlank(appid) || StringUtils.containsWhitespace(appid)) {
        return false;
    }
    String table = getTableNameForAppid(appid);
    try {
        // AWS throws an exception if the new read/write capacity values are the same as the current ones
        getClient().updateTable(new UpdateTableRequest().withTableName(table).
                withProvisionedThroughput(new ProvisionedThroughput(readCapacity, writeCapacity)));
        return true;
    } catch (Exception e) {
        logger.error("Could not update table '{}' - table is not active or no change to capacity: {}",
                table, e.getMessage());
    }
    return false;
}
项目:Camel    文件:UpdateTableCommand.java   
@Override
public void execute() {
    ddbClient.updateTable(new UpdateTableRequest()
            .withTableName(determineTableName())
            .withProvisionedThroughput(new ProvisionedThroughput()
                    .withReadCapacityUnits(determineReadCapacity())
                    .withWriteCapacityUnits(determineWriteCapacity())));
}
项目:aws-dynamodb-examples    文件:LowLevelTableExample.java   
static void updateExampleTable() {

    ProvisionedThroughput provisionedThroughput = new ProvisionedThroughput()
    .withReadCapacityUnits(6L)
    .withWriteCapacityUnits(7L);

    UpdateTableRequest updateTableRequest = new UpdateTableRequest()
        .withTableName(tableName)
        .withProvisionedThroughput(provisionedThroughput);

    client.updateTable(updateTableRequest);
    waitForTableToBecomeAvailable(tableName);
}
项目:Camel    文件:AmazonDDBClientMock.java   
@Override
public UpdateTableResult updateTable(UpdateTableRequest updateTableRequest) {
    this.updateTableRequest = updateTableRequest;
    return null;
}