.attributeDefinitions(AttributeDefinition.builder() .attributeName("Name") .attributeType(ScalarAttributeType.S)
.attributeDefinitions( AttributeDefinition.builder() .attributeName("Language")
.keySchema(keySchema) .provisionedThroughput(createDynamoDBTableOptions.getProvisionedThroughput()) .attributeDefinitions(attributeDefinitions) .build();
.writeCapacityUnits(writeCapacity).build(); CreateTableRequest request = CreateTableRequest.builder().tableName(table).keySchema(serializer.getKeySchema()) .attributeDefinitions(serializer.getAttributeDefinitions()).provisionedThroughput(throughput).build();
.writeCapacityUnits(writeCapacity).build(); CreateTableRequest request = CreateTableRequest.builder().tableName(table).keySchema(serializer.getKeySchema()) .attributeDefinitions(serializer.getAttributeDefinitions()).provisionedThroughput(throughput).build();
/** * Creates an orders table in DynamoDB. */ public void createOrdersTable() { try { dynamoDb.createTable(CreateTableRequest.builder() .tableName(tableName) .provisionedThroughput(ProvisionedThroughput.builder() .readCapacityUnits(5L) .writeCapacityUnits(5L) .build()) .keySchema(KeySchemaElement.builder() .attributeName(ORDER_ID) .keyType(KeyType.HASH) .build()) .attributeDefinitions(AttributeDefinition.builder() .attributeName(ORDER_ID) .attributeType(ScalarAttributeType.S) .build()) .build()); } catch (ResourceInUseException e) { throw new TableExistsException("Orders table already exists"); } }