@ SneakyThrows public void createServicesTable ( final boolean deleteTables ) { LOGGER . debug ( "Attempting to create DynamoDb services table" ) ; val request = new CreateTableRequest ( ) . withAttributeDefinitions ( new AttributeDefinition ( ColumnNames . ID . getColumnName ( ) , ScalarAttributeType . S ) ) . withKeySchema ( new KeySchemaElement ( ColumnNames . ID . getColumnName ( ) , KeyType . HASH ) ) . withProvisionedThroughput ( new ProvisionedThroughput ( dynamoDbProperties . getReadCapacity ( ) , dynamoDbProperties . getWriteCapacity ( ) ) ) . withTableName ( dynamoDbProperties . getTableName ( ) ) ; if ( deleteTables ) { val delete = new DeleteTableRequest ( request . getTableName ( ) ) ; LOGGER . debug ( "Sending delete request [{}] to remove table if necessary" , delete ) ; TableUtils . deleteTableIfExists ( amazonDynamoDBClient , delete ) ; } LOGGER . debug ( "Sending delete request [{}] to create table" , request ) ; TableUtils . createTableIfNotExists ( amazonDynamoDBClient , request ) ; LOGGER . debug ( "Waiting until table [{}] becomes active..." , request . getTableName ( ) ) ; TableUtils . waitUntilActive ( amazonDynamoDBClient , request . getTableName ( ) ) ; val describeTableRequest = new DescribeTableRequest ( ) . withTableName ( request . getTableName ( ) ) ; LOGGER . debug ( "Sending request [{}] to obtain table description..." , describeTableRequest ) ; val tableDescription = amazonDynamoDBClient . describeTable ( describeTableRequest ) . getTable ( ) ; LOGGER . debug ( "Located newly created table with description: [{}]" , tableDescription ) ; }
Create tables .