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

Inherits:
Seahorse::Client::Plugin show all
Defined in:
gems/aws-sdk-dynamodbstreams/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

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



54
55
56
57
58
# File 'gems/aws-sdk-dynamodbstreams/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