當前位置: 首頁>>代碼示例>>Java>>正文


Java CreateTableRequest.withProvisionedThroughput方法代碼示例

本文整理匯總了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;
}
 
開發者ID:fineoio,項目名稱:drill-dynamo-adapter,代碼行數:17,代碼來源:BaseDynamoTest.java

示例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);
}
 
開發者ID:nfscan,項目名稱:nfscan,代碼行數:19,代碼來源:BaseDatabaseControllerTest.java


注:本文中的com.amazonaws.services.dynamodbv2.model.CreateTableRequest.withProvisionedThroughput方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。