Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Commit

Permalink
Fixed an issue with #get_bucket_location.
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorrowe committed Jan 7, 2015
1 parent f2c947b commit 4a6ed7a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Unreleased Changes
------------------

* Issue - Aws::S3 - Resolved an issue with `Aws::S3::Client#get_bucket_location`.
Fixes GitHub issue #185.

* Upgrading - Aws::IAM - Moved `Aws::Role#update_assume_role_policy` to a
new resource class.

Expand Down
6 changes: 6 additions & 0 deletions aws-sdk-core/lib/aws-sdk-core/api/service_customizations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ def apply_protocol_plugin(client_class)
add_plugin 'Aws::Plugins::S3SseCpk'
add_plugin 'Aws::Plugins::S3UrlEncodedKeys'
add_plugin 'Aws::Plugins::S3RequestSigner'

# required for the GetBucketLocation fix to work, disabled normal
# parsing of the output
client_class.api.operation(:get_bucket_location).
instance_variable_set("@output", nil)

defs = client_class.waiters.instance_variable_get("@definitions")
defs[:bucket_exists]['ignore_errors'] = ['NotFound']
defs[:object_exists]['ignore_errors'] = ['NotFound']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ class Handler < Seahorse::Client::Handler

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 xml.key?('LocationConstraint')
constraint = xml['LocationConstraint']
if constraint = xml['LocationConstraint']
response.data[:location_constraint] =
case constraint
when String then constraint
when Hash then constraint['__content__'].to_s
when nil then ''
end
else
response.data[:location_constraint] = ''
end
end
end
Expand Down
3 changes: 1 addition & 2 deletions aws-sdk-core/lib/aws-sdk-core/rest_body_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ class RestBodyHandler < Seahorse::Client::Handler
def call(context)
context.http_request.body = build_body(context)
@handler.call(context).on_success do |response|
response.error = nil
response.data = extract_data(response.context)
response.data = extract_data(response.context) unless response.data
end
end

Expand Down

0 comments on commit 4a6ed7a

Please sign in to comment.