Class Table
- java.lang.Object
-
- com.amazonaws.services.dynamodbv2.document.Table
-
- All Implemented Interfaces:
DeleteItemApi,GetItemApi,PutItemApi,QueryApi,ScanApi,UpdateItemApi
public class Table extends Object implements PutItemApi, GetItemApi, QueryApi, ScanApi, UpdateItemApi, DeleteItemApi
A DynamoDB table. Instance of this class is typically obtained viaDynamoDB.getTable(String).
-
-
Constructor Summary
Constructors Constructor Description Table(AmazonDynamoDB client, String tableName)Table(AmazonDynamoDB client, String tableName, TableDescription tableDescription)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IndexcreateGSI(CreateGlobalSecondaryIndexAction create, AttributeDefinition hashKeyDefinition)Creates a global secondary index (GSI) with only a hash key on this table.IndexcreateGSI(CreateGlobalSecondaryIndexAction create, AttributeDefinition hashKeyDefinition, AttributeDefinition rangeKeyDefinition)Creates a global secondary index (GSI) with both a hash key and a range key on this table.DeleteTableResultdelete()Deletes the table from DynamoDB.DeleteItemOutcomedeleteItem(KeyAttribute... primaryKeyComponents)Deletes an item by primary key.DeleteItemOutcomedeleteItem(PrimaryKey primaryKey)Deletes an item by primary key.DeleteItemOutcomedeleteItem(PrimaryKey primaryKey, Expected... expected)Conditional delete with the specified primary key and expected conditions.DeleteItemOutcomedeleteItem(PrimaryKey primaryKey, DeleteItemExpressionSpec conditionExpressions)DeleteItemOutcomedeleteItem(PrimaryKey primaryKey, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)Conditional delete with the specified primary key and condition expression.DeleteItemOutcomedeleteItem(DeleteItemSpec spec)Deletes an item by specifying all the details.DeleteItemOutcomedeleteItem(String hashKeyName, Object hashKeyValue)Deletes an item by hash-only primary key.DeleteItemOutcomedeleteItem(String hashKeyName, Object hashKeyValue, Expected... expected)Conditional delete with the specified hash-only primary key and expected conditions.DeleteItemOutcomedeleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue)Deletes an item by hash key-and-range primary key.DeleteItemOutcomedeleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, Expected... expected)Conditional delete with the specified hash-and-range primary key and expected conditions.DeleteItemOutcomedeleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, DeleteItemExpressionSpec conditionExpressions)DeleteItemOutcomedeleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)Conditional delete with the specified hash-and-range primary key and condition expression.DeleteItemOutcomedeleteItem(String hashKeyName, Object hashKeyValue, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)Conditional delete with the specified hash-only primary key and condition expression.TableDescriptiondescribe()Retrieves the table description from DynamoDB.TableDescriptiongetDescription()Returns the table description; or null if the table description has not yet been described viadescribe().IndexgetIndex(String indexName)Gets a reference to the specified index.ItemgetItem(KeyAttribute... primaryKeyComponents)Retrieves an item by primary key.ItemgetItem(PrimaryKey primaryKey)Retrieves an item by primary key; or null if the item doesn't exist.ItemgetItem(PrimaryKey primaryKey, String projectionExpression, Map<String,String> nameMap)Retrieves an item using projection expression.ItemgetItem(GetItemSpec spec)Retrieves an item by specifying all the details.ItemgetItem(String hashKeyName, Object hashKeyValue)Retrieves an item by primary key when the primary key is a hash-only key.ItemgetItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue)Retrieves an item by primary key when the primary key consists of both a hash-key and a range-key.ItemgetItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, GetItemExpressionSpec projectionExpressions)ItemgetItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String projectionExpression, Map<String,String> nameMap)Retrieves an item via the specified hash key and range key using projection expression.ItemgetItem(String hashKeyName, Object hashKeyValue, String projectionExpression, Map<String,String> nameMap)Retrieves an item via the specified hash key using projection expression.GetItemOutcomegetItemOutcome(KeyAttribute... primaryKeyComponents)Retrieves an item and the associated information by primary key when the primary key is a hash-only key.GetItemOutcomegetItemOutcome(PrimaryKey primaryKey)Retrieves an item and the associated information by primary key.GetItemOutcomegetItemOutcome(PrimaryKey primaryKey, String projectionExpression, Map<String,String> nameMap)Retrieves an item and the associated information using projection expression.GetItemOutcomegetItemOutcome(GetItemSpec params)Retrieves an item and the associated information by specifying all the details.GetItemOutcomegetItemOutcome(String hashKeyName, Object hashKeyValue)Retrieves an item and the associated information by primary key when the primary key is a hash-only key.GetItemOutcomegetItemOutcome(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue)Retrieves an item and the associated information by primary key when the primary key consists of both a hash-key and a range-key.GetItemOutcomegetItemOutcome(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, GetItemExpressionSpec projectionExpressions)GetItemOutcomegetItemOutcome(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String projectionExpression, Map<String,String> nameMap)Retrieves an item and the associated information via the specified hash key and range key using projection expression.GetItemOutcomegetItemOutcome(String hashKeyName, Object hashKeyValue, String projectionExpression, Map<String,String> nameMap)Retrieves an item and the associated information via the specified hash key using projection expression.StringgetTableName()PutItemOutcomeputItem(Item item)Unconditional put.PutItemOutcomeputItem(Item item, Expected... expected)Conditional put.PutItemOutcomeputItem(Item item, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)Conditional put via condition expression.PutItemOutcomeputItem(PutItemSpec spec)Puts an item by specifying all the details.ItemCollection<QueryOutcome>query(KeyAttribute hashKey)Retrieves items by the specified hash key.ItemCollection<QueryOutcome>query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition)Retrieves items by the specified hash key and a range key condition.ItemCollection<QueryOutcome>query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition, QueryFilter... queryFilters)Retrieves items by the specified hash key, a range key condition and a list of query filters.ItemCollection<QueryOutcome>query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition, String filterExpression, String projectionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)Retrieves items by the specified hash key, a range key condition, a filter expression and a projection expression.ItemCollection<QueryOutcome>query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition, String filterExpression, Map<String,String> nameMap, Map<String,Object> valueMap)Retrieves items by the specified hash key, a range key condition, and a filter expression string.ItemCollection<QueryOutcome>query(QuerySpec spec)Queries table by specifying all the details.ItemCollection<QueryOutcome>query(String hashKeyName, Object hashKeyValue)Retrieves items by the specified hash key.ItemCollection<QueryOutcome>query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition)ItemCollection<QueryOutcome>query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, QueryFilter... queryFilters)ItemCollection<QueryOutcome>query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, QueryExpressionSpec queryExpressions)ItemCollection<QueryOutcome>query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, String filterExpression, String projectionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)Retrieves items by the specified hash key, a range key condition, a filter expression and a projection expression.ItemCollection<QueryOutcome>query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, String filterExpression, Map<String,String> nameMap, Map<String,Object> valueMap)ItemCollection<ScanOutcome>scan(ScanFilter... scanFilters)Retrieves items by the specified list of scan filters.ItemCollection<ScanOutcome>scan(ScanSpec params)Scans table by specifying all the details.ItemCollection<ScanOutcome>scan(ScanExpressionSpec scanExpressions)ItemCollection<ScanOutcome>scan(String filterExpression, String projectionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)Scans table using a Filter Expression and a Projection Expression.ItemCollection<ScanOutcome>scan(String filterExpression, Map<String,String> nameMap, Map<String,Object> valueMap)Scans table using a Filter Expression.StringtoString()UpdateItemOutcomeupdateItem(PrimaryKey primaryKey, AttributeUpdate... attributeUpdates)Updates an item with the attributes specified.UpdateItemOutcomeupdateItem(PrimaryKey primaryKey, String updateExpression, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)Updates an item with the specified primary key using the given update expression provided the condition expression evaluates to true.UpdateItemOutcomeupdateItem(PrimaryKey primaryKey, String updateExpression, Map<String,String> nameMap, Map<String,Object> valueMap)Performs an update on an item in the table using the given update expression string.UpdateItemOutcomeupdateItem(PrimaryKey primaryKey, Collection<Expected> expected, AttributeUpdate... attributeUpdates)Updates an item with the attributes specified.UpdateItemOutcomeupdateItem(UpdateItemSpec updateItemSpec)Performs an update on an item in the table by specifying all the details.UpdateItemOutcomeupdateItem(String hashKeyName, Object hashKeyValue, AttributeUpdate... attributeUpdates)UpdateItemOutcomeupdateItem(String hashKeyName, Object hashKeyValue, UpdateItemExpressionSpec updateExpressions)UpdateItemOutcomeupdateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, AttributeUpdate... attributeUpdates)UpdateItemOutcomeupdateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, UpdateItemExpressionSpec updateExpressions)UpdateItemOutcomeupdateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String updateExpression, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)Updates an item with the specified hash key and range key using the given update expression provided the condition expression evaluates to true.UpdateItemOutcomeupdateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String updateExpression, Map<String,String> nameMap, Map<String,Object> valueMap)UpdateItemOutcomeupdateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, Collection<Expected> expected, AttributeUpdate... attributeUpdates)Updates an item with the specified hash key, range key and attributes.UpdateItemOutcomeupdateItem(String hashKeyName, Object hashKeyValue, String updateExpression, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)Updates an item with the specified hash key using the given update expression provided the condition expression evaluates to true.UpdateItemOutcomeupdateItem(String hashKeyName, Object hashKeyValue, String updateExpression, Map<String,String> nameMap, Map<String,Object> valueMap)UpdateItemOutcomeupdateItem(String hashKeyName, Object hashKeyValue, Collection<Expected> expected, AttributeUpdate... attributeUpdates)Updates an item with the specified hash-only key and attributes.TableDescriptionupdateTable(UpdateTableSpec spec)Updates the provisioned throughput for this table.TableDescriptionupdateTable(ProvisionedThroughput provisionedThroughput)Updates the provisioned throughput for this table.TableDescriptionwaitForActive()A convenient blocking call that can be used, typically during table creation, to wait for the table to become active by polling the table every 5 seconds.TableDescriptionwaitForActiveOrDelete()A convenient blocking call that can be used to wait on a table until it has either become active or deleted (ie no longer exists) by polling the table every 5 seconds.TableDescriptionwaitForAllActiveOrDelete()A convenient blocking call that can be used to wait on a table and all it's indexes until both the table and it's indexes have either become active or deleted (ie no longer exists) by polling the table every 5 seconds.voidwaitForDelete()A convenient blocking call that can be used, typically during table deletion, to wait for the table to become deleted by polling the table every 5 seconds.
-
-
-
Constructor Detail
-
Table
public Table(AmazonDynamoDB client, String tableName)
-
Table
public Table(AmazonDynamoDB client, String tableName, TableDescription tableDescription)
-
-
Method Detail
-
getTableName
public String getTableName()
-
getDescription
public TableDescription getDescription()
Returns the table description; or null if the table description has not yet been described viadescribe(). No network call.
-
describe
public TableDescription describe()
Retrieves the table description from DynamoDB. Involves network calls. Meant to be called as infrequently as possible to avoid throttling exception from the server side.- Returns:
- a non-null table description
- Throws:
ResourceNotFoundException- if the table doesn't exist
-
getIndex
public Index getIndex(String indexName)
Gets a reference to the specified index. No network call.
-
putItem
public PutItemOutcome putItem(Item item)
Description copied from interface:PutItemApiUnconditional put.- Specified by:
putItemin interfacePutItemApi
-
putItem
public PutItemOutcome putItem(Item item, Expected... expected)
Description copied from interface:PutItemApiConditional put.- Specified by:
putItemin interfacePutItemApi
-
putItem
public PutItemOutcome putItem(Item item, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:PutItemApiConditional put via condition expression.- Specified by:
putItemin interfacePutItemApi
-
putItem
public PutItemOutcome putItem(PutItemSpec spec)
Description copied from interface:PutItemApiPuts an item by specifying all the details.- Specified by:
putItemin interfacePutItemApi
-
getItemOutcome
public GetItemOutcome getItemOutcome(KeyAttribute... primaryKeyComponents)
Description copied from interface:GetItemApiRetrieves an item and the associated information by primary key when the primary key is a hash-only key. Incurs network access.- Specified by:
getItemOutcomein interfaceGetItemApi- Returns:
- the (non-null) result of item retrieval.
-
getItemOutcome
public GetItemOutcome getItemOutcome(PrimaryKey primaryKey)
Description copied from interface:GetItemApiRetrieves an item and the associated information by primary key. Incurs network access.- Specified by:
getItemOutcomein interfaceGetItemApi- Returns:
- the (non-null) result of item retrieval.
-
getItemOutcome
public GetItemOutcome getItemOutcome(PrimaryKey primaryKey, String projectionExpression, Map<String,String> nameMap)
Description copied from interface:GetItemApiRetrieves an item and the associated information using projection expression. Incurs network access.- Specified by:
getItemOutcomein interfaceGetItemApiprojectionExpression- projection expression, example: "a.b , c[0].e"nameMap- actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.- Returns:
- the (non-null) result of item retrieval.
-
getItemOutcome
public GetItemOutcome getItemOutcome(GetItemSpec params)
Description copied from interface:GetItemApiRetrieves an item and the associated information by specifying all the details. Incurs network access.- Specified by:
getItemOutcomein interfaceGetItemApi- Returns:
- the (non-null) result of item retrieval.
-
updateItem
public UpdateItemOutcome updateItem(PrimaryKey primaryKey, AttributeUpdate... attributeUpdates)
Description copied from interface:UpdateItemApiUpdates an item with the attributes specified.- Specified by:
updateItemin interfaceUpdateItemApi- Parameters:
primaryKey- primary key of the item to be updatedattributeUpdates- attributes to be updated
-
updateItem
public UpdateItemOutcome updateItem(PrimaryKey primaryKey, Collection<Expected> expected, AttributeUpdate... attributeUpdates)
Description copied from interface:UpdateItemApiUpdates an item with the attributes specified.- Specified by:
updateItemin interfaceUpdateItemApi- Parameters:
primaryKey- primary key of the item to be updatedexpected- the condition to match for the update to succeed.attributeUpdates- attributes to be updated
-
updateItem
public UpdateItemOutcome updateItem(PrimaryKey primaryKey, String updateExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:UpdateItemApiPerforms an update on an item in the table using the given update expression string.- Specified by:
updateItemin interfaceUpdateItemApi- Parameters:
primaryKey- primary key of the item to be updatedupdateExpression- the update expression that specifies the attributes to be updated.nameMap- the map containing the mapping between attribute names used in update expression and the actual name of the attributesvalueMap- the map containing the mapping between the attribute value used in update expression and the actual value of the attribute
-
updateItem
public UpdateItemOutcome updateItem(PrimaryKey primaryKey, String updateExpression, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:UpdateItemApiUpdates an item with the specified primary key using the given update expression provided the condition expression evaluates to true.- Specified by:
updateItemin interfaceUpdateItemApi- Parameters:
primaryKey- primary key of the item to be updatedupdateExpression- the update expression that specifies the attributes to be updated.conditionExpression- the condition expression that specifies the condition that needs to be evaluated to truenameMap- the map containing the mapping between attribute names used in update and condition expression and the actual name of the attributesvalueMap- the map containing the mapping between the attribute value used in update and condition expression and the actual value of the attribute
-
updateItem
public UpdateItemOutcome updateItem(UpdateItemSpec updateItemSpec)
Description copied from interface:UpdateItemApiPerforms an update on an item in the table by specifying all the details.- Specified by:
updateItemin interfaceUpdateItemApi- Parameters:
updateItemSpec- the update specification for the item to be updated.
-
query
public ItemCollection<QueryOutcome> query(String hashKeyName, Object hashKeyValue)
Description copied from interface:QueryApiRetrieves items by the specified hash key.
-
query
public ItemCollection<QueryOutcome> query(KeyAttribute hashKey)
Description copied from interface:QueryApiRetrieves items by the specified hash key.
-
query
public ItemCollection<QueryOutcome> query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition)
Description copied from interface:QueryApiRetrieves items by the specified hash key and a range key condition.
-
query
public ItemCollection<QueryOutcome> query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition, String filterExpression, String projectionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:QueryApiRetrieves items by the specified hash key, a range key condition, a filter expression and a projection expression.- Specified by:
queryin interfaceQueryApifilterExpression- filter expression example: "(#a > :a) AND (#c > :c OR #e < :e)"projectionExpression- projection expression example: "a.b, c[0].e"nameMap- actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.valueMap- actual values for the value place holders can be null if there is no attribute-value placeholder.
-
query
public ItemCollection<QueryOutcome> query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition, QueryFilter... queryFilters)
Description copied from interface:QueryApiRetrieves items by the specified hash key, a range key condition and a list of query filters.
-
query
public ItemCollection<QueryOutcome> query(KeyAttribute hashKey, RangeKeyCondition rangeKeyCondition, String filterExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:QueryApiRetrieves items by the specified hash key, a range key condition, and a filter expression string.- Specified by:
queryin interfaceQueryApifilterExpression- filter expression example: "(#a > :a) AND (#c > :c OR #e < :e)"nameMap- actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.valueMap- actual values for the value place holders can be null if there is no attribute-value placeholder.
-
query
public ItemCollection<QueryOutcome> query(QuerySpec spec)
Description copied from interface:QueryApiQueries table by specifying all the details.
-
scan
public ItemCollection<ScanOutcome> scan(ScanFilter... scanFilters)
Description copied from interface:ScanApiRetrieves items by the specified list of scan filters.
-
scan
public ItemCollection<ScanOutcome> scan(String filterExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:ScanApiScans table using a Filter Expression.- Specified by:
scanin interfaceScanApi- Parameters:
filterExpression- condition expression example: "(#a > :a) AND (#c > :c OR #e < :e)"nameMap- actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.valueMap- actual values for the value place holders can be null if there is no attribute-value placeholder.
-
scan
public ItemCollection<ScanOutcome> scan(String filterExpression, String projectionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:ScanApiScans table using a Filter Expression and a Projection Expression.- Specified by:
scanin interfaceScanApi- Parameters:
filterExpression- condition expression example: "(#a > :a) AND (#c > :c OR #e < :e)"projectionExpression- projection expression example: "a.b , c[0].e"nameMap- actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.valueMap- actual values for the value place holders can be null if there is no attribute-value placeholder.
-
scan
public ItemCollection<ScanOutcome> scan(ScanSpec params)
Description copied from interface:ScanApiScans table by specifying all the details.
-
scan
@Beta public ItemCollection<ScanOutcome> scan(ScanExpressionSpec scanExpressions)
-
deleteItem
public DeleteItemOutcome deleteItem(KeyAttribute... primaryKeyComponents)
Description copied from interface:DeleteItemApiDeletes an item by primary key.- Specified by:
deleteItemin interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(PrimaryKey primaryKey)
Description copied from interface:DeleteItemApiDeletes an item by primary key.- Specified by:
deleteItemin interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(PrimaryKey primaryKey, Expected... expected)
Description copied from interface:DeleteItemApiConditional delete with the specified primary key and expected conditions.- Specified by:
deleteItemin interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(PrimaryKey primaryKey, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:DeleteItemApiConditional delete with the specified primary key and condition expression.- Specified by:
deleteItemin interfaceDeleteItemApi
-
deleteItem
@Beta public DeleteItemOutcome deleteItem(PrimaryKey primaryKey, DeleteItemExpressionSpec conditionExpressions)
-
deleteItem
public DeleteItemOutcome deleteItem(DeleteItemSpec spec)
Description copied from interface:DeleteItemApiDeletes an item by specifying all the details.- Specified by:
deleteItemin interfaceDeleteItemApi
-
updateTable
public TableDescription updateTable(UpdateTableSpec spec)
Updates the provisioned throughput for this table. Setting the throughput for a table helps you manage performance and is part of the provisioned throughput feature of DynamoDB.The provisioned throughput values can be upgraded or downgraded based on the maximums and minimums listed in the Limits section in the Amazon DynamoDB Developer Guide.
This table must be in the
ACTIVEstate for this operation to succeed. UpdateTable is an asynchronous operation; while executing the operation, the table is in theUPDATINGstate. While the table is in theUPDATINGstate, the table still has the provisioned throughput from before the call. The new provisioned throughput setting is in effect only when the table returns to theACTIVEstate after the UpdateTable operation.You can create, update or delete indexes using UpdateTable.
- Parameters:
spec- used to specify all the detailed parameters- Returns:
- the updated table description returned from DynamoDB.
-
createGSI
public Index createGSI(CreateGlobalSecondaryIndexAction create, AttributeDefinition hashKeyDefinition)
Creates a global secondary index (GSI) with only a hash key on this table. Involves network calls. This table must be in theACTIVEstate for this operation to succeed. Creating a global secondary index is an asynchronous operation; while executing the operation, the index is in theCREATINGstate. Once created, the index will be inACTIVEstate.- Parameters:
create- used to specify the details of the index creationhashKeyDefinition- used to specify the attribute for describing the key schema for the hash key of the GSI to be created for this table.- Returns:
- the index being created
-
createGSI
public Index createGSI(CreateGlobalSecondaryIndexAction create, AttributeDefinition hashKeyDefinition, AttributeDefinition rangeKeyDefinition)
Creates a global secondary index (GSI) with both a hash key and a range key on this table. Involves network calls. This table must be in theACTIVEstate for this operation to succeed. Creating a global secondary index is an asynchronous operation; while executing the operation, the index is in theCREATINGstate. Once created, the index will be inACTIVEstate.- Parameters:
create- used to specify the details of the index creationhashKeyDefinition- used to specify the attribute for describing the key schema for the hash key of the GSI to be created for this table.rangeKeyDefinition- used to specify the attribute for describing the key schema for the range key of the GSI to be created for this table.- Returns:
- the index being created
-
updateTable
public TableDescription updateTable(ProvisionedThroughput provisionedThroughput)
Updates the provisioned throughput for this table. Setting the throughput for a table helps you manage performance and is part of the provisioned throughput feature of DynamoDB.The provisioned throughput values can be upgraded or downgraded based on the maximums and minimums listed in the Limits section in the Amazon DynamoDB Developer Guide.
This table must be in the
ACTIVEstate for this operation to succeed. UpdateTable is an asynchronous operation; while executing the operation, the table is in theUPDATINGstate. While the table is in theUPDATINGstate, the table still has the provisioned throughput from before the call. The new provisioned throughput setting is in effect only when the table returns to theACTIVEstate after the UpdateTable operation.You can create, update or delete indexes using UpdateTable.
- Parameters:
provisionedThroughput- target provisioned throughput- Returns:
- the updated table description returned from DynamoDB.
-
waitForActive
public TableDescription waitForActive() throws InterruptedException
A convenient blocking call that can be used, typically during table creation, to wait for the table to become active by polling the table every 5 seconds.- Returns:
- the table description when the table has become active
- Throws:
IllegalArgumentException- if the table is being deletedResourceNotFoundException- if the table doesn't existInterruptedException
-
waitForDelete
public void waitForDelete() throws InterruptedExceptionA convenient blocking call that can be used, typically during table deletion, to wait for the table to become deleted by polling the table every 5 seconds.- Throws:
InterruptedException
-
waitForActiveOrDelete
public TableDescription waitForActiveOrDelete() throws InterruptedException
A convenient blocking call that can be used to wait on a table until it has either become active or deleted (ie no longer exists) by polling the table every 5 seconds.- Returns:
- the table description if the table has become active; or null if the table has been deleted.
- Throws:
InterruptedException
-
waitForAllActiveOrDelete
public TableDescription waitForAllActiveOrDelete() throws InterruptedException
A convenient blocking call that can be used to wait on a table and all it's indexes until both the table and it's indexes have either become active or deleted (ie no longer exists) by polling the table every 5 seconds.- Returns:
- the table description if the table and all it's indexes have become active; or null if the table has been deleted.
- Throws:
InterruptedException
-
delete
public DeleteTableResult delete()
Deletes the table from DynamoDB. Involves network calls.
-
getItem
public Item getItem(KeyAttribute... primaryKeyComponents)
Description copied from interface:GetItemApiRetrieves an item by primary key. Incurs network access.- Specified by:
getItemin interfaceGetItemApi- Returns:
- the retrieved item; or null if the item doesn't exist.
-
getItem
public Item getItem(PrimaryKey primaryKey)
Description copied from interface:GetItemApiRetrieves an item by primary key; or null if the item doesn't exist. Incurs network access.- Specified by:
getItemin interfaceGetItemApi- Returns:
- the retrieved item; or null if the item doesn't exist.
-
getItem
public Item getItem(PrimaryKey primaryKey, String projectionExpression, Map<String,String> nameMap)
Description copied from interface:GetItemApiRetrieves an item using projection expression. Incurs network access.- Specified by:
getItemin interfaceGetItemApiprojectionExpression- projection expression, example: "a.b , c[0].e"nameMap- actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.- Returns:
- the retrieved item; or null if the item doesn't exist.
-
getItem
public Item getItem(GetItemSpec spec)
Description copied from interface:GetItemApiRetrieves an item by specifying all the details. Incurs network access.- Specified by:
getItemin interfaceGetItemApi- Returns:
- the retrieved item; or null if the item doesn't exist.
-
getItemOutcome
public GetItemOutcome getItemOutcome(String hashKeyName, Object hashKeyValue)
Description copied from interface:GetItemApiRetrieves an item and the associated information by primary key when the primary key is a hash-only key. Incurs network access.- Specified by:
getItemOutcomein interfaceGetItemApi- Returns:
- the (non-null) result of item retrieval.
-
getItemOutcome
public GetItemOutcome getItemOutcome(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue)
Description copied from interface:GetItemApiRetrieves an item and the associated information by primary key when the primary key consists of both a hash-key and a range-key. Incurs network access.- Specified by:
getItemOutcomein interfaceGetItemApi- Returns:
- the (non-null) result of item retrieval.
-
getItem
public Item getItem(String hashKeyName, Object hashKeyValue)
Description copied from interface:GetItemApiRetrieves an item by primary key when the primary key is a hash-only key. Incurs network access.- Specified by:
getItemin interfaceGetItemApi- Returns:
- the retrieved item; or null if the item doesn't exist.
-
getItem
public Item getItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue)
Description copied from interface:GetItemApiRetrieves an item by primary key when the primary key consists of both a hash-key and a range-key. Incurs network access.- Specified by:
getItemin interfaceGetItemApi- Returns:
- the retrieved item; or null if the item doesn't exist.
-
query
public ItemCollection<QueryOutcome> query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition)
-
query
public ItemCollection<QueryOutcome> query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, QueryFilter... queryFilters)
-
query
public ItemCollection<QueryOutcome> query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, String filterExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
-
query
public ItemCollection<QueryOutcome> query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, String filterExpression, String projectionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:QueryApiRetrieves items by the specified hash key, a range key condition, a filter expression and a projection expression.- Specified by:
queryin interfaceQueryApifilterExpression- filter expression example: "(#a > :a) AND (#c > :c OR #e < :e)"projectionExpression- projection expression example: "a.b, c[0].e"nameMap- actual values for the attribute-name place holders; can be null if there is no attribute-name placeholder.valueMap- actual values for the value place holders can be null if there is no attribute-value placeholder.
-
query
@Beta public ItemCollection<QueryOutcome> query(String hashKeyName, Object hashKeyValue, RangeKeyCondition rangeKeyCondition, QueryExpressionSpec queryExpressions)
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, AttributeUpdate... attributeUpdates)
- Specified by:
updateItemin interfaceUpdateItemApi
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, AttributeUpdate... attributeUpdates)
- Specified by:
updateItemin interfaceUpdateItemApi
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, Collection<Expected> expected, AttributeUpdate... attributeUpdates)
Description copied from interface:UpdateItemApiUpdates an item with the specified hash-only key and attributes.- Specified by:
updateItemin interfaceUpdateItemApi
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, Collection<Expected> expected, AttributeUpdate... attributeUpdates)
Description copied from interface:UpdateItemApiUpdates an item with the specified hash key, range key and attributes.- Specified by:
updateItemin interfaceUpdateItemApi
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, String updateExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
- Specified by:
updateItemin interfaceUpdateItemApi
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String updateExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
- Specified by:
updateItemin interfaceUpdateItemApi
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, String updateExpression, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:UpdateItemApiUpdates an item with the specified hash key using the given update expression provided the condition expression evaluates to true.- Specified by:
updateItemin interfaceUpdateItemApi
-
updateItem
@Beta public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, UpdateItemExpressionSpec updateExpressions)
-
updateItem
public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String updateExpression, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:UpdateItemApiUpdates an item with the specified hash key and range key using the given update expression provided the condition expression evaluates to true.- Specified by:
updateItemin interfaceUpdateItemApi
-
updateItem
@Beta public UpdateItemOutcome updateItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, UpdateItemExpressionSpec updateExpressions)
-
getItemOutcome
public GetItemOutcome getItemOutcome(String hashKeyName, Object hashKeyValue, String projectionExpression, Map<String,String> nameMap)
Description copied from interface:GetItemApiRetrieves an item and the associated information via the specified hash key using projection expression. Incurs network access.- Specified by:
getItemOutcomein interfaceGetItemApi- Returns:
- the (non-null) result of item retrieval.
-
getItemOutcome
public GetItemOutcome getItemOutcome(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String projectionExpression, Map<String,String> nameMap)
Description copied from interface:GetItemApiRetrieves an item and the associated information via the specified hash key and range key using projection expression. Incurs network access.- Specified by:
getItemOutcomein interfaceGetItemApi- Returns:
- the (non-null) result of item retrieval.
-
getItemOutcome
@Beta public GetItemOutcome getItemOutcome(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, GetItemExpressionSpec projectionExpressions)
-
getItem
public Item getItem(String hashKeyName, Object hashKeyValue, String projectionExpression, Map<String,String> nameMap)
Description copied from interface:GetItemApiRetrieves an item via the specified hash key using projection expression. Incurs network access.- Specified by:
getItemin interfaceGetItemApi- Returns:
- the retrieved item; or null if the item doesn't exist.
-
getItem
public Item getItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String projectionExpression, Map<String,String> nameMap)
Description copied from interface:GetItemApiRetrieves an item via the specified hash key and range key using projection expression. Incurs network access.- Specified by:
getItemin interfaceGetItemApi- Returns:
- the retrieved item; or null if the item doesn't exist.
-
getItem
@Beta public Item getItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, GetItemExpressionSpec projectionExpressions)
-
deleteItem
public DeleteItemOutcome deleteItem(String hashKeyName, Object hashKeyValue)
Description copied from interface:DeleteItemApiDeletes an item by hash-only primary key.- Specified by:
deleteItemin interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue)
Description copied from interface:DeleteItemApiDeletes an item by hash key-and-range primary key.- Specified by:
deleteItemin interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(String hashKeyName, Object hashKeyValue, Expected... expected)
Description copied from interface:DeleteItemApiConditional delete with the specified hash-only primary key and expected conditions.- Specified by:
deleteItemin interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, Expected... expected)
Description copied from interface:DeleteItemApiConditional delete with the specified hash-and-range primary key and expected conditions.- Specified by:
deleteItemin interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(String hashKeyName, Object hashKeyValue, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:DeleteItemApiConditional delete with the specified hash-only primary key and condition expression.- Specified by:
deleteItemin interfaceDeleteItemApi
-
deleteItem
public DeleteItemOutcome deleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, String conditionExpression, Map<String,String> nameMap, Map<String,Object> valueMap)
Description copied from interface:DeleteItemApiConditional delete with the specified hash-and-range primary key and condition expression.- Specified by:
deleteItemin interfaceDeleteItemApi
-
deleteItem
@Beta public DeleteItemOutcome deleteItem(String hashKeyName, Object hashKeyValue, String rangeKeyName, Object rangeKeyValue, DeleteItemExpressionSpec conditionExpressions)
-
-