Class: Aws::S3::Plugins::S3Signer Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This plugin is an implementation detail and may be modified.

Defined Under Namespace

Classes: BucketRegionErrorHandler, CachedBucketRegionHandler, LegacyHandler, V4Handler

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build_v4_signer(options = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :region (required, String)
  • :credentials (required, #credentials)


189
190
191
192
193
194
195
196
197
# File 'lib/aws-sdk-s3/plugins/s3_signer.rb', line 189

def build_v4_signer(options = {})
  Aws::Sigv4::Signer.new({
    service: 's3',
    region: options[:region],
    credentials_provider: options[:credentials],
    uri_escape_path: false,
    unsigned_headers: ['content-length', 'x-amzn-trace-id'],
  })
end

.new_hostname(context, region) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



199
200
201
202
203
204
205
206
207
# File 'lib/aws-sdk-s3/plugins/s3_signer.rb', line 199

def new_hostname(context, region)
  bucket = context.params[:bucket]
  if region == 'us-east-1'
    "#{bucket}.s3.amazonaws.com"
  else
    endpoint = Aws::Partitions::EndpointProvider.resolve(region, 's3')
    bucket + '.' + URI.parse(endpoint).host
  end
end

Instance Method Details

#add_handlers(handlers, cfg) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



23
24
25
26
27
28
29
30
31
# File 'lib/aws-sdk-s3/plugins/s3_signer.rb', line 23

def add_handlers(handlers, cfg)
  case cfg.signature_version
  when 'v4' then add_v4_handlers(handlers)
  when 's3' then add_legacy_handler(handlers)
  else
    msg = "unsupported signature version `#{cfg.signature_version}'"
    raise ArgumentError, msg
  end
end

#add_legacy_handler(handlers) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



39
40
41
# File 'lib/aws-sdk-s3/plugins/s3_signer.rb', line 39

def add_legacy_handler(handlers)
  handlers.add(LegacyHandler, step: :sign)
end

#add_v4_handlers(handlers) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
36
37
# File 'lib/aws-sdk-s3/plugins/s3_signer.rb', line 33

def add_v4_handlers(handlers)
  handlers.add(CachedBucketRegionHandler, step: :sign, priority: 60)
  handlers.add(V4Handler, step: :sign)
  handlers.add(BucketRegionErrorHandler, step: :sign, priority: 40)
end