class Aws::DynamoDB::Resource


resource = Aws::DynamoDB::Resource.new(client: client)
client = Aws::DynamoDB::Client.new(region: ‘us-west-2’)
If you do not pass ‘:client`, a default client will be constructed.
You can supply a client object with custom configuration that will be used for all resource operations.
resource = Aws::DynamoDB::Resource.new(region: ’us-west-2’)
To create a resource object:
This class provides a resource oriented interface for DynamoDB.

def batch_get_item(options = {})

Returns:
  • (Types::BatchGetItemOutput) -

Options Hash: (**options)
  • :return_consumed_capacity (String) --
  • :request_items (required, Hash) --

Parameters:
  • options (Hash) -- ({})

Other tags:
    Example: Request syntax with placeholder values -
def batch_get_item(options = {})
  resp = Aws::Plugins::UserAgent.feature('resource') do
    @client.batch_get_item(options)
  end
  resp.data
end

def batch_write_item(options = {})

Returns:
  • (Types::BatchWriteItemOutput) -

Options Hash: (**options)
  • :return_item_collection_metrics (String) --
  • :return_consumed_capacity (String) --
  • :request_items (required, Hash) --

Parameters:
  • options (Hash) -- ({})

Other tags:
    Example: Request syntax with placeholder values -
def batch_write_item(options = {})
  resp = Aws::Plugins::UserAgent.feature('resource') do
    @client.batch_write_item(options)
  end
  resp.data
end

def client

Returns:
  • (Client) -
def client
  @client
end

def create_table(options = {})

Returns:
  • (Table) -

Options Hash: (**options)
  • :deletion_protection_enabled (Boolean) --
  • :table_class (String) --
  • :tags (Array) --
  • :sse_specification (Types::SSESpecification) --
  • :stream_specification (Types::StreamSpecification) --
  • :provisioned_throughput (Types::ProvisionedThroughput) --
  • :billing_mode (String) --
  • :global_secondary_indexes (Array) --
  • :local_secondary_indexes (Array) --
  • :key_schema (required, Array) --
  • :table_name (required, String) --
  • :attribute_definitions (required, Array) --

Parameters:
  • options (Hash) -- ({})

Other tags:
    Example: Request syntax with placeholder values -
def create_table(options = {})
  resp = Aws::Plugins::UserAgent.feature('resource') do
    @client.create_table(options)
  end
  Table.new(
    name: resp.data.table_description.table_name,
    data: resp.data.table_description,
    client: @client
  )
end

def initialize(options = {})

Options Hash: (**options)
  • :client (Client) --

Parameters:
  • options ({}) --
def initialize(options = {})
  @client = options[:client] || Client.new(options)
end

def table(name)

Returns:
  • (Table) -

Parameters:
  • name (String) --
def table(name)
  Table.new(
    name: name,
    client: @client
  )
end

def tables(options = {})

Returns:
  • (Table::Collection) -

Parameters:
  • options (Hash) -- ({})

Other tags:
    Example: Request syntax with placeholder values -
def tables(options = {})
  batches = Enumerator.new do |y|
    resp = Aws::Plugins::UserAgent.feature('resource') do
      @client.list_tables(options)
    end
    resp.each_page do |page|
      batch = []
      page.data.table_names.each do |t|
        batch << Table.new(
          name: t,
          client: @client
        )
      end
      y.yield(batch)
    end
  end
  Table::Collection.new(batches)
end