aws-sdk-s3 1.87.0 → 1.143.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1106 -0
- data/LICENSE.txt +202 -0
- data/VERSION +1 -0
- data/lib/aws-sdk-s3/bucket.rb +605 -114
- data/lib/aws-sdk-s3/bucket_acl.rb +36 -11
- data/lib/aws-sdk-s3/bucket_cors.rb +40 -15
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +42 -15
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +43 -13
- data/lib/aws-sdk-s3/bucket_logging.rb +40 -11
- data/lib/aws-sdk-s3/bucket_notification.rb +30 -12
- data/lib/aws-sdk-s3/bucket_policy.rb +82 -13
- data/lib/aws-sdk-s3/bucket_request_payment.rb +35 -13
- data/lib/aws-sdk-s3/bucket_tagging.rb +38 -13
- data/lib/aws-sdk-s3/bucket_versioning.rb +82 -21
- data/lib/aws-sdk-s3/bucket_website.rb +38 -13
- data/lib/aws-sdk-s3/client.rb +8666 -3425
- data/lib/aws-sdk-s3/client_api.rb +774 -225
- data/lib/aws-sdk-s3/customizations/bucket.rb +31 -50
- data/lib/aws-sdk-s3/customizations/errors.rb +27 -0
- data/lib/aws-sdk-s3/customizations/object.rb +211 -37
- data/lib/aws-sdk-s3/customizations/types/permanent_redirect.rb +26 -0
- data/lib/aws-sdk-s3/customizations.rb +7 -0
- data/lib/aws-sdk-s3/encryption/client.rb +7 -3
- data/lib/aws-sdk-s3/encryption/decrypt_handler.rb +0 -4
- data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +13 -9
- data/lib/aws-sdk-s3/encryptionV2/client.rb +7 -3
- data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +1 -4
- data/lib/aws-sdk-s3/encryptionV2/default_cipher_provider.rb +3 -3
- data/lib/aws-sdk-s3/encryptionV2/encrypt_handler.rb +0 -4
- data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +10 -6
- data/lib/aws-sdk-s3/endpoint_parameters.rb +178 -0
- data/lib/aws-sdk-s3/endpoint_provider.rb +591 -0
- data/lib/aws-sdk-s3/endpoints.rb +2590 -0
- data/lib/aws-sdk-s3/errors.rb +1 -1
- data/lib/aws-sdk-s3/event_streams.rb +1 -1
- data/lib/aws-sdk-s3/express_credentials.rb +55 -0
- data/lib/aws-sdk-s3/express_credentials_cache.rb +30 -0
- data/lib/aws-sdk-s3/express_credentials_provider.rb +36 -0
- data/lib/aws-sdk-s3/file_downloader.rb +171 -41
- data/lib/aws-sdk-s3/file_uploader.rb +14 -7
- data/lib/aws-sdk-s3/multipart_file_uploader.rb +26 -8
- data/lib/aws-sdk-s3/multipart_stream_uploader.rb +41 -14
- data/lib/aws-sdk-s3/multipart_upload.rb +198 -23
- data/lib/aws-sdk-s3/multipart_upload_part.rb +285 -34
- data/lib/aws-sdk-s3/object.rb +1824 -266
- data/lib/aws-sdk-s3/object_acl.rb +58 -19
- data/lib/aws-sdk-s3/object_copier.rb +7 -5
- data/lib/aws-sdk-s3/object_multipart_copier.rb +41 -19
- data/lib/aws-sdk-s3/object_summary.rb +1579 -299
- data/lib/aws-sdk-s3/object_version.rb +372 -64
- data/lib/aws-sdk-s3/plugins/accelerate.rb +1 -39
- data/lib/aws-sdk-s3/plugins/arn.rb +25 -142
- data/lib/aws-sdk-s3/plugins/bucket_dns.rb +3 -39
- data/lib/aws-sdk-s3/plugins/bucket_name_restrictions.rb +1 -6
- data/lib/aws-sdk-s3/plugins/dualstack.rb +2 -49
- data/lib/aws-sdk-s3/plugins/endpoints.rb +274 -0
- data/lib/aws-sdk-s3/plugins/expect_100_continue.rb +3 -1
- data/lib/aws-sdk-s3/plugins/express_session_auth.rb +91 -0
- data/lib/aws-sdk-s3/plugins/get_bucket_location_fix.rb +1 -1
- data/lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb +8 -31
- data/lib/aws-sdk-s3/plugins/location_constraint.rb +3 -1
- data/lib/aws-sdk-s3/plugins/md5s.rb +6 -3
- data/lib/aws-sdk-s3/plugins/s3_signer.rb +35 -102
- data/lib/aws-sdk-s3/plugins/skip_whole_multipart_get_checksums.rb +31 -0
- data/lib/aws-sdk-s3/plugins/streaming_retry.rb +23 -2
- data/lib/aws-sdk-s3/presigned_post.rb +99 -78
- data/lib/aws-sdk-s3/presigner.rb +43 -51
- data/lib/aws-sdk-s3/resource.rb +102 -6
- data/lib/aws-sdk-s3/types.rb +7404 -5114
- data/lib/aws-sdk-s3/waiters.rb +1 -1
- data/lib/aws-sdk-s3.rb +6 -2
- data/sig/bucket.rbs +212 -0
- data/sig/bucket_acl.rbs +78 -0
- data/sig/bucket_cors.rbs +69 -0
- data/sig/bucket_lifecycle.rbs +88 -0
- data/sig/bucket_lifecycle_configuration.rbs +111 -0
- data/sig/bucket_logging.rbs +76 -0
- data/sig/bucket_notification.rbs +114 -0
- data/sig/bucket_policy.rbs +59 -0
- data/sig/bucket_request_payment.rbs +54 -0
- data/sig/bucket_tagging.rbs +65 -0
- data/sig/bucket_versioning.rbs +77 -0
- data/sig/bucket_website.rbs +93 -0
- data/sig/client.rbs +2360 -0
- data/sig/errors.rbs +34 -0
- data/sig/multipart_upload.rbs +110 -0
- data/sig/multipart_upload_part.rbs +105 -0
- data/sig/object.rbs +436 -0
- data/sig/object_acl.rbs +86 -0
- data/sig/object_summary.rbs +334 -0
- data/sig/object_version.rbs +131 -0
- data/sig/resource.rbs +124 -0
- data/sig/types.rbs +2562 -0
- data/sig/waiters.rbs +83 -0
- metadata +51 -17
- data/lib/aws-sdk-s3/arn/access_point_arn.rb +0 -62
- data/lib/aws-sdk-s3/arn/outpost_access_point_arn.rb +0 -71
@@ -23,20 +23,16 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/
|
|
23
23
|
operations = config.api.operation_names - [
|
24
24
|
:create_bucket, :list_buckets, :delete_bucket
|
25
25
|
]
|
26
|
-
# Need 2 handlers so that the context can be set for other plugins
|
27
|
-
# and to remove :use_accelerate_endpoint from the params.
|
28
26
|
handlers.add(
|
29
27
|
OptionHandler, step: :initialize, operations: operations
|
30
28
|
)
|
31
|
-
handlers.add(
|
32
|
-
AccelerateHandler, step: :build, priority: 0, operations: operations
|
33
|
-
)
|
34
29
|
end
|
35
30
|
|
36
31
|
# @api private
|
37
32
|
class OptionHandler < Seahorse::Client::Handler
|
38
33
|
def call(context)
|
39
34
|
# Support client configuration and per-operation configuration
|
35
|
+
# TODO: move this to an options hash and warn here.
|
40
36
|
if context.params.is_a?(Hash)
|
41
37
|
accelerate = context.params.delete(:use_accelerate_endpoint)
|
42
38
|
end
|
@@ -47,40 +43,6 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/
|
|
47
43
|
@handler.call(context)
|
48
44
|
end
|
49
45
|
end
|
50
|
-
|
51
|
-
# @api private
|
52
|
-
class AccelerateHandler < Seahorse::Client::Handler
|
53
|
-
def call(context)
|
54
|
-
if context[:use_accelerate_endpoint]
|
55
|
-
dualstack = !!context[:use_dualstack_endpoint]
|
56
|
-
use_accelerate_endpoint(context, dualstack)
|
57
|
-
end
|
58
|
-
@handler.call(context)
|
59
|
-
end
|
60
|
-
|
61
|
-
private
|
62
|
-
|
63
|
-
def use_accelerate_endpoint(context, dualstack)
|
64
|
-
bucket_name = context.params[:bucket]
|
65
|
-
validate_bucket_name!(bucket_name)
|
66
|
-
endpoint = URI.parse(context.http_request.endpoint.to_s)
|
67
|
-
endpoint.scheme = 'https'
|
68
|
-
endpoint.port = 443
|
69
|
-
endpoint.host = "#{bucket_name}.s3-accelerate"\
|
70
|
-
"#{'.dualstack' if dualstack}.amazonaws.com"
|
71
|
-
context.http_request.endpoint = endpoint.to_s
|
72
|
-
# s3 accelerate endpoint doesn't work with 'expect' header
|
73
|
-
context.http_request.headers.delete('expect')
|
74
|
-
end
|
75
|
-
|
76
|
-
def validate_bucket_name!(bucket_name)
|
77
|
-
unless BucketDns.dns_compatible?(bucket_name, _ssl = true)
|
78
|
-
raise ArgumentError,
|
79
|
-
'Unable to use `use_accelerate_endpoint: true` on buckets '\
|
80
|
-
'with non-DNS compatible names.'
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
46
|
end
|
85
47
|
end
|
86
48
|
end
|
@@ -1,8 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative '../arn/access_point_arn'
|
4
|
-
require_relative '../arn/outpost_access_point_arn'
|
5
|
-
|
6
3
|
module Aws
|
7
4
|
module S3
|
8
5
|
module Plugins
|
@@ -22,106 +19,19 @@ be made. Set to `false` to use the client's region instead.
|
|
22
19
|
resolve_s3_use_arn_region(cfg)
|
23
20
|
end
|
24
21
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
context.config.region,
|
36
|
-
context.config.s3_use_arn_region
|
37
|
-
)
|
38
|
-
if arn
|
39
|
-
validate_config!(context, arn)
|
40
|
-
|
41
|
-
ARN.resolve_url!(
|
42
|
-
context.http_request.endpoint,
|
43
|
-
arn,
|
44
|
-
resolved_region,
|
45
|
-
extract_dualstack_config!(context)
|
46
|
-
)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
@handler.call(context)
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
def _bucket_member(input)
|
55
|
-
input.members.each do |member, ref|
|
56
|
-
return member if ref.shape.name == 'BucketName'
|
57
|
-
end
|
58
|
-
nil
|
59
|
-
end
|
60
|
-
|
61
|
-
# other plugins use dualstack so disable it when we're done
|
62
|
-
def extract_dualstack_config!(context)
|
63
|
-
dualstack = context[:use_dualstack_endpoint]
|
64
|
-
context[:use_dualstack_endpoint] = false if dualstack
|
65
|
-
dualstack
|
66
|
-
end
|
67
|
-
|
68
|
-
def validate_config!(context, arn)
|
69
|
-
unless context.config.regional_endpoint
|
70
|
-
raise ArgumentError,
|
71
|
-
'Cannot provide both an Access Point ARN and setting '\
|
72
|
-
':endpoint.'
|
73
|
-
end
|
74
|
-
|
75
|
-
if context.config.force_path_style
|
76
|
-
raise ArgumentError,
|
77
|
-
'Cannot provide both an Access Point ARN and setting '\
|
78
|
-
':force_path_style to true.'
|
79
|
-
end
|
80
|
-
|
81
|
-
if context.config.use_accelerate_endpoint
|
82
|
-
raise ArgumentError,
|
83
|
-
'Cannot provide both an Access Point ARN and setting '\
|
84
|
-
':use_accelerate_endpoint to true.'
|
85
|
-
end
|
86
|
-
|
87
|
-
if !arn.support_dualstack? && context[:use_dualstack_endpoint]
|
88
|
-
raise ArgumentError,
|
89
|
-
'Cannot provide both an Outpost Access Point ARN and '\
|
90
|
-
'setting :use_dualstack_endpoint to true.'
|
91
|
-
end
|
92
|
-
end
|
22
|
+
option(
|
23
|
+
:s3_disable_multiregion_access_points,
|
24
|
+
default: false,
|
25
|
+
doc_type: 'Boolean',
|
26
|
+
docstring: <<-DOCS) do |cfg|
|
27
|
+
When set to `false` this will option will raise errors when multi-region
|
28
|
+
access point ARNs are used. Multi-region access points can potentially
|
29
|
+
result in cross region requests.
|
30
|
+
DOCS
|
31
|
+
resolve_s3_disable_multiregion_access_points(cfg)
|
93
32
|
end
|
94
33
|
|
95
34
|
class << self
|
96
|
-
# @api private
|
97
|
-
def resolve_arn!(member_value, region, use_arn_region)
|
98
|
-
if Aws::ARNParser.arn?(member_value)
|
99
|
-
arn = Aws::ARNParser.parse(member_value)
|
100
|
-
if arn.resource.start_with?('accesspoint')
|
101
|
-
s3_arn = Aws::S3::AccessPointARN.new(arn.to_h)
|
102
|
-
elsif arn.resource.start_with?('outpost')
|
103
|
-
s3_arn = Aws::S3::OutpostAccessPointARN.new(arn.to_h)
|
104
|
-
else
|
105
|
-
raise ArgumentError,
|
106
|
-
'Only Access Point and Outpost Access Point type ARNs '\
|
107
|
-
'are currently supported.'
|
108
|
-
end
|
109
|
-
s3_arn.validate_arn!
|
110
|
-
validate_region_config!(s3_arn, region, use_arn_region)
|
111
|
-
region = s3_arn.region if use_arn_region
|
112
|
-
[region, s3_arn]
|
113
|
-
else
|
114
|
-
[region]
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
# @api private
|
119
|
-
def resolve_url!(url, arn, region, dualstack = false)
|
120
|
-
url.host = arn.host_url(region, dualstack)
|
121
|
-
url.path = url_path(url.path, arn)
|
122
|
-
url
|
123
|
-
end
|
124
|
-
|
125
35
|
private
|
126
36
|
|
127
37
|
def resolve_s3_use_arn_region(cfg)
|
@@ -132,53 +42,26 @@ be made. Set to `false` to use the client's region instead.
|
|
132
42
|
# Raise if provided value is not true or false
|
133
43
|
if value.nil?
|
134
44
|
raise ArgumentError,
|
135
|
-
'Must provide either `true` or `false` for '\
|
136
|
-
's3_use_arn_region profile option or for '\
|
137
|
-
"ENV['AWS_S3_USE_ARN_REGION']"
|
45
|
+
'Must provide either `true` or `false` for the '\
|
46
|
+
'`s3_use_arn_region` profile option or for '\
|
47
|
+
"ENV['AWS_S3_USE_ARN_REGION']."
|
138
48
|
end
|
139
49
|
value
|
140
50
|
end
|
141
51
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
# s3-external-1 is specific just to s3 and not part of partitions
|
155
|
-
# aws-global is a partition region
|
156
|
-
unless arn.partition == 'aws' &&
|
157
|
-
(region == 's3-external-1' || region == 'aws-global')
|
158
|
-
if !fips && arn.region.include?('fips')
|
159
|
-
raise ArgumentError,
|
160
|
-
'FIPS region ARNs are not supported for this type of ARN.'
|
161
|
-
end
|
162
|
-
|
163
|
-
if !fips && !use_arn_region && region.include?('fips')
|
164
|
-
raise ArgumentError,
|
165
|
-
'FIPS client regions are not supported for this type of '\
|
166
|
-
'ARN without s3_use_arn_region.'
|
167
|
-
end
|
168
|
-
|
169
|
-
# if it's a fips region, attempt to normalize it
|
170
|
-
if fips || use_arn_region
|
171
|
-
region = region.gsub('fips-', '').gsub('-fips', '')
|
172
|
-
end
|
173
|
-
if use_arn_region &&
|
174
|
-
!Aws::Partitions.partition(arn.partition).region?(region)
|
175
|
-
raise Aws::Errors::InvalidARNPartitionError
|
176
|
-
end
|
177
|
-
|
178
|
-
if !use_arn_region && region != arn.region
|
179
|
-
raise Aws::Errors::InvalidARNRegionError
|
180
|
-
end
|
52
|
+
def resolve_s3_disable_multiregion_access_points(cfg)
|
53
|
+
value = ENV['AWS_S3_DISABLE_MULTIREGION_ACCESS_POINTS'] ||
|
54
|
+
Aws.shared_config.s3_disable_multiregion_access_points(profile: cfg.profile) ||
|
55
|
+
'false'
|
56
|
+
value = Aws::Util.str_2_bool(value)
|
57
|
+
# Raise if provided value is not true or false
|
58
|
+
if value.nil?
|
59
|
+
raise ArgumentError,
|
60
|
+
'Must provide either `true` or `false` for '\
|
61
|
+
's3_use_arn_region profile option or for '\
|
62
|
+
"ENV['AWS_S3_USE_ARN_REGION']"
|
181
63
|
end
|
64
|
+
value
|
182
65
|
end
|
183
66
|
end
|
184
67
|
end
|
@@ -23,45 +23,10 @@ When set to `true`, the bucket name is always left in the
|
|
23
23
|
request URI and never moved to the host as a sub-domain.
|
24
24
|
DOCS
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
# @api private
|
31
|
-
class Handler < Seahorse::Client::Handler
|
32
|
-
|
33
|
-
def call(context)
|
34
|
-
move_dns_compat_bucket_to_subdomain(context)
|
35
|
-
@handler.call(context)
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def move_dns_compat_bucket_to_subdomain(context)
|
41
|
-
bucket_name = context.params[:bucket]
|
42
|
-
endpoint = context.http_request.endpoint
|
43
|
-
if bucket_name &&
|
44
|
-
BucketDns.dns_compatible?(bucket_name, https?(endpoint)) &&
|
45
|
-
context.operation_name.to_s != 'get_bucket_location'
|
46
|
-
move_bucket_to_subdomain(bucket_name, endpoint)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def move_bucket_to_subdomain(bucket_name, endpoint)
|
51
|
-
endpoint.host = "#{bucket_name}.#{endpoint.host}"
|
52
|
-
path = endpoint.path.sub("/#{bucket_name}", '')
|
53
|
-
path = "/#{path}" unless path.match(/^\//)
|
54
|
-
endpoint.path = path
|
55
|
-
end
|
56
|
-
|
57
|
-
def https?(uri)
|
58
|
-
uri.scheme == 'https'
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
26
|
+
# These class methods were originally used in a handler in this plugin.
|
27
|
+
# SigV2 legacy signer needs this logic so we keep it here as utility.
|
28
|
+
# New endpoint resolution will check this as a matcher.
|
63
29
|
class << self
|
64
|
-
|
65
30
|
# @param [String] bucket_name
|
66
31
|
# @param [Boolean] ssl
|
67
32
|
# @return [Boolean]
|
@@ -81,7 +46,6 @@ request URI and never moved to the host as a sub-domain.
|
|
81
46
|
bucket_name !~ /(\d+\.){3}\d+/ &&
|
82
47
|
bucket_name !~ /[.-]{2}/
|
83
48
|
end
|
84
|
-
|
85
49
|
end
|
86
50
|
end
|
87
51
|
end
|
@@ -13,12 +13,7 @@ module Aws
|
|
13
13
|
def call(context)
|
14
14
|
bucket_member = _bucket_member(context.operation.input.shape)
|
15
15
|
if bucket_member && (bucket = context.params[bucket_member])
|
16
|
-
|
17
|
-
bucket,
|
18
|
-
context.config.region,
|
19
|
-
context.config.s3_use_arn_region
|
20
|
-
)
|
21
|
-
if !arn && bucket.include?('/')
|
16
|
+
if !Aws::ARNParser.arn?(bucket) && bucket.include?('/')
|
22
17
|
raise ArgumentError,
|
23
18
|
'bucket name must not contain a forward-slash (/)'
|
24
19
|
end
|
@@ -5,23 +5,14 @@ module Aws
|
|
5
5
|
module Plugins
|
6
6
|
# @api private
|
7
7
|
class Dualstack < Seahorse::Client::Plugin
|
8
|
-
|
9
|
-
option(:use_dualstack_endpoint,
|
10
|
-
default: false,
|
11
|
-
doc_type: 'Boolean',
|
12
|
-
docstring: <<-DOCS)
|
13
|
-
When set to `true`, IPv6-compatible bucket endpoints will be used
|
14
|
-
for all operations.
|
15
|
-
DOCS
|
16
|
-
|
17
|
-
def add_handlers(handlers, config)
|
8
|
+
def add_handlers(handlers, _config)
|
18
9
|
handlers.add(OptionHandler, step: :initialize)
|
19
|
-
handlers.add(DualstackHandler, step: :build, priority: 0)
|
20
10
|
end
|
21
11
|
|
22
12
|
# @api private
|
23
13
|
class OptionHandler < Seahorse::Client::Handler
|
24
14
|
def call(context)
|
15
|
+
# Support client configuration and per-operation configuration
|
25
16
|
if context.params.is_a?(Hash)
|
26
17
|
dualstack = context.params.delete(:use_dualstack_endpoint)
|
27
18
|
end
|
@@ -30,44 +21,6 @@ for all operations.
|
|
30
21
|
@handler.call(context)
|
31
22
|
end
|
32
23
|
end
|
33
|
-
|
34
|
-
# @api private
|
35
|
-
class DualstackHandler < Seahorse::Client::Handler
|
36
|
-
def call(context)
|
37
|
-
apply_dualstack_endpoint(context) if use_dualstack_endpoint?(context)
|
38
|
-
@handler.call(context)
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
def apply_dualstack_endpoint(context)
|
43
|
-
bucket_name = context.params[:bucket]
|
44
|
-
region = context.config.region
|
45
|
-
context.config.force_path_style
|
46
|
-
dns_suffix = Aws::Partitions::EndpointProvider.dns_suffix_for(region)
|
47
|
-
|
48
|
-
if use_bucket_dns?(bucket_name, context)
|
49
|
-
host = "#{bucket_name}.s3.dualstack.#{region}.#{dns_suffix}"
|
50
|
-
else
|
51
|
-
host = "s3.dualstack.#{region}.#{dns_suffix}"
|
52
|
-
end
|
53
|
-
endpoint = URI.parse(context.http_request.endpoint.to_s)
|
54
|
-
endpoint.scheme = context.http_request.endpoint.scheme
|
55
|
-
endpoint.port = context.http_request.endpoint.port
|
56
|
-
endpoint.host = host
|
57
|
-
context.http_request.endpoint = endpoint.to_s
|
58
|
-
end
|
59
|
-
|
60
|
-
def use_bucket_dns?(bucket_name, context)
|
61
|
-
ssl = context.http_request.endpoint.scheme == "https"
|
62
|
-
bucket_name && BucketDns.dns_compatible?(bucket_name, ssl) &&
|
63
|
-
!context.config.force_path_style
|
64
|
-
end
|
65
|
-
|
66
|
-
def use_dualstack_endpoint?(context)
|
67
|
-
context[:use_dualstack_endpoint] && !context[:use_accelerate_endpoint]
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
24
|
end
|
72
25
|
end
|
73
26
|
end
|
@@ -0,0 +1,274 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# WARNING ABOUT GENERATED CODE
|
4
|
+
#
|
5
|
+
# This file is generated. See the contributing guide for more information:
|
6
|
+
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
|
7
|
+
#
|
8
|
+
# WARNING ABOUT GENERATED CODE
|
9
|
+
|
10
|
+
|
11
|
+
module Aws::S3
|
12
|
+
module Plugins
|
13
|
+
class Endpoints < Seahorse::Client::Plugin
|
14
|
+
option(
|
15
|
+
:endpoint_provider,
|
16
|
+
doc_type: 'Aws::S3::EndpointProvider',
|
17
|
+
rbs_type: 'untyped',
|
18
|
+
docstring: 'The endpoint provider used to resolve endpoints. Any '\
|
19
|
+
'object that responds to `#resolve_endpoint(parameters)` '\
|
20
|
+
'where `parameters` is a Struct similar to '\
|
21
|
+
'`Aws::S3::EndpointParameters`'
|
22
|
+
) do |cfg|
|
23
|
+
Aws::S3::EndpointProvider.new
|
24
|
+
end
|
25
|
+
|
26
|
+
option(
|
27
|
+
:disable_s3_express_session_auth,
|
28
|
+
doc_type: 'Boolean',
|
29
|
+
default: nil,
|
30
|
+
docstring: "Parameter to indicate whether S3Express session auth should be disabled")
|
31
|
+
|
32
|
+
# @api private
|
33
|
+
class Handler < Seahorse::Client::Handler
|
34
|
+
def call(context)
|
35
|
+
unless context[:discovered_endpoint]
|
36
|
+
params = parameters_for_operation(context)
|
37
|
+
endpoint = context.config.endpoint_provider.resolve_endpoint(params)
|
38
|
+
|
39
|
+
context.http_request.endpoint = endpoint.url
|
40
|
+
apply_endpoint_headers(context, endpoint.headers)
|
41
|
+
|
42
|
+
context[:endpoint_params] = params
|
43
|
+
context[:endpoint_properties] = endpoint.properties
|
44
|
+
end
|
45
|
+
|
46
|
+
context[:auth_scheme] =
|
47
|
+
Aws::Endpoints.resolve_auth_scheme(context, endpoint)
|
48
|
+
|
49
|
+
@handler.call(context)
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def apply_endpoint_headers(context, headers)
|
55
|
+
headers.each do |key, values|
|
56
|
+
value = values
|
57
|
+
.compact
|
58
|
+
.map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
|
59
|
+
.join(',')
|
60
|
+
|
61
|
+
context.http_request.headers[key] = value
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def parameters_for_operation(context)
|
66
|
+
case context.operation_name
|
67
|
+
when :abort_multipart_upload
|
68
|
+
Aws::S3::Endpoints::AbortMultipartUpload.build(context)
|
69
|
+
when :complete_multipart_upload
|
70
|
+
Aws::S3::Endpoints::CompleteMultipartUpload.build(context)
|
71
|
+
when :copy_object
|
72
|
+
Aws::S3::Endpoints::CopyObject.build(context)
|
73
|
+
when :create_bucket
|
74
|
+
Aws::S3::Endpoints::CreateBucket.build(context)
|
75
|
+
when :create_multipart_upload
|
76
|
+
Aws::S3::Endpoints::CreateMultipartUpload.build(context)
|
77
|
+
when :create_session
|
78
|
+
Aws::S3::Endpoints::CreateSession.build(context)
|
79
|
+
when :delete_bucket
|
80
|
+
Aws::S3::Endpoints::DeleteBucket.build(context)
|
81
|
+
when :delete_bucket_analytics_configuration
|
82
|
+
Aws::S3::Endpoints::DeleteBucketAnalyticsConfiguration.build(context)
|
83
|
+
when :delete_bucket_cors
|
84
|
+
Aws::S3::Endpoints::DeleteBucketCors.build(context)
|
85
|
+
when :delete_bucket_encryption
|
86
|
+
Aws::S3::Endpoints::DeleteBucketEncryption.build(context)
|
87
|
+
when :delete_bucket_intelligent_tiering_configuration
|
88
|
+
Aws::S3::Endpoints::DeleteBucketIntelligentTieringConfiguration.build(context)
|
89
|
+
when :delete_bucket_inventory_configuration
|
90
|
+
Aws::S3::Endpoints::DeleteBucketInventoryConfiguration.build(context)
|
91
|
+
when :delete_bucket_lifecycle
|
92
|
+
Aws::S3::Endpoints::DeleteBucketLifecycle.build(context)
|
93
|
+
when :delete_bucket_metrics_configuration
|
94
|
+
Aws::S3::Endpoints::DeleteBucketMetricsConfiguration.build(context)
|
95
|
+
when :delete_bucket_ownership_controls
|
96
|
+
Aws::S3::Endpoints::DeleteBucketOwnershipControls.build(context)
|
97
|
+
when :delete_bucket_policy
|
98
|
+
Aws::S3::Endpoints::DeleteBucketPolicy.build(context)
|
99
|
+
when :delete_bucket_replication
|
100
|
+
Aws::S3::Endpoints::DeleteBucketReplication.build(context)
|
101
|
+
when :delete_bucket_tagging
|
102
|
+
Aws::S3::Endpoints::DeleteBucketTagging.build(context)
|
103
|
+
when :delete_bucket_website
|
104
|
+
Aws::S3::Endpoints::DeleteBucketWebsite.build(context)
|
105
|
+
when :delete_object
|
106
|
+
Aws::S3::Endpoints::DeleteObject.build(context)
|
107
|
+
when :delete_object_tagging
|
108
|
+
Aws::S3::Endpoints::DeleteObjectTagging.build(context)
|
109
|
+
when :delete_objects
|
110
|
+
Aws::S3::Endpoints::DeleteObjects.build(context)
|
111
|
+
when :delete_public_access_block
|
112
|
+
Aws::S3::Endpoints::DeletePublicAccessBlock.build(context)
|
113
|
+
when :get_bucket_accelerate_configuration
|
114
|
+
Aws::S3::Endpoints::GetBucketAccelerateConfiguration.build(context)
|
115
|
+
when :get_bucket_acl
|
116
|
+
Aws::S3::Endpoints::GetBucketAcl.build(context)
|
117
|
+
when :get_bucket_analytics_configuration
|
118
|
+
Aws::S3::Endpoints::GetBucketAnalyticsConfiguration.build(context)
|
119
|
+
when :get_bucket_cors
|
120
|
+
Aws::S3::Endpoints::GetBucketCors.build(context)
|
121
|
+
when :get_bucket_encryption
|
122
|
+
Aws::S3::Endpoints::GetBucketEncryption.build(context)
|
123
|
+
when :get_bucket_intelligent_tiering_configuration
|
124
|
+
Aws::S3::Endpoints::GetBucketIntelligentTieringConfiguration.build(context)
|
125
|
+
when :get_bucket_inventory_configuration
|
126
|
+
Aws::S3::Endpoints::GetBucketInventoryConfiguration.build(context)
|
127
|
+
when :get_bucket_lifecycle
|
128
|
+
Aws::S3::Endpoints::GetBucketLifecycle.build(context)
|
129
|
+
when :get_bucket_lifecycle_configuration
|
130
|
+
Aws::S3::Endpoints::GetBucketLifecycleConfiguration.build(context)
|
131
|
+
when :get_bucket_location
|
132
|
+
Aws::S3::Endpoints::GetBucketLocation.build(context)
|
133
|
+
when :get_bucket_logging
|
134
|
+
Aws::S3::Endpoints::GetBucketLogging.build(context)
|
135
|
+
when :get_bucket_metrics_configuration
|
136
|
+
Aws::S3::Endpoints::GetBucketMetricsConfiguration.build(context)
|
137
|
+
when :get_bucket_notification
|
138
|
+
Aws::S3::Endpoints::GetBucketNotification.build(context)
|
139
|
+
when :get_bucket_notification_configuration
|
140
|
+
Aws::S3::Endpoints::GetBucketNotificationConfiguration.build(context)
|
141
|
+
when :get_bucket_ownership_controls
|
142
|
+
Aws::S3::Endpoints::GetBucketOwnershipControls.build(context)
|
143
|
+
when :get_bucket_policy
|
144
|
+
Aws::S3::Endpoints::GetBucketPolicy.build(context)
|
145
|
+
when :get_bucket_policy_status
|
146
|
+
Aws::S3::Endpoints::GetBucketPolicyStatus.build(context)
|
147
|
+
when :get_bucket_replication
|
148
|
+
Aws::S3::Endpoints::GetBucketReplication.build(context)
|
149
|
+
when :get_bucket_request_payment
|
150
|
+
Aws::S3::Endpoints::GetBucketRequestPayment.build(context)
|
151
|
+
when :get_bucket_tagging
|
152
|
+
Aws::S3::Endpoints::GetBucketTagging.build(context)
|
153
|
+
when :get_bucket_versioning
|
154
|
+
Aws::S3::Endpoints::GetBucketVersioning.build(context)
|
155
|
+
when :get_bucket_website
|
156
|
+
Aws::S3::Endpoints::GetBucketWebsite.build(context)
|
157
|
+
when :get_object
|
158
|
+
Aws::S3::Endpoints::GetObject.build(context)
|
159
|
+
when :get_object_acl
|
160
|
+
Aws::S3::Endpoints::GetObjectAcl.build(context)
|
161
|
+
when :get_object_attributes
|
162
|
+
Aws::S3::Endpoints::GetObjectAttributes.build(context)
|
163
|
+
when :get_object_legal_hold
|
164
|
+
Aws::S3::Endpoints::GetObjectLegalHold.build(context)
|
165
|
+
when :get_object_lock_configuration
|
166
|
+
Aws::S3::Endpoints::GetObjectLockConfiguration.build(context)
|
167
|
+
when :get_object_retention
|
168
|
+
Aws::S3::Endpoints::GetObjectRetention.build(context)
|
169
|
+
when :get_object_tagging
|
170
|
+
Aws::S3::Endpoints::GetObjectTagging.build(context)
|
171
|
+
when :get_object_torrent
|
172
|
+
Aws::S3::Endpoints::GetObjectTorrent.build(context)
|
173
|
+
when :get_public_access_block
|
174
|
+
Aws::S3::Endpoints::GetPublicAccessBlock.build(context)
|
175
|
+
when :head_bucket
|
176
|
+
Aws::S3::Endpoints::HeadBucket.build(context)
|
177
|
+
when :head_object
|
178
|
+
Aws::S3::Endpoints::HeadObject.build(context)
|
179
|
+
when :list_bucket_analytics_configurations
|
180
|
+
Aws::S3::Endpoints::ListBucketAnalyticsConfigurations.build(context)
|
181
|
+
when :list_bucket_intelligent_tiering_configurations
|
182
|
+
Aws::S3::Endpoints::ListBucketIntelligentTieringConfigurations.build(context)
|
183
|
+
when :list_bucket_inventory_configurations
|
184
|
+
Aws::S3::Endpoints::ListBucketInventoryConfigurations.build(context)
|
185
|
+
when :list_bucket_metrics_configurations
|
186
|
+
Aws::S3::Endpoints::ListBucketMetricsConfigurations.build(context)
|
187
|
+
when :list_buckets
|
188
|
+
Aws::S3::Endpoints::ListBuckets.build(context)
|
189
|
+
when :list_directory_buckets
|
190
|
+
Aws::S3::Endpoints::ListDirectoryBuckets.build(context)
|
191
|
+
when :list_multipart_uploads
|
192
|
+
Aws::S3::Endpoints::ListMultipartUploads.build(context)
|
193
|
+
when :list_object_versions
|
194
|
+
Aws::S3::Endpoints::ListObjectVersions.build(context)
|
195
|
+
when :list_objects
|
196
|
+
Aws::S3::Endpoints::ListObjects.build(context)
|
197
|
+
when :list_objects_v2
|
198
|
+
Aws::S3::Endpoints::ListObjectsV2.build(context)
|
199
|
+
when :list_parts
|
200
|
+
Aws::S3::Endpoints::ListParts.build(context)
|
201
|
+
when :put_bucket_accelerate_configuration
|
202
|
+
Aws::S3::Endpoints::PutBucketAccelerateConfiguration.build(context)
|
203
|
+
when :put_bucket_acl
|
204
|
+
Aws::S3::Endpoints::PutBucketAcl.build(context)
|
205
|
+
when :put_bucket_analytics_configuration
|
206
|
+
Aws::S3::Endpoints::PutBucketAnalyticsConfiguration.build(context)
|
207
|
+
when :put_bucket_cors
|
208
|
+
Aws::S3::Endpoints::PutBucketCors.build(context)
|
209
|
+
when :put_bucket_encryption
|
210
|
+
Aws::S3::Endpoints::PutBucketEncryption.build(context)
|
211
|
+
when :put_bucket_intelligent_tiering_configuration
|
212
|
+
Aws::S3::Endpoints::PutBucketIntelligentTieringConfiguration.build(context)
|
213
|
+
when :put_bucket_inventory_configuration
|
214
|
+
Aws::S3::Endpoints::PutBucketInventoryConfiguration.build(context)
|
215
|
+
when :put_bucket_lifecycle
|
216
|
+
Aws::S3::Endpoints::PutBucketLifecycle.build(context)
|
217
|
+
when :put_bucket_lifecycle_configuration
|
218
|
+
Aws::S3::Endpoints::PutBucketLifecycleConfiguration.build(context)
|
219
|
+
when :put_bucket_logging
|
220
|
+
Aws::S3::Endpoints::PutBucketLogging.build(context)
|
221
|
+
when :put_bucket_metrics_configuration
|
222
|
+
Aws::S3::Endpoints::PutBucketMetricsConfiguration.build(context)
|
223
|
+
when :put_bucket_notification
|
224
|
+
Aws::S3::Endpoints::PutBucketNotification.build(context)
|
225
|
+
when :put_bucket_notification_configuration
|
226
|
+
Aws::S3::Endpoints::PutBucketNotificationConfiguration.build(context)
|
227
|
+
when :put_bucket_ownership_controls
|
228
|
+
Aws::S3::Endpoints::PutBucketOwnershipControls.build(context)
|
229
|
+
when :put_bucket_policy
|
230
|
+
Aws::S3::Endpoints::PutBucketPolicy.build(context)
|
231
|
+
when :put_bucket_replication
|
232
|
+
Aws::S3::Endpoints::PutBucketReplication.build(context)
|
233
|
+
when :put_bucket_request_payment
|
234
|
+
Aws::S3::Endpoints::PutBucketRequestPayment.build(context)
|
235
|
+
when :put_bucket_tagging
|
236
|
+
Aws::S3::Endpoints::PutBucketTagging.build(context)
|
237
|
+
when :put_bucket_versioning
|
238
|
+
Aws::S3::Endpoints::PutBucketVersioning.build(context)
|
239
|
+
when :put_bucket_website
|
240
|
+
Aws::S3::Endpoints::PutBucketWebsite.build(context)
|
241
|
+
when :put_object
|
242
|
+
Aws::S3::Endpoints::PutObject.build(context)
|
243
|
+
when :put_object_acl
|
244
|
+
Aws::S3::Endpoints::PutObjectAcl.build(context)
|
245
|
+
when :put_object_legal_hold
|
246
|
+
Aws::S3::Endpoints::PutObjectLegalHold.build(context)
|
247
|
+
when :put_object_lock_configuration
|
248
|
+
Aws::S3::Endpoints::PutObjectLockConfiguration.build(context)
|
249
|
+
when :put_object_retention
|
250
|
+
Aws::S3::Endpoints::PutObjectRetention.build(context)
|
251
|
+
when :put_object_tagging
|
252
|
+
Aws::S3::Endpoints::PutObjectTagging.build(context)
|
253
|
+
when :put_public_access_block
|
254
|
+
Aws::S3::Endpoints::PutPublicAccessBlock.build(context)
|
255
|
+
when :restore_object
|
256
|
+
Aws::S3::Endpoints::RestoreObject.build(context)
|
257
|
+
when :select_object_content
|
258
|
+
Aws::S3::Endpoints::SelectObjectContent.build(context)
|
259
|
+
when :upload_part
|
260
|
+
Aws::S3::Endpoints::UploadPart.build(context)
|
261
|
+
when :upload_part_copy
|
262
|
+
Aws::S3::Endpoints::UploadPartCopy.build(context)
|
263
|
+
when :write_get_object_response
|
264
|
+
Aws::S3::Endpoints::WriteGetObjectResponse.build(context)
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
def add_handlers(handlers, _config)
|
270
|
+
handlers.add(Handler, step: :build, priority: 75)
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
@@ -15,7 +15,9 @@ module Aws
|
|
15
15
|
class Handler < Seahorse::Client::Handler
|
16
16
|
|
17
17
|
def call(context)
|
18
|
-
|
18
|
+
body = context.http_request.body
|
19
|
+
if body.respond_to?(:size) && body.size > 0 &&
|
20
|
+
!context[:use_accelerate_endpoint]
|
19
21
|
context.http_request.headers['expect'] = '100-continue'
|
20
22
|
end
|
21
23
|
@handler.call(context)
|