本文整理匯總了Java中com.amazonaws.services.dynamodbv2.model.CreateTableRequest.withProvisionedThroughput方法的典型用法代碼示例。如果您正苦於以下問題:Java CreateTableRequest.withProvisionedThroughput方法的具體用法?Java CreateTableRequest.withProvisionedThroughput怎麽用?Java CreateTableRequest.withProvisionedThroughput使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.amazonaws.services.dynamodbv2.model.CreateTableRequest
的用法示例。
在下文中一共展示了CreateTableRequest.withProvisionedThroughput方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createTable
import com.amazonaws.services.dynamodbv2.model.CreateTableRequest; //導入方法依賴的package包/類
protected Table createTable(CreateTableRequest request) throws InterruptedException {
DynamoDB dynamoDB = new DynamoDB(tables.getAsyncClient());
request.withProvisionedThroughput(new ProvisionedThroughput()
.withReadCapacityUnits(5L)
.withWriteCapacityUnits(6L));
if (request.getTableName() == null) {
String tableName = tables.getTestTableName();
tableName = tableName.replace('-', '_');
request.setTableName(tableName);
}
Table table = dynamoDB.createTable(request);
table.waitForActive();
return table;
}
示例2: createTable
import com.amazonaws.services.dynamodbv2.model.CreateTableRequest; //導入方法依賴的package包/類
public void createTable(Class<? extends IDomain> domain){
CreateTableRequest tableRequest = dynamoDBMapper.generateCreateTableRequest(domain);
tableRequest = tableRequest.withProvisionedThroughput(new ProvisionedThroughput(5L,5L));
//check whether or not we need to add a provisioning throughput value for GSI
for (Method method : domain.getMethods()) {
if(method.isAnnotationPresent(DynamoDBIndexHashKey.class)){
String tempGSI = method.getAnnotation(DynamoDBIndexHashKey.class).globalSecondaryIndexName();
for (GlobalSecondaryIndex globalSecondaryIndex : tableRequest.getGlobalSecondaryIndexes()) {
if(globalSecondaryIndex.getIndexName().equals(tempGSI)){
globalSecondaryIndex.setProvisionedThroughput(new ProvisionedThroughput(5L,5L));
}
}
}
}
amazonDynamoDBClient.createTable(tableRequest);
}