Sha256: 59734eae638bebf0de0a1935cb86ab024cf5873ec0aac610b0043a6645151fbd

Contents?: true

Size: 1.93 KB

Versions: 36

Compression:

Stored size: 1.93 KB

Contents

module Fog
  module AWS
    class DynamoDB
      class Real
        # Query DynamoDB items
        #
        # ==== Parameters
        # * 'table_name'<~String> - name of table to query
        # * 'hash_key'<~Hash> - hash key 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
        #   * 'RangeKeyCondition'<~Hash>: value to compare against range key
        #     * 'AttributeValueList'<~Hash>: one or more values to compare against
        #     * 'ComparisonOperator'<~String>: comparison operator to use with attribute value list, in %w{BETWEEN BEGINS_WITH EQ LE LT GE GT}
        #   * '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
        def query(table_name, hash_key, options = {})
          body = {
            'TableName'     => table_name,
            'HashKeyValue'  => hash_key
          }.merge(options)

          request(
            :body     => Fog::JSON.encode(body),
            :headers  => {'x-amz-target' => 'DynamoDB_20111205.Query'}
          )
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 5 rubygems

Version Path
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-aws-0.7.5/lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.7.6 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.7.5 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.7.4 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.7.3 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.7.2 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.6.0 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.5.0 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.4.1 lib/fog/aws/requests/dynamodb/query.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.4.0 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.3.0 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.2.2 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.2.0 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.1.2 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.1.1 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.1.0 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.0.8 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.0.7 lib/fog/aws/requests/dynamodb/query.rb
fog-aws-0.0.6 lib/fog/aws/requests/dynamodb/query.rb