Class: Aws::S3::Plugins::BucketARN

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

Overview

When an accesspoint ARN is provided for :bucket in S3 operations, this plugin resolves the request endpoint from the ARN when possible.

Defined Under Namespace

Classes: Handler

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.resolve_arn!(bucket_name, region, s3_use_arn_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.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/aws-sdk-s3/plugins/bucket_arn.rb', line 89

def resolve_arn!(bucket_name, region, s3_use_arn_region)
  if Aws::ARNParser.arn?(bucket_name)
    arn = Aws::ARNParser.parse(bucket_name)
    validate_s3_arn!(arn)
    validate_region!(arn, region, s3_use_arn_region)
    if arn.resource.start_with?('accesspoint')
      region = arn.region if s3_use_arn_region
      [bucket_name, region, arn]
    else
      raise ArgumentError,
        'Only accesspoint type ARNs are currently supported.'
    end
  else
    [bucket_name, region]
  end
end

.resolve_url!(url, arn, dualstack = false) ⇒ 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.



107
108
109
110
111
112
113
114
115
116
# File 'lib/aws-sdk-s3/plugins/bucket_arn.rb', line 107

def resolve_url!(url, arn, dualstack = false)
  if arn.resource.start_with?('accesspoint')
    url.host = accesspoint_arn_host(arn, dualstack)
  else
    raise ArgumentError,
      'Only accesspoint type ARNs are currently supported.'
  end
  url.path = url_path(url.path, arn)
  url
end

Instance Method Details

#add_handlers(handlers, _config) ⇒ Object



19
20
21
# File 'lib/aws-sdk-s3/plugins/bucket_arn.rb', line 19

def add_handlers(handlers, _config)
  handlers.add(Handler)
end