Class: Aws::DynamoDBStreams::Plugins::SimpleAttributes

Inherits:
Seahorse::Client::Plugin
  • Object
show all
Defined in:
lib/aws-sdk-dynamodbstreams/plugins/simple_attributes.rb

Overview

Simplifies working with Amazon DynamoDBStreams attribute values. Translates attribute values from responses to sensible Ruby natives.

This plugin is disabled by default for all Client objects. You can enable this plugin by passing ‘simple_attributes: false` to the client constructor:

ddb = Aws::DynamoDBStreams::Client.new(simple_attributes: true)

## Output Examples

With this plugin enabled, ‘simple_attributes: true`:

resp = dynamodbstreams.get_records(shard_iterator: iterator)
resp.records.first.dynamodb.new_image
{
  id: 'uuid',
  enabled: true,
  tags: #<Set: {"attributes", "simple"}>,
  data: #<StringIO:0x00007fe4061e6bc0>,
  scores: [0.1e1, 0.2e1, 0.3e1, nil],
  name: {
    first: 'John',
    last: 'Doe',
  }
}

With this plugin disabled, ‘simple_attributes: false`:

resp = dynamodbstreams.get_records(shard_iterator: iterator)
resp.records.first.dynamodb.new_image
{
  "id"=> <struct s='uuid', n=nil, b=nil, ss=nil, ns=nil, bs=nil, m=nil, l=nil, null=nil, bool=nil>
  "enabled"=> <struct s=nil, n=nil, b=nil, ss=nil, ns=nil, bs=nil, m=nil, l=nil, null=nil, bool=true>
  ...
}

Defined Under Namespace

Classes: Handler, ValueTranslator

Instance Method Summary collapse

Instance Method Details

#add_handlers(handlers, config) ⇒ Object



54
55
56
57
58
# File 'lib/aws-sdk-dynamodbstreams/plugins/simple_attributes.rb', line 54

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