in src/main/java/com/amazonaws/services/dynamodbv2/util/TableHelper.java [93:120]
public void verifyOrCreateTable(
String tableName,
List<AttributeDefinition> definitions,
List<KeySchemaElement> keySchema,
List<LocalSecondaryIndex> localIndexes,
ProvisionedThroughput provisionedThroughput,
Long waitTimeSeconds) throws InterruptedException {
if(waitTimeSeconds != null && waitTimeSeconds < 0) {
throw new IllegalArgumentException("Invalid waitTimeSeconds " + waitTimeSeconds);
}
String status = null;
try {
status = verifyTableExists(tableName, definitions, keySchema, localIndexes);
} catch(ResourceNotFoundException e) {
status = client.createTable(new CreateTableRequest()
.withTableName(tableName)
.withAttributeDefinitions(definitions)
.withKeySchema(keySchema)
.withLocalSecondaryIndexes(localIndexes)
.withProvisionedThroughput(provisionedThroughput)).getTableDescription().getTableStatus();
}
if(waitTimeSeconds != null && ! TableStatus.ACTIVE.toString().equals(status)) {
waitForTableActive(tableName, definitions, keySchema, localIndexes, waitTimeSeconds);
}
}