Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for requester pays enabled buckets #694

Closed
Irishsmurf opened this issue Feb 5, 2015 · 3 comments
Closed

Support for requester pays enabled buckets #694

Irishsmurf opened this issue Feb 5, 2015 · 3 comments
Labels
feature-request A feature should be added or improved.

Comments

@Irishsmurf
Copy link

Hey,

Currently the S3Client doesn't have a switch to include the Request Payer header for downloads as defined here:

http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html

@trevorrowe
Copy link
Member

You are correct. We plan to expand the S3 client to support requester pays as a parameter, but until this happens, you can use a custom handler to add this functionality.

class RequesterPays < Seahorse::Client::Plugin
  handler(step: :initialize) do |context|
    if context.params.delete(:requester_pays)
      context.http_request.headers['x-amz-request-payer'] = 'requester'
    end
    @handler.call(context)
  end
end

# do this once, and all s3 clients will now accept `:requester_pays` to all operations
Aws::S3::Client.add_plugin(RequesterPays)

s3 = Aws::S3::Client.new
s3.put_object(bucket:'name', key:'key', body:'data', requester_pays:true)

@trevorrowe trevorrowe added feature-request A feature should be added or improved. Version 2 labels Feb 5, 2015
@sheldonh
Copy link

sheldonh commented Feb 9, 2015

Perfect, thanks!

@trevorrowe
Copy link
Member

The 88edf93 commit should add support to all of the appropriate object operations that support requester pays. This should go out with our next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

3 participants