A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.aws.amazon.com/sdkforruby/api/Aws/Plugins/DynamoDBSimpleAttributes.html below:

DynamoDBSimpleAttributes — AWS SDK for Ruby V2

You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::Plugins::DynamoDBSimpleAttributes Overview

Simplifies working with Amazon DynamoDB attribute values. Translates attribute values for requests and responses to sensible Ruby natives.

This plugin is enabled by default for all DynamoDB::Client objects. You can disable this plugin by passing simple_attributes: false to the client constructor:

ddb = Aws::DynamoDB::Client.new(simple_attributes: false)
Input Examples

With this plugin enabled, simple_attributes: true:

dynamodb.put_item(
  table_name: 'aws-sdk',
  item: {
    id: 'uuid',
    age: 35,
    tags: Set.new(%w(simple attributes)),
    data: StringIO.new('data'),
    scores: [5, 4.5, 4.9, nil],
    name: {
      first: 'John',
      last: 'Doe',
    }
  }
)

With this plugin disabled, simple_attributes: false:

dynamodb.put_item(
  table_name: 'aws-sdk',
  item: {
    'id' => { s: 'uuid' },
    'age' => { n: '35' },
    'tags' => { ss: ['simple', 'attributes'] },
    'data' => { b: 'data' },
    'scores' => {
      l: [
        { n: '5' },
        { n: '4.5' },
        { n: '4.9' },
        { null: true },
      ]
    },
    'name' => {
      m: {
        'first' => { s: 'John' },
        'last' => { s: 'Doe' },
      }
    }
  }
)
Output Examples

With this plugin enabled, simple_attributes: true:

resp = dynamodb.get(table_name: 'aws-sdk', key: { id: 'uuid' })
resp.item
{
  id: 'uuid',
  age: 35,
  tags: Set.new(%w(simple attributes)),
  data: StringIO.new('data'),
  scores: [5, 4.5, 4.9, nil],
  name: {
    first: 'John',
    last: 'Doe',
  }
}

With this plugin disabled, simple_attributes: false:

resp = dynamodb.get(table_name: 'aws-sdk', key: { 'id' => { s: 'uuid' }})
resp.item
Defined Under Namespace

Classes: Handler

Attribute Summary collapse Instance Method Summary collapse Methods inherited from Seahorse::Client::Plugin

#add_options, #after_initialize, after_initialize, #before_initialize, before_initialize, option

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Instance Method Details #add_handlers(handlers, config) ⇒ Object
102
103
104
105
106
# File 'aws-sdk-core/lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb', line 102

def add_handlers(handlers, config)
  if config.simple_attributes
    handlers.add(Handler, step: :initialize)
  end
end

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4