com.amazonaws.services.dynamodbv2.model
Class BatchGetItemRequest

java.lang.Object
  extended by com.amazonaws.AmazonWebServiceRequest
      extended by com.amazonaws.services.dynamodbv2.model.BatchGetItemRequest
All Implemented Interfaces:
java.io.Serializable

public class BatchGetItemRequest
extends AmazonWebServiceRequest
implements java.io.Serializable

Container for the parameters to the BatchGetItem operation.

The BatchGetItem operation returns the attributes of one or more items from one or more tables. You identify requested items by primary key.

A single operation can retrieve up to 1 MB of data, which can contain as many as 100 items. BatchGetItem will return a partial result if the response size limit is exceeded, the table's provisioned throughput is exceeded, or an internal processing failure occurs. If a partial result is returned, the operation returns a value for UnprocessedKeys . You can use this value to retry the operation starting with the next item to get.

For example, if you ask to retrieve 100 items, but each individual item is 50 KB in size, the system returns 20 items (1 MB) and an appropriate UnprocessedKeys value so you can get the next page of results. If desired, your application can include its own logic to assemble the pages of results into one dataset.

If none of the items can be processed due to insufficient provisioned throughput on all of the tables in the request, then BatchGetItem will throw a ProvisionedThroughputExceededException . If at least one of the items is successfully processed, then BatchGetItem completes successfully, while returning the keys of the unread items in UnprocessedKeys .

By default, BatchGetItem performs eventually consistent reads on every table in the request. If you want strongly consistent reads instead, you can set ConsistentRead to true for any or all tables.

In order to minimize response latency, BatchGetItem retrieves items in parallel.

When designing your application, keep in mind that DynamoDB does not return attributes in any particular order. To help parse the response by item, include the primary key values for the items in your request in the AttributesToGet parameter.

If a requested item does not exist, it is not returned in the result. Requests for nonexistent items consume the minimum read capacity units according to the type of read. For more information, see Capacity Units Calculations in the Amazon DynamoDB Developer Guide.

See Also:
AmazonDynamoDB.batchGetItem(BatchGetItemRequest), Serialized Form

Constructor Summary
BatchGetItemRequest()
          Default constructor for a new BatchGetItemRequest object.
BatchGetItemRequest(java.util.Map<java.lang.String,KeysAndAttributes> requestItems)
          Constructs a new BatchGetItemRequest object.
BatchGetItemRequest(java.util.Map<java.lang.String,KeysAndAttributes> requestItems, ReturnConsumedCapacity returnConsumedCapacity)
          Constructs a new BatchGetItemRequest object.
BatchGetItemRequest(java.util.Map<java.lang.String,KeysAndAttributes> requestItems, java.lang.String returnConsumedCapacity)
          Constructs a new BatchGetItemRequest object.
 
Method Summary
 BatchGetItemRequest addRequestItemsEntry(java.lang.String key, KeysAndAttributes value)
          A map of one or more table names and, for each table, the corresponding primary keys for the items to retrieve.
 BatchGetItemRequest clearRequestItemsEntries()
          Removes all the entries added into RequestItems.
 boolean equals(java.lang.Object obj)
           
 java.util.Map<java.lang.String,KeysAndAttributes> getRequestItems()
          A map of one or more table names and, for each table, the corresponding primary keys for the items to retrieve.
 java.lang.String getReturnConsumedCapacity()
          If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes.
 int hashCode()
           
 void setRequestItems(java.util.Map<java.lang.String,KeysAndAttributes> requestItems)
          A map of one or more table names and, for each table, the corresponding primary keys for the items to retrieve.
 void setReturnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity)
          If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes.
 void setReturnConsumedCapacity(java.lang.String returnConsumedCapacity)
          If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes.
 java.lang.String toString()
          Returns a string representation of this object; useful for testing and debugging.
 BatchGetItemRequest withRequestItems(java.util.Map<java.lang.String,KeysAndAttributes> requestItems)
          A map of one or more table names and, for each table, the corresponding primary keys for the items to retrieve.
 BatchGetItemRequest withReturnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity)
          If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes.
 BatchGetItemRequest withReturnConsumedCapacity(java.lang.String returnConsumedCapacity)
          If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes.
 
Methods inherited from class com.amazonaws.AmazonWebServiceRequest
copyPrivateRequestParameters, getDelegationToken, getRequestClientOptions, getRequestCredentials, getRequestMetricCollector, setDelegationToken, setRequestCredentials, setRequestMetricCollector, withRequestMetricCollector
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BatchGetItemRequest

public BatchGetItemRequest()
Default constructor for a new BatchGetItemRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.


BatchGetItemRequest

public BatchGetItemRequest(java.util.Map<java.lang.String,KeysAndAttributes> requestItems)
Constructs a new BatchGetItemRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
requestItems - A map of one or more table names and, for each table, the corresponding primary keys for the items to retrieve. Each table name can be invoked only once.

Each element in the map consists of the following:

  • Keys - An array of primary key attribute values that define specific items in the table.

  • AttributesToGet - One or more attributes to be retrieved from the table. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.

    Note that AttributesToGet has no effect on provisioned throughput consumption. DynamoDB determines capacity units consumed based on item size, not on the amount of data that is returned to an application.

  • ConsistentRead - If true, a strongly consistent read is used; if false (the default), an eventually consistent read is used.


BatchGetItemRequest

public BatchGetItemRequest(java.util.Map<java.lang.String,KeysAndAttributes> requestItems,
                           java.lang.String returnConsumedCapacity)
Constructs a new BatchGetItemRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
requestItems - A map of one or more table names and, for each table, the corresponding primary keys for the items to retrieve. Each table name can be invoked only once.

Each element in the map consists of the following:

  • Keys - An array of primary key attribute values that define specific items in the table.

  • AttributesToGet - One or more attributes to be retrieved from the table. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.

    Note that AttributesToGet has no effect on provisioned throughput consumption. DynamoDB determines capacity units consumed based on item size, not on the amount of data that is returned to an application.

  • ConsistentRead - If true, a strongly consistent read is used; if false (the default), an eventually consistent read is used.

returnConsumedCapacity - If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.

BatchGetItemRequest

public BatchGetItemRequest(java.util.Map<java.lang.String,KeysAndAttributes> requestItems,
                           ReturnConsumedCapacity returnConsumedCapacity)
Constructs a new BatchGetItemRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
requestItems - A map of one or more table names and, for each table, the corresponding primary keys for the items to retrieve. Each table name can be invoked only once.

Each element in the map consists of the following:

  • Keys - An array of primary key attribute values that define specific items in the table.

  • AttributesToGet - One or more attributes to be retrieved from the table. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.

    Note that AttributesToGet has no effect on provisioned throughput consumption. DynamoDB determines capacity units consumed based on item size, not on the amount of data that is returned to an application.

  • ConsistentRead - If true, a strongly consistent read is used; if false (the default), an eventually consistent read is used.

returnConsumedCapacity - If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.
Method Detail

getRequestItems

public java.util.Map<java.lang.String,KeysAndAttributes> getRequestItems()
A map of one or more table names and, for each table, the corresponding primary keys for the items to retrieve. Each table name can be invoked only once.

Each element in the map consists of the following:

Constraints:
Length: 1 - 100

Returns:
A map of one or more table names and, for each table, the corresponding primary keys for the items to retrieve. Each table name can be invoked only once.

Each element in the map consists of the following:

  • Keys - An array of primary key attribute values that define specific items in the table.

  • AttributesToGet - One or more attributes to be retrieved from the table. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.

    Note that AttributesToGet has no effect on provisioned throughput consumption. DynamoDB determines capacity units consumed based on item size, not on the amount of data that is returned to an application.

  • ConsistentRead - If true, a strongly consistent read is used; if false (the default), an eventually consistent read is used.


setRequestItems

public void setRequestItems(java.util.Map<java.lang.String,KeysAndAttributes> requestItems)
A map of one or more table names and, for each table, the corresponding primary keys for the items to retrieve. Each table name can be invoked only once.

Each element in the map consists of the following:

Constraints:
Length: 1 - 100

Parameters:
requestItems - A map of one or more table names and, for each table, the corresponding primary keys for the items to retrieve. Each table name can be invoked only once.

Each element in the map consists of the following:

  • Keys - An array of primary key attribute values that define specific items in the table.

  • AttributesToGet - One or more attributes to be retrieved from the table. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.

    Note that AttributesToGet has no effect on provisioned throughput consumption. DynamoDB determines capacity units consumed based on item size, not on the amount of data that is returned to an application.

  • ConsistentRead - If true, a strongly consistent read is used; if false (the default), an eventually consistent read is used.


withRequestItems

public BatchGetItemRequest withRequestItems(java.util.Map<java.lang.String,KeysAndAttributes> requestItems)
A map of one or more table names and, for each table, the corresponding primary keys for the items to retrieve. Each table name can be invoked only once.

Each element in the map consists of the following:

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 - 100

Parameters:
requestItems - A map of one or more table names and, for each table, the corresponding primary keys for the items to retrieve. Each table name can be invoked only once.

Each element in the map consists of the following:

  • Keys - An array of primary key attribute values that define specific items in the table.

  • AttributesToGet - One or more attributes to be retrieved from the table. By default, all attributes are returned. If a specified attribute is not found, it does not appear in the result.

    Note that AttributesToGet has no effect on provisioned throughput consumption. DynamoDB determines capacity units consumed based on item size, not on the amount of data that is returned to an application.

  • ConsistentRead - If true, a strongly consistent read is used; if false (the default), an eventually consistent read is used.

Returns:
A reference to this updated object so that method calls can be chained together.

addRequestItemsEntry

public BatchGetItemRequest addRequestItemsEntry(java.lang.String key,
                                                KeysAndAttributes value)
A map of one or more table names and, for each table, the corresponding primary keys for the items to retrieve. Each table name can be invoked only once.

Each element in the map consists of the following:

The method adds a new key-value pair into RequestItems parameter, and returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 - 100

Parameters:
key - The key of the entry to be added into RequestItems.
value - The corresponding value of the entry to be added into RequestItems.

clearRequestItemsEntries

public BatchGetItemRequest clearRequestItemsEntries()
Removes all the entries added into RequestItems.

Returns a reference to this object so that method calls can be chained together.


getReturnConsumedCapacity

public java.lang.String getReturnConsumedCapacity()
If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.

Constraints:
Allowed Values: INDEXES, TOTAL, NONE

Returns:
If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.
See Also:
ReturnConsumedCapacity

setReturnConsumedCapacity

public void setReturnConsumedCapacity(java.lang.String returnConsumedCapacity)
If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.

Constraints:
Allowed Values: INDEXES, TOTAL, NONE

Parameters:
returnConsumedCapacity - If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.
See Also:
ReturnConsumedCapacity

withReturnConsumedCapacity

public BatchGetItemRequest withReturnConsumedCapacity(java.lang.String returnConsumedCapacity)
If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: INDEXES, TOTAL, NONE

Parameters:
returnConsumedCapacity - If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.
Returns:
A reference to this updated object so that method calls can be chained together.
See Also:
ReturnConsumedCapacity

setReturnConsumedCapacity

public void setReturnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity)
If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.

Constraints:
Allowed Values: INDEXES, TOTAL, NONE

Parameters:
returnConsumedCapacity - If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.
See Also:
ReturnConsumedCapacity

withReturnConsumedCapacity

public BatchGetItemRequest withReturnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity)
If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: INDEXES, TOTAL, NONE

Parameters:
returnConsumedCapacity - If set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.
Returns:
A reference to this updated object so that method calls can be chained together.
See Also:
ReturnConsumedCapacity

toString

public java.lang.String toString()
Returns a string representation of this object; useful for testing and debugging.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this object.
See Also:
Object.toString()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.