Class DynamoDB
- java.lang.Object
-
- com.amazonaws.services.dynamodbv2.document.DynamoDB
-
- All Implemented Interfaces:
BatchGetItemApi
,BatchWriteItemApi
,ListTablesApi
public class DynamoDB extends Object implements ListTablesApi, BatchGetItemApi, BatchWriteItemApi
DynamoDB Document API. This class is the entry point to make use of this library.
-
-
Constructor Summary
Constructors Constructor Description DynamoDB(Regions regionEnum)
Create a DynamoDB object that talks to the specified AWS region.DynamoDB(AmazonDynamoDB client)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BatchGetItemOutcome
batchGetItem(BatchGetItemSpec spec)
Used to perform a batch get-item operation from DynamoDB with full parameter specification.BatchGetItemOutcome
batchGetItem(TableKeysAndAttributes... tableKeysAndAttributes)
Used to perform a batch get-item operation from DynamoDB.BatchGetItemOutcome
batchGetItem(ReturnConsumedCapacity returnConsumedCapacity, TableKeysAndAttributes... tableKeysAndAttributes)
Used to perform a batch get-item operation from DynamoDB.BatchGetItemOutcome
batchGetItemUnprocessed(ReturnConsumedCapacity returnConsumedCapacity, Map<String,KeysAndAttributes> unprocessedKeys)
Used to perform a batch get-item for the unprocessed keys returned from a previous batch get-item operation.BatchGetItemOutcome
batchGetItemUnprocessed(Map<String,KeysAndAttributes> unprocessedKeys)
Used to perform a batch get-item for the unprocessed keys returned from a previous batch get-item operation.BatchWriteItemOutcome
batchWriteItem(BatchWriteItemSpec spec)
Used to perform a batch write operation to DynamoDB with full parameter specification.BatchWriteItemOutcome
batchWriteItem(TableWriteItems... tableWriteItems)
Used to perform a batch write operation to DynamoDB.BatchWriteItemOutcome
batchWriteItemUnprocessed(Map<String,List<WriteRequest>> unprocessedItems)
Used to perform a batch write operation for the unprocessed items returned from a previous batch write operation.Table
createTable(CreateTableRequest req)
Creates the specified table in DynamoDB.Table
createTable(String tableName, List<KeySchemaElement> keySchema, List<AttributeDefinition> attributeDefinitions, ProvisionedThroughput provisionedThroughput)
Creates the specified table in DynamoDB.Table
getTable(String tableName)
Returns the specified DynamoDB table.TableCollection<ListTablesResult>
listTables()
Returns a collection of all the tables (initialized with the respective table names) associated with the current account and endpoint.TableCollection<ListTablesResult>
listTables(int maxResultSize)
Returns a collection of tables (initialized with the respective table names) up to the specifiedmaxResultSize
associated with the current account and endpoint.TableCollection<ListTablesResult>
listTables(ListTablesSpec spec)
List tables by specifying all the details.TableCollection<ListTablesResult>
listTables(String exclusiveStartTableName)
Returns a collection of tables (initialized with the respective table names) associated with the current account and endpoint, starting with a name after the specifiedexclusiveStartTableName
.TableCollection<ListTablesResult>
listTables(String exclusiveStartTableName, int maxResultSize)
Returns a collection of tables (initialized with the respective table names) up to the specifiedmaxResultSize
associated with the current account and endpoint, starting with a name after the specifiedexclusiveStartTableName
.void
shutdown()
Shuts down and release all resources.
-
-
-
Constructor Detail
-
DynamoDB
public DynamoDB(AmazonDynamoDB client)
-
DynamoDB
public DynamoDB(Regions regionEnum)
Create a DynamoDB object that talks to the specified AWS region. The underlying service client will use all the default client configurations, including the default credentials provider chain. SeeAmazonDynamoDBClient()
for more information.If you need more control over the client configuration, use
DynamoDB(AmazonDynamoDB)
instead.- Parameters:
regionEnum
- the AWS region enum- See Also:
AmazonDynamoDBClient()
-
-
Method Detail
-
getTable
public Table getTable(String tableName)
Returns the specified DynamoDB table. No network call is involved.
-
createTable
public Table createTable(CreateTableRequest req)
Creates the specified table in DynamoDB.
-
createTable
public Table createTable(String tableName, List<KeySchemaElement> keySchema, List<AttributeDefinition> attributeDefinitions, ProvisionedThroughput provisionedThroughput)
Creates the specified table in DynamoDB.
-
listTables
public TableCollection<ListTablesResult> listTables()
Description copied from interface:ListTablesApi
Returns a collection of all the tables (initialized with the respective table names) associated with the current account and endpoint. The underlying collection is paginated with a page size of 100. A network call is made whenever the collection is iterated across a page boundary.- Specified by:
listTables
in interfaceListTablesApi
-
listTables
public TableCollection<ListTablesResult> listTables(String exclusiveStartTableName)
Description copied from interface:ListTablesApi
Returns a collection of tables (initialized with the respective table names) associated with the current account and endpoint, starting with a name after the specifiedexclusiveStartTableName
. The underlying collection is paginated with a page size of 100. A network call is made whenever the collection is iterated across a page boundary.- Specified by:
listTables
in interfaceListTablesApi
- Parameters:
exclusiveStartTableName
- The first table name that this operation will evaluate, exclusive of the specifiedexclusiveStartTableName
. Use the value that was returned for LastEvaluatedTableName in a previous operation, so that you can obtain the next page of results.
-
listTables
public TableCollection<ListTablesResult> listTables(String exclusiveStartTableName, int maxResultSize)
Description copied from interface:ListTablesApi
Returns a collection of tables (initialized with the respective table names) up to the specifiedmaxResultSize
associated with the current account and endpoint, starting with a name after the specifiedexclusiveStartTableName
. The underlying collection is paginated with a page size of 100. A network call is made whenever the collection is iterated across a page boundary.- Specified by:
listTables
in interfaceListTablesApi
- Parameters:
exclusiveStartTableName
- The first table name that this operation will evaluate exclusive of the specifiedexclusiveStartTableName
. Use the value that was returned for LastEvaluatedTableName in a previous operation, so that you can obtain the next page of results.maxResultSize
- A maximum number of table names to return.
-
listTables
public TableCollection<ListTablesResult> listTables(int maxResultSize)
Description copied from interface:ListTablesApi
Returns a collection of tables (initialized with the respective table names) up to the specifiedmaxResultSize
associated with the current account and endpoint. The underlying collection is paginated with a page size of 100. A network call is made whenever the collection is iterated across a page boundary.- Specified by:
listTables
in interfaceListTablesApi
- Parameters:
maxResultSize
- A maximum number of table names to return.
-
listTables
public TableCollection<ListTablesResult> listTables(ListTablesSpec spec)
Description copied from interface:ListTablesApi
List tables by specifying all the details. The underlying collection is paginated with the specified page size (which defaults to 100). A network call is made whenever the collection is iterated across a page boundary.- Specified by:
listTables
in interfaceListTablesApi
- Parameters:
spec
- can be used to specify all the detailed parameters of listing tables.- Returns:
- a collection of tables associated with the current account and endpoint.
-
batchGetItem
public BatchGetItemOutcome batchGetItem(ReturnConsumedCapacity returnConsumedCapacity, TableKeysAndAttributes... tableKeysAndAttributes)
Description copied from interface:BatchGetItemApi
Used to perform a batch get-item operation from DynamoDB.- Specified by:
batchGetItem
in interfaceBatchGetItemApi
- Parameters:
returnConsumedCapacity
- returned capacity to be returnedtableKeysAndAttributes
- the tables, keys, and attributes specification to be used to retrieve the items.
-
batchGetItem
public BatchGetItemOutcome batchGetItem(TableKeysAndAttributes... tableKeysAndAttributes)
Description copied from interface:BatchGetItemApi
Used to perform a batch get-item operation from DynamoDB.- Specified by:
batchGetItem
in interfaceBatchGetItemApi
- Parameters:
tableKeysAndAttributes
- the tables, keys, and attributes specification to be used to retrieve the items.
-
batchGetItem
public BatchGetItemOutcome batchGetItem(BatchGetItemSpec spec)
Description copied from interface:BatchGetItemApi
Used to perform a batch get-item operation from DynamoDB with full parameter specification.- Specified by:
batchGetItem
in interfaceBatchGetItemApi
-
batchGetItemUnprocessed
public BatchGetItemOutcome batchGetItemUnprocessed(ReturnConsumedCapacity returnConsumedCapacity, Map<String,KeysAndAttributes> unprocessedKeys)
Description copied from interface:BatchGetItemApi
Used to perform a batch get-item for the unprocessed keys returned from a previous batch get-item operation.- Specified by:
batchGetItemUnprocessed
in interfaceBatchGetItemApi
- Parameters:
returnConsumedCapacity
- returned capacity to be returnedunprocessedKeys
- the unprocessed keys returned from the result of a previous batch-get-item operation.- See Also:
BatchGetItemOutcome.getUnprocessedKeys()
-
batchGetItemUnprocessed
public BatchGetItemOutcome batchGetItemUnprocessed(Map<String,KeysAndAttributes> unprocessedKeys)
Description copied from interface:BatchGetItemApi
Used to perform a batch get-item for the unprocessed keys returned from a previous batch get-item operation.- Specified by:
batchGetItemUnprocessed
in interfaceBatchGetItemApi
- Parameters:
unprocessedKeys
- the unprocessed keys returned from the result of a previous batch-get-item operation.- See Also:
BatchGetItemOutcome.getUnprocessedKeys()
-
batchWriteItem
public BatchWriteItemOutcome batchWriteItem(TableWriteItems... tableWriteItems)
Description copied from interface:BatchWriteItemApi
Used to perform a batch write operation to DynamoDB.- Specified by:
batchWriteItem
in interfaceBatchWriteItemApi
- Parameters:
tableWriteItems
- the tables and the respective keys to delete from and/or the respective items to be put.
-
batchWriteItem
public BatchWriteItemOutcome batchWriteItem(BatchWriteItemSpec spec)
Description copied from interface:BatchWriteItemApi
Used to perform a batch write operation to DynamoDB with full parameter specification.- Specified by:
batchWriteItem
in interfaceBatchWriteItemApi
-
batchWriteItemUnprocessed
public BatchWriteItemOutcome batchWriteItemUnprocessed(Map<String,List<WriteRequest>> unprocessedItems)
Description copied from interface:BatchWriteItemApi
Used to perform a batch write operation for the unprocessed items returned from a previous batch write operation.- Specified by:
batchWriteItemUnprocessed
in interfaceBatchWriteItemApi
- Parameters:
unprocessedItems
- the unprocessed items returned from the result of a previous batch write operation- See Also:
BatchWriteItemOutcome.getUnprocessedItems()
-
shutdown
public void shutdown()
Shuts down and release all resources.
-
-