Example usage for com.amazonaws.services.dynamodbv2.model AttributeDefinition AttributeDefinition

List of usage examples for com.amazonaws.services.dynamodbv2.model AttributeDefinition AttributeDefinition

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.model AttributeDefinition AttributeDefinition.

Prototype

public AttributeDefinition(String attributeName, ScalarAttributeType attributeType) 

Source Link

Document

Constructs a new AttributeDefinition object.

Usage

From source file:org.wildfly.camel.test.common.aws.DynamoDBUtils.java

License:Apache License

public static TableDescription createTable(AmazonDynamoDB client, String tableName)
        throws InterruptedException {
    CreateTableRequest tableReq = new CreateTableRequest().withTableName(tableName)
            .withKeySchema(new KeySchemaElement("Id", KeyType.HASH))
            .withAttributeDefinitions(new AttributeDefinition("Id", ScalarAttributeType.N))
            .withProvisionedThroughput(new ProvisionedThroughput(10L, 10L))
            .withStreamSpecification(new StreamSpecification().withStreamEnabled(true)
                    .withStreamViewType(StreamViewType.NEW_AND_OLD_IMAGES));

    DynamoDB dynamoDB = new DynamoDB(client);
    Table table = dynamoDB.createTable(tableReq);
    return table.waitForActive();
}