Class: Aws::S3::Plugins::ARN Private

Inherits:
Seahorse::Client::Plugin
  • Object
show all
Defined in:
lib/aws-sdk-s3/plugins/arn.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.

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: ARNHandler, UrlHandler

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

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



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/aws-sdk-s3/plugins/arn.rb', line 114

def resolve_arn!(member_value, region, use_arn_region)
  if Aws::ARNParser.arn?(member_value)
    arn = Aws::ARNParser.parse(member_value)
    if arn.resource.start_with?('accesspoint')
      s3_arn = Aws::S3::AccessPointARN.new(arn.to_h)
    elsif arn.resource.start_with?('outpost')
      s3_arn = Aws::S3::OutpostAccessPointARN.new(arn.to_h)
    else
      raise ArgumentError,
            'Only Access Point and Outpost Access Point type ARNs '\
            'are currently supported.'
    end
    s3_arn.validate_arn!
    validate_region_config!(s3_arn, region, use_arn_region)
    region = s3_arn.region if use_arn_region
    [region, s3_arn]
  else
    [region]
  end
end

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



136
137
138
139
140
141
# File 'lib/aws-sdk-s3/plugins/arn.rb', line 136

def resolve_url!(url, arn, region, dualstack = false, has_custom_endpoint = false)
  custom_endpoint = url.host if has_custom_endpoint
  url.host = arn.host_url(region, dualstack, custom_endpoint)
  url.path = url_path(url.path, arn)
  url
end

Instance Method Details

#add_handlers(handlers, _config) ⇒ 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.

param validator is validate:50 (required to add account_id from arn) endpoint is build:90 (populates the URI for the first time) endpoint pattern is build:10 (prefix account id to host)



28
29
30
31
# File 'lib/aws-sdk-s3/plugins/arn.rb', line 28

def add_handlers(handlers, _config)
  handlers.add(ARNHandler, step: :validate, priority: 75)
  handlers.add(UrlHandler)
end