Class Fog::AWS::DynamoDB::Real
In: lib/fog/aws/requests/dynamodb/update_item.rb
lib/fog/aws/requests/dynamodb/scan.rb
lib/fog/aws/requests/dynamodb/create_table.rb
lib/fog/aws/requests/dynamodb/update_table.rb
lib/fog/aws/requests/dynamodb/list_tables.rb
lib/fog/aws/requests/dynamodb/get_item.rb
lib/fog/aws/requests/dynamodb/query.rb
lib/fog/aws/requests/dynamodb/delete_item.rb
lib/fog/aws/requests/dynamodb/put_item.rb
lib/fog/aws/requests/dynamodb/batch_get_item.rb
lib/fog/aws/requests/dynamodb/batch_write_item.rb
lib/fog/aws/requests/dynamodb/delete_table.rb
lib/fog/aws/requests/dynamodb/describe_table.rb
lib/fog/aws/dynamodb.rb
Parent: Object

Methods

Included Modules

Fog::AWS::CredentialFetcher::ConnectionMethods

Classes and Modules

Class Fog::AWS::DynamoDB::Real::DeprecatedAttributeUpdates

Public Class methods

Initialize connection to DynamoDB

Notes

options parameter must include values for :aws_access_key_id and :aws_secret_access_key in order to create a connection

Examples

  ddb = DynamoDB.new(
    :aws_access_key_id => your_aws_access_key_id,
    :aws_secret_access_key => your_aws_secret_access_key
  )

Parameters

  • options<~Hash> - config arguments for connection. Defaults to {}.

Returns

  • DynamoDB object with connection to aws

Public Instance methods

Get DynamoDB items

Parameters

  • ‘request_items’<~Hash>:
    • ‘table_name’<~Hash>:
      • ‘Keys’<~Array>: array of keys

Returns

  • response<~Excon::Response>:
    • body<~Hash>:
      • ‘Responses’<~Hash>:
        • ‘table_name’<~Array> - array of all elements
      • ‘UnprocessedKeys’:<~Hash> - tables and keys in excess of per request limit, pass this to subsequent batch get for pseudo-pagination
      • ‘ConsumedCapacity’:<~Hash>:
        • ‘TableName’<~String> - the name of the table
        • ‘CapacityUnits’<~Float> - Capacity units used in read

See DynamoDB Documentation: docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchGetItem.html

request_items has form:

{"table_name"=>

 [{"PutRequest"=>
   {"Item"=>
      {"hi" => {"N" => 99}}
   }
 }]

}

See DynamoDB Documentation: docs.amazonwebservices.com/amazondynamodb/latest/developerguide/API_BatchWriteItems.html

Create DynamoDB table

Parameters

  • ‘table_name’<~String> - name of table to create
  • ‘key_schema’<~Array>:
      * 'AttributeName'<~String> - name of attribute
      * 'KeyType'<~String> - type of attribute, in %w{N NS S SS} for number, number set, string, string set
    
  • ‘ProvisionedThroughput’<~Hash>:
    • ‘ReadCapacityUnits’<~Integer> - read capacity for table, in 5..10000
    • ‘WriteCapacityUnits’<~Integer> - write capacity for table, in 5..10000

Returns

  • response<~Excon::Response>:
    • body<~Hash>:
      • ‘TableDescription’<~Hash>
        • ‘CreationDateTime’<~Float> - Unix epoch time of table creation
        • ‘KeySchema’<~Array> - schema for table
            * 'AttributeName'<~String> - name of attribute
            * 'KeyType'<~String> - type of attribute, in %w{N NS S SS} for number, number set, string, string set
          
        • ‘ProvisionedThroughput’<~Hash>:
          • ‘ReadCapacityUnits’<~Integer> - read capacity for table, in 5..10000
          • ‘WriteCapacityUnits’<~Integer> - write capacity for table, in 5..10000
        • ‘TableName’<~String> - name of table
        • ‘TableStatus’<~String> - status of table

See DynamoDB Documentation: docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateTable.html

Delete DynamoDB item

Parameters

  • ‘table_name’<~String> - name of table for item
  • ‘key’<~Hash> - hash of attributes

Returns

See DynamoDB Documentation: docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteItem.html

Delete DynamoDB table

Parameters

  • ‘table_name’<~String> - name of table to delete

Returns

  • response<~Excon::Response>:
    • body<~Hash>:
      • ‘TableDescription’<~Hash>
        • ‘ProvisionedThroughput’<~Hash>:
          • ‘ReadCapacityUnits’<~Integer> - read capacity for table, in 5..10000
          • ‘WriteCapacityUnits’<~Integer> - write capacity for table, in 5..10000
        • ‘TableName’<~String> - name of table
        • ‘TableStatus’<~String> - status of table

See DynamoDB Documentation: docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteTable.html

Describe DynamoDB table

Parameters

  • ‘table_name’<~String> - name of table to describe

Returns

  • response<~Excon::Response>:
    • body<~Hash>:
      • ‘Table’<~Hash>
        • ‘CreationDateTime’<~Float> - Unix epoch time of table creation
        • ‘KeySchema’<~Array> - schema for table
          • ‘AttributeName’<~String> - name of attribute
          • ‘KeyType’<~String> - type of attribute, in %w{N NS S SS} for number, number set, string, string set
        • ‘ProvisionedThroughput’<~Hash>:
          • ‘ReadCapacityUnits’<~Integer> - read capacity for table, in 5..10000
          • ‘WriteCapacityUnits’<~Integer> - write capacity for table, in 5..10000
        • ‘TableName’<~String> - name of table
        • ‘TableSizeBytes’<~Integer> - size of table in bytes
        • ‘TableStatus’<~String> - status of table

See DynamoDB Documentation: docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTable.html

Get DynamoDB item

Parameters

  • ‘table_name’<~String> - name of table for item
  • ‘key’<~Hash>:
      {
        "ForumName": {
          "S": "Amazon DynamoDB"
        }
      }
    
  • ‘options’<~Hash>:
    • ‘AttributesToGet’<~Array>: list of array names to return, defaults to returning all
    • ‘ConsistentRead’<~Boolean>: whether to wait for updates, defaults to false

Returns

  • response<~Excon::Response>:
    • body<~Hash>:
      • ‘ConsumedCapacityUnits’<~Float> - Capacity units used in read
      • ‘Item’:<~Hash>:
        • ‘AttributeName’<~Hash>: in form of {"type":value}

See DynamoDB Documentation: docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html

List DynamoDB tables

Parameters

  • ‘options’<~Hash> - options, defaults to {}
    • ‘ExclusiveStartTableName’<~String> - name of table to begin listing with
    • ‘Limit’<~Integer> - limit number of tables to return

Returns

  • response<~Excon::Response>:
    • body<~Hash>:
      • ‘LastEvaluatedTableName’<~String> - last table name, for pagination
      • ‘TableNames’<~Array> - table names

See DynamoDB Documentation: docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListTables.html

Update DynamoDB item

Parameters

  • ‘table_name’<~String> - name of table for item
  • ‘item’<~Hash>: data to update, must include primary key {
      "LastPostDateTime": {"S": "201303190422"}
    

    }

Returns

See DynamoDB Documentation: docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutItem.html

Query DynamoDB items

Parameters

  • ‘table_name’<~String> - name of table to query
  • options<~Hash>:
    • ‘AttributesToGet’<~Array> - Array of attributes to get for each item, defaults to all
    • ‘ConsistentRead’<~Boolean> - Whether to wait for consistency, defaults to false
    • ‘Count’<~Boolean> - If true, returns only a count of such items rather than items themselves, defaults to false
    • ‘Limit’<~Integer> - limit of total items to return
    • ‘KeyConditionExpression’<~String> - the condition elements need to match
    • ‘ExpressionAttributeValues’<~Hash> - values to be used in the key condition expression
    • ‘ScanIndexForward’<~Boolean>: Whether to scan from start or end of index, defaults to start
    • ‘ExclusiveStartKey’<~Hash>: Key to start listing from, can be taken from LastEvaluatedKey in response

Returns

  • response<~Excon::Response>:
    • body<~Hash>:
      • ‘ConsumedCapacityUnits’<~Integer> - number of capacity units used for query
      • ‘Count’<~Integer> - number of items in response
      • ‘Items’<~Array> - array of items returned
      • ‘LastEvaluatedKey’<~Hash> - last key scanned, can be passed to ExclusiveStartKey for pagination

See DynamoDB Documentation: docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html

Scan DynamoDB items

Parameters

  • ‘table_name’<~String> - name of table to query
  • options<~Hash>:
    • ‘AttributesToGet’<~Array> - Array of attributes to get for each item, defaults to all
    • ‘ConsistentRead’<~Boolean> - Whether to wait for consistency, defaults to false
    • ‘Count’<~Boolean> - If true, returns only a count of such items rather than items themselves, defaults to false
    • ‘Limit’<~Integer> - limit of total items to return
    • ‘KeyConditionExpression’<~String> - the condition elements need to match
    • ‘ExpressionAttributeValues’<~Hash> - values to be used in the key condition expression
    • ‘ScanIndexForward’<~Boolean>: Whether to scan from start or end of index, defaults to start
    • ‘ExclusiveStartKey’<~Hash>: Key to start listing from, can be taken from LastEvaluatedKey in response

Returns

  • response<~Excon::Response>:
    • body<~Hash>:
      • ‘ConsumedCapacityUnits’<~Integer> - number of capacity units used for scan
      • ‘Count’<~Integer> - number of items in response
      • ‘Items’<~Array> - array of items returned
      • ‘LastEvaluatedKey’<~Hash> - last key scanned, can be passed to ExclusiveStartKey for pagination
      • ‘ScannedCount’<~Integer> - number of items scanned before applying filters

See DynamoDB Documentation: docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html

Update DynamoDB item

Parameters

  • ‘table_name’<~String> - name of table for item
  • ‘key’<~Hash> - list of elements to be updated and their value {
      "ForumName": {"S": "Amazon DynamoDB"},
      "Subject": {"S": "Maximum number of items?"}
    

    }

  • ‘options’<~Hash>:
    • ‘KeyConditionExpression’<~String> - the condition elements need to match
    • ‘ExpressionAttributeValues’<~Hash> - values to be used in the key condition expression
    • ‘ReturnValues’<~String> - data to return in %w{ALL_NEW ALL_OLD NONE UPDATED_NEW UPDATED_OLD}, defaults to NONE

Returns

See DynamoDB Documentation: docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html

Update DynamoDB table throughput

Parameters

  • ‘table_name’<~String> - name of table to describe
  • ‘provisioned_throughput’<~Hash>:
    • ‘ReadCapacityUnits’<~Integer> - read capacity for table, in 5..10000
    • ‘WriteCapacityUnits’<~Integer> - write capacity for table, in 5..10000

Returns

  • response<~Excon::Response>:
    • body<~Hash>:
      • ‘Table’<~Hash>
        • ‘KeySchema’<~Array> - schema for table
            * 'AttributeName'<~String> - name of attribute
            * 'KeyType'<~String> - type of attribute, in %w{N NS S SS} for number, number set, string, string set
          
        • ‘ProvisionedThroughput’<~Hash>:
          • ‘ReadCapacityUnits’<~Integer> - read capacity for table, in 5..10000
          • ‘WriteCapacityUnits’<~Integer> - write capacity for table, in 5..10000
        • ‘TableName’<~String> - name of table
        • ‘TableStatus’<~String> - status of table

See DynamoDB Documentation: docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTable.html

[Validate]