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 = {})
-
(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.metric('RESOURCE_MODEL') do @client.batch_get_item(options) end resp.data end
def batch_write_item(options = {})
-
(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.metric('RESOURCE_MODEL') do @client.batch_write_item(options) end resp.data end
def client
-
(Client)-
def client @client end
def create_table(options = {})
-
(Table)-
Options Hash:
(**options)-
:on_demand_throughput(Types::OnDemandThroughput) -- -
:resource_policy(String) -- -
:warm_throughput(Types::WarmThroughput) -- -
: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.metric('RESOURCE_MODEL') 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)-
:client(Client) --
Parameters:
-
options({}) --
def initialize(options = {}) @client = options[:client] || Client.new(options) end
def table(name)
-
(Table)-
Parameters:
-
name(String) --
def table(name) Table.new( name: name, client: @client ) end
def tables(options = {})
-
(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.metric('RESOURCE_MODEL') 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