Class: Aws::Plugins::S3GetBucketLocationFix::Handler

Inherits:
Seahorse::Client::Handler show all
Defined in:
aws-sdk-core/lib/aws-sdk-core/plugins/s3_get_bucket_location_fix.rb

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Handler

#handler

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Handler

#initialize, #inspect

Constructor Details

This class inherits a constructor from Seahorse::Client::Handler

Instance Method Details

#call(context) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'aws-sdk-core/lib/aws-sdk-core/plugins/s3_get_bucket_location_fix.rb', line 7

def call(context)
  @handler.call(context).on(200) do |response|
    response.data = Structure.new([:location_constraint])
    xml = MultiXml.parse(context.http_response.body_contents)
    if constraint = xml['LocationConstraint']
      response.data[:location_constraint] =
        case constraint
        when String then constraint
        when Hash then constraint['__content__'].to_s
        end
    else
      response.data[:location_constraint] = ''
    end
  end
end