in src/main/java/com/amazonaws/kinesisvideo/parser/utilities/DynamoDBHelper.java [76:104]
public void createTableIfDoesntExist() {
// Check if table exists
if (!checkIfTableExists()) {
log.info("Creating table : {}", TABLE_NAME);
final CreateTableRequest request = new CreateTableRequest() {{
setAttributeDefinitions(
Collections.singletonList(
new AttributeDefinition(
KVS_STREAM_NAME,
ScalarAttributeType.S)));
setKeySchema(
Collections.singletonList(
new KeySchemaElement(
KVS_STREAM_NAME,
KeyType.HASH)));
setProvisionedThroughput(
new ProvisionedThroughput(1000L, 1000L));
setTableName(TABLE_NAME);
}};
try {
final CreateTableResult result = ddbClient.createTable(request);
log.info("Table created : {}", result.getTableDescription());
} catch (final AmazonDynamoDBException e) {
log.error("Error creating DDB table {}...", TABLE_NAME, e);
throw e;
}
}
}