public static TableDescription createTable(final DynamoDbClient dynamoDbClient,
                                               final AbstractDynamoDbProperties dynamoDbProperties,
                                               final String tableName,
                                               final boolean deleteTable,
                                               final List<AttributeDefinition> attributeDefinitions,
                                               final List<KeySchemaElement> keySchemaElements) throws Exception {

        val billingMode = BillingMode.fromValue(dynamoDbProperties.getBillingMode().name());
        val provisionedThroughput = billingMode == BillingMode.PROVISIONED
            ? ProvisionedThroughput.builder()
                .readCapacityUnits(dynamoDbProperties.getReadCapacity())
                .writeCapacityUnits(dynamoDbProperties.getWriteCapacity())
                .build()
            : null;
        val request = CreateTableRequest.builder()
            .attributeDefinitions(attributeDefinitions)
            .keySchema(keySchemaElements)
            .provisionedThroughput(provisionedThroughput)
            .tableName(tableName)
            .billingMode(billingMode)
            .build();

        if (deleteTable) {
            val delete = DeleteTableRequest.builder().tableName(tableName).build();
            LOGGER.debug("Sending delete request [{}] to remove table if necessary", delete);
            deleteTableIfExists(dynamoDbClient, delete);
        }
        LOGGER.debug("Sending create request [{}] to create table", request);
        createTableIfNotExists(dynamoDbClient, request);
        LOGGER.debug("Waiting until table [{}] becomes active...", request.tableName());
        waitUntilActive(dynamoDbClient, request.tableName());
        val describeTableRequest = DescribeTableRequest.builder().tableName(request.tableName()).build();
        LOGGER.debug("Sending request [{}] to obtain table description...", describeTableRequest);
        val tableDescription = dynamoDbClient.describeTable(describeTableRequest).table();
        LOGGER.debug("Located newly created table with description: [{}]", tableDescription);
        return tableDescription;
    }
Create table.

@param dynamoDbClient       the dynamo db client
@param dynamoDbProperties   the dynamo db properties
@param tableName            the table name
@param deleteTable          the delete tables
@param attributeDefinitions the attribute definitions
@param keySchemaElements    the key schema elements
@return the table description
@throws Exception the exception
support/cas-server-support-dynamodb-core/src/main/java/org/apereo/cas/dynamodb/DynamoDbTableUtils.java