aws-sdk-s3 1.87.0 → 1.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/aws-sdk-s3.rb +1 -1
- data/lib/aws-sdk-s3/arn/access_point_arn.rb +8 -4
- data/lib/aws-sdk-s3/arn/outpost_access_point_arn.rb +7 -3
- data/lib/aws-sdk-s3/client.rb +1 -1
- data/lib/aws-sdk-s3/encryptionV2/default_cipher_provider.rb +3 -3
- data/lib/aws-sdk-s3/plugins/accelerate.rb +7 -4
- data/lib/aws-sdk-s3/plugins/arn.rb +44 -26
- data/lib/aws-sdk-s3/plugins/dualstack.rb +10 -3
- data/lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb +1 -2
- data/lib/aws-sdk-s3/plugins/s3_signer.rb +18 -26
- data/lib/aws-sdk-s3/presigner.rb +14 -25
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c68fb2d0d86cd2d649a7468bfcb1a89719fd745029178d41169786363f08eec
|
4
|
+
data.tar.gz: 6e70d3ddc402afc02f834caaab226766baffa7b6deb461cc83eb5605392db326
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97726812bbc8722eaee50bcbbd39711f15b7d54c453240e024ddb4a1d761eb2806f5f80f17e42bdfa9771aaceb068f171ee79bf317a7c59375588f7bbb56db2e
|
7
|
+
data.tar.gz: f7312d5061b498e88504b99e7c0f153c2ca8dc7fce2e32e5745756f651561b40ccaedf6f8d0d1d1b1a4aed30bf58dbcb732c631c07271cf0f0e23b73f437b00a
|
data/lib/aws-sdk-s3.rb
CHANGED
@@ -52,10 +52,14 @@ module Aws
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
def host_url(region, dualstack = false)
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
def host_url(region, dualstack = false, custom_endpoint = nil)
|
56
|
+
pfx = "#{@access_point_name}-#{@account_id}"
|
57
|
+
if custom_endpoint
|
58
|
+
"#{pfx}.#{custom_endpoint}"
|
59
|
+
else
|
60
|
+
sfx = Aws::Partitions::EndpointProvider.dns_suffix_for(region)
|
61
|
+
"#{pfx}.s3-accesspoint#{'.dualstack' if dualstack}.#{region}.#{sfx}"
|
62
|
+
end
|
59
63
|
end
|
60
64
|
end
|
61
65
|
end
|
@@ -62,9 +62,13 @@ module Aws
|
|
62
62
|
end
|
63
63
|
|
64
64
|
# Outpost ARNs currently do not support dualstack
|
65
|
-
def host_url(region, _dualstack = false)
|
66
|
-
"#{@access_point_name}-#{@account_id}.#{@outpost_id}"
|
67
|
-
|
65
|
+
def host_url(region, _dualstack = false, custom_endpoint = nil)
|
66
|
+
pfx = "#{@access_point_name}-#{@account_id}.#{@outpost_id}"
|
67
|
+
if custom_endpoint
|
68
|
+
"#{pfx}.#{custom_endpoint}"
|
69
|
+
else
|
70
|
+
"#{pfx}.s3-outposts.#{region}.amazonaws.com"
|
71
|
+
end
|
68
72
|
end
|
69
73
|
end
|
70
74
|
end
|
data/lib/aws-sdk-s3/client.rb
CHANGED
@@ -13566,7 +13566,7 @@ module Aws::S3
|
|
13566
13566
|
params: params,
|
13567
13567
|
config: config)
|
13568
13568
|
context[:gem_name] = 'aws-sdk-s3'
|
13569
|
-
context[:gem_version] = '1.
|
13569
|
+
context[:gem_version] = '1.88.0'
|
13570
13570
|
Seahorse::Client::Request.new(handlers, context)
|
13571
13571
|
end
|
13572
13572
|
|
@@ -87,9 +87,9 @@ module Aws
|
|
87
87
|
' kms+context. Please configure the client with the' \
|
88
88
|
' required kms_key_id'
|
89
89
|
else
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
raise ArgumentError, 'Unsupported wrap-alg: ' \
|
91
|
+
"#{envelope['x-amz-wrap-alg']}"
|
92
|
+
end
|
93
93
|
iv = decode64(envelope['x-amz-iv'])
|
94
94
|
Utils.aes_decryption_cipher(:GCM, key, iv)
|
95
95
|
end
|
@@ -29,7 +29,7 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/
|
|
29
29
|
OptionHandler, step: :initialize, operations: operations
|
30
30
|
)
|
31
31
|
handlers.add(
|
32
|
-
AccelerateHandler, step: :build, priority:
|
32
|
+
AccelerateHandler, step: :build, priority: 11, operations: operations
|
33
33
|
)
|
34
34
|
end
|
35
35
|
|
@@ -40,8 +40,11 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/
|
|
40
40
|
if context.params.is_a?(Hash)
|
41
41
|
accelerate = context.params.delete(:use_accelerate_endpoint)
|
42
42
|
end
|
43
|
-
if accelerate.nil?
|
44
|
-
|
43
|
+
accelerate = context.config.use_accelerate_endpoint if accelerate.nil?
|
44
|
+
# Raise if :endpoint and dualstack are both provided
|
45
|
+
if accelerate && !context.config.regional_endpoint
|
46
|
+
raise ArgumentError,
|
47
|
+
'Cannot use both :use_accelerate_endpoint and :endpoint'
|
45
48
|
end
|
46
49
|
context[:use_accelerate_endpoint] = accelerate
|
47
50
|
@handler.call(context)
|
@@ -51,7 +54,7 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/
|
|
51
54
|
# @api private
|
52
55
|
class AccelerateHandler < Seahorse::Client::Handler
|
53
56
|
def call(context)
|
54
|
-
if context[:use_accelerate_endpoint]
|
57
|
+
if context.config.regional_endpoint && context[:use_accelerate_endpoint]
|
55
58
|
dualstack = !!context[:use_dualstack_endpoint]
|
56
59
|
use_accelerate_endpoint(context, dualstack)
|
57
60
|
end
|
@@ -22,11 +22,35 @@ be made. Set to `false` to use the client's region instead.
|
|
22
22
|
resolve_s3_use_arn_region(cfg)
|
23
23
|
end
|
24
24
|
|
25
|
+
# param validator is validate:50 (required to add account_id from arn)
|
26
|
+
# endpoint is build:90 (populates the URI for the first time)
|
27
|
+
# endpoint pattern is build:10 (prefix account id to host)
|
25
28
|
def add_handlers(handlers, _config)
|
26
|
-
handlers.add(
|
29
|
+
handlers.add(ARNHandler, step: :validate, priority: 75)
|
30
|
+
handlers.add(UrlHandler)
|
27
31
|
end
|
28
32
|
|
29
|
-
|
33
|
+
# After extracting out any ARN input, resolve a new URL with it.
|
34
|
+
class UrlHandler < Seahorse::Client::Handler
|
35
|
+
def call(context)
|
36
|
+
if context.metadata[:s3_arn]
|
37
|
+
ARN.resolve_url!(
|
38
|
+
context.http_request.endpoint,
|
39
|
+
context.metadata[:s3_arn][:arn],
|
40
|
+
context.metadata[:s3_arn][:resolved_region],
|
41
|
+
context.metadata[:s3_arn][:dualstack],
|
42
|
+
# if regional_endpoint is false, a custom endpoint was provided
|
43
|
+
# in this case, we want to prefix the endpoint using the ARN
|
44
|
+
!context.config.regional_endpoint
|
45
|
+
)
|
46
|
+
end
|
47
|
+
@handler.call(context)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# This plugin will extract out any ARN input and set context for other
|
52
|
+
# plugins to use without having to translate the ARN again.
|
53
|
+
class ARNHandler < Seahorse::Client::Handler
|
30
54
|
def call(context)
|
31
55
|
bucket_member = _bucket_member(context.operation.input.shape)
|
32
56
|
if bucket_member && (bucket = context.params[bucket_member])
|
@@ -38,12 +62,11 @@ be made. Set to `false` to use the client's region instead.
|
|
38
62
|
if arn
|
39
63
|
validate_config!(context, arn)
|
40
64
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
)
|
65
|
+
context.metadata[:s3_arn] = {
|
66
|
+
arn: arn,
|
67
|
+
resolved_region: resolved_region,
|
68
|
+
dualstack: extract_dualstack_config!(context)
|
69
|
+
}
|
47
70
|
end
|
48
71
|
end
|
49
72
|
@handler.call(context)
|
@@ -66,28 +89,22 @@ be made. Set to `false` to use the client's region instead.
|
|
66
89
|
end
|
67
90
|
|
68
91
|
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
92
|
if context.config.force_path_style
|
76
93
|
raise ArgumentError,
|
77
|
-
'Cannot provide
|
78
|
-
'
|
94
|
+
'Cannot provide an Access Point ARN when '\
|
95
|
+
'`:force_path_style` is set to true.'
|
79
96
|
end
|
80
97
|
|
81
98
|
if context.config.use_accelerate_endpoint
|
82
99
|
raise ArgumentError,
|
83
|
-
'Cannot provide
|
84
|
-
'
|
100
|
+
'Cannot provide an Access Point ARN when '\
|
101
|
+
'`:use_accelerate_endpoint` is set to true.'
|
85
102
|
end
|
86
103
|
|
87
104
|
if !arn.support_dualstack? && context[:use_dualstack_endpoint]
|
88
105
|
raise ArgumentError,
|
89
|
-
'Cannot provide
|
90
|
-
'
|
106
|
+
'Cannot provide an Outpost Access Point ARN when '\
|
107
|
+
'`:use_dualstack_endpoint` is set to true.'
|
91
108
|
end
|
92
109
|
end
|
93
110
|
end
|
@@ -116,8 +133,9 @@ be made. Set to `false` to use the client's region instead.
|
|
116
133
|
end
|
117
134
|
|
118
135
|
# @api private
|
119
|
-
def resolve_url!(url, arn, region, dualstack = false)
|
120
|
-
url.host
|
136
|
+
def resolve_url!(url, arn, region, dualstack = false, has_custom_endpoint = false)
|
137
|
+
custom_endpoint = url.host if has_custom_endpoint
|
138
|
+
url.host = arn.host_url(region, dualstack, custom_endpoint)
|
121
139
|
url.path = url_path(url.path, arn)
|
122
140
|
url
|
123
141
|
end
|
@@ -132,9 +150,9 @@ be made. Set to `false` to use the client's region instead.
|
|
132
150
|
# Raise if provided value is not true or false
|
133
151
|
if value.nil?
|
134
152
|
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']"
|
153
|
+
'Must provide either `true` or `false` for the '\
|
154
|
+
'`s3_use_arn_region` profile option or for '\
|
155
|
+
"ENV['AWS_S3_USE_ARN_REGION']."
|
138
156
|
end
|
139
157
|
value
|
140
158
|
end
|
@@ -163,7 +181,7 @@ be made. Set to `false` to use the client's region instead.
|
|
163
181
|
if !fips && !use_arn_region && region.include?('fips')
|
164
182
|
raise ArgumentError,
|
165
183
|
'FIPS client regions are not supported for this type of '\
|
166
|
-
'ARN without s3_use_arn_region
|
184
|
+
'ARN without `:s3_use_arn_region`.'
|
167
185
|
end
|
168
186
|
|
169
187
|
# if it's a fips region, attempt to normalize it
|
@@ -16,16 +16,22 @@ for all operations.
|
|
16
16
|
|
17
17
|
def add_handlers(handlers, config)
|
18
18
|
handlers.add(OptionHandler, step: :initialize)
|
19
|
-
handlers.add(DualstackHandler, step: :build, priority:
|
19
|
+
handlers.add(DualstackHandler, step: :build, priority: 11)
|
20
20
|
end
|
21
21
|
|
22
22
|
# @api private
|
23
23
|
class OptionHandler < Seahorse::Client::Handler
|
24
24
|
def call(context)
|
25
|
+
# Support client configuration and per-operation configuration
|
25
26
|
if context.params.is_a?(Hash)
|
26
27
|
dualstack = context.params.delete(:use_dualstack_endpoint)
|
27
28
|
end
|
28
29
|
dualstack = context.config.use_dualstack_endpoint if dualstack.nil?
|
30
|
+
# Raise if :endpoint and dualstack are both provided
|
31
|
+
if dualstack && !context.config.regional_endpoint
|
32
|
+
raise ArgumentError,
|
33
|
+
'Cannot use both :use_dualstack_endpoint and :endpoint'
|
34
|
+
end
|
29
35
|
context[:use_dualstack_endpoint] = dualstack
|
30
36
|
@handler.call(context)
|
31
37
|
end
|
@@ -34,7 +40,9 @@ for all operations.
|
|
34
40
|
# @api private
|
35
41
|
class DualstackHandler < Seahorse::Client::Handler
|
36
42
|
def call(context)
|
37
|
-
|
43
|
+
if context.config.regional_endpoint && use_dualstack_endpoint?(context)
|
44
|
+
apply_dualstack_endpoint(context)
|
45
|
+
end
|
38
46
|
@handler.call(context)
|
39
47
|
end
|
40
48
|
|
@@ -42,7 +50,6 @@ for all operations.
|
|
42
50
|
def apply_dualstack_endpoint(context)
|
43
51
|
bucket_name = context.params[:bucket]
|
44
52
|
region = context.config.region
|
45
|
-
context.config.force_path_style
|
46
53
|
dns_suffix = Aws::Partitions::EndpointProvider.dns_suffix_for(region)
|
47
54
|
|
48
55
|
if use_bucket_dns?(bucket_name, context)
|
@@ -30,8 +30,7 @@ region. Defaults to `legacy` mode using global endpoint.
|
|
30
30
|
if context.config.s3_us_east_1_regional_endpoint == 'legacy'
|
31
31
|
host = context.http_request.endpoint.host
|
32
32
|
# if it's an ARN, don't touch the endpoint at all
|
33
|
-
|
34
|
-
unless host.include?('.s3-outposts.') || host.include?('.s3-accesspoint.')
|
33
|
+
unless context.metadata[:s3_arn]
|
35
34
|
legacy_host = IADRegionalEndpoint.legacy_host(host)
|
36
35
|
context.http_request.endpoint.host = legacy_host
|
37
36
|
end
|
@@ -73,22 +73,14 @@ module Aws
|
|
73
73
|
region: context[:cached_sigv4_region],
|
74
74
|
credentials: context.config.credentials
|
75
75
|
)
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
context.config.
|
76
|
+
elsif (arn = context.metadata[:s3_arn])
|
77
|
+
S3Signer.build_v4_signer(
|
78
|
+
service: arn[:arn].service,
|
79
|
+
region: arn[:resolved_region],
|
80
|
+
credentials: context.config.credentials
|
81
81
|
)
|
82
|
-
|
83
|
-
|
84
|
-
S3Signer.build_v4_signer(
|
85
|
-
service: arn.service,
|
86
|
-
region: resolved_region,
|
87
|
-
credentials: context.config.credentials
|
88
|
-
)
|
89
|
-
else
|
90
|
-
context.config.sigv4_signer
|
91
|
-
end
|
82
|
+
else
|
83
|
+
context.config.sigv4_signer
|
92
84
|
end
|
93
85
|
end
|
94
86
|
end
|
@@ -173,10 +165,14 @@ module Aws
|
|
173
165
|
context, actual_region
|
174
166
|
)
|
175
167
|
context.metadata[:redirect_region] = actual_region
|
168
|
+
# if it's an ARN, use the service in the ARN
|
169
|
+
if (arn = context.metadata[:s3_arn])
|
170
|
+
service = arn[:arn].service
|
171
|
+
end
|
176
172
|
Aws::Plugins::SignatureV4.apply_signature(
|
177
173
|
context: context,
|
178
174
|
signer: S3Signer.build_v4_signer(
|
179
|
-
service: 's3',
|
175
|
+
service: service || 's3',
|
180
176
|
region: actual_region,
|
181
177
|
credentials: context.config.credentials
|
182
178
|
)
|
@@ -219,20 +215,16 @@ module Aws
|
|
219
215
|
)
|
220
216
|
end
|
221
217
|
|
218
|
+
# Check to see if the bucket is actually an ARN
|
219
|
+
# Otherwise it will retry with the ARN as the bucket name.
|
222
220
|
def new_hostname(context, region)
|
223
|
-
# Check to see if the bucket is actually an ARN and resolve it
|
224
|
-
# Otherwise it will retry with the ARN as the bucket name.
|
225
|
-
resolved_region, arn = ARN.resolve_arn!(
|
226
|
-
context.params[:bucket],
|
227
|
-
region,
|
228
|
-
context.config.s3_use_arn_region
|
229
|
-
)
|
230
221
|
uri = URI.parse(
|
231
|
-
Aws::Partitions::EndpointProvider.resolve(
|
222
|
+
Aws::Partitions::EndpointProvider.resolve(region, 's3')
|
232
223
|
)
|
233
224
|
|
234
|
-
if arn
|
235
|
-
ARN
|
225
|
+
if (arn = context.metadata[:s3_arn])
|
226
|
+
# Retry with the response region and not the ARN resolved one
|
227
|
+
ARN.resolve_url!(uri, arn[:arn], region).host
|
236
228
|
else
|
237
229
|
"#{context.params[:bucket]}.#{uri.host}"
|
238
230
|
end
|
data/lib/aws-sdk-s3/presigner.rb
CHANGED
@@ -196,8 +196,6 @@ module Aws
|
|
196
196
|
req.handlers.remove(Aws::S3::Plugins::S3Signer::V4Handler)
|
197
197
|
req.handlers.remove(Seahorse::Client::Plugins::ContentLength::Handler)
|
198
198
|
|
199
|
-
signer = build_signer(req.context, unsigned_headers)
|
200
|
-
|
201
199
|
req.handle(step: :send) do |context|
|
202
200
|
if scheme != http_req.endpoint.scheme
|
203
201
|
endpoint = http_req.endpoint.dup
|
@@ -222,6 +220,20 @@ module Aws
|
|
222
220
|
end
|
223
221
|
http_req.endpoint.query = query.join('&') unless query.empty?
|
224
222
|
|
223
|
+
# If it's an ARN, get the resolved region and service
|
224
|
+
if (arn = context.metadata[:s3_arn])
|
225
|
+
region = arn[:resolved_region]
|
226
|
+
service = arn[:arn].service
|
227
|
+
end
|
228
|
+
|
229
|
+
signer = Aws::Sigv4::Signer.new(
|
230
|
+
service: service || 's3',
|
231
|
+
region: region || context.config.region,
|
232
|
+
credentials_provider: context.config.credentials,
|
233
|
+
unsigned_headers: unsigned_headers,
|
234
|
+
uri_escape_path: false
|
235
|
+
)
|
236
|
+
|
225
237
|
url = signer.presign_url(
|
226
238
|
http_method: http_req.http_method,
|
227
239
|
url: http_req.endpoint,
|
@@ -239,29 +251,6 @@ module Aws
|
|
239
251
|
# Return the headers
|
240
252
|
x_amz_headers
|
241
253
|
end
|
242
|
-
|
243
|
-
def build_signer(context, unsigned_headers)
|
244
|
-
signer_opts = {
|
245
|
-
service: 's3',
|
246
|
-
region: context.config.region,
|
247
|
-
credentials_provider: context.config.credentials,
|
248
|
-
unsigned_headers: unsigned_headers,
|
249
|
-
uri_escape_path: false
|
250
|
-
}
|
251
|
-
|
252
|
-
resolved_region, arn = Aws::S3::Plugins::ARN.resolve_arn!(
|
253
|
-
context.params[:bucket],
|
254
|
-
context.config.sigv4_signer.region,
|
255
|
-
context.config.s3_use_arn_region
|
256
|
-
)
|
257
|
-
|
258
|
-
if arn
|
259
|
-
signer_opts[:region] = resolved_region
|
260
|
-
signer_opts[:service] = arn.service
|
261
|
-
end
|
262
|
-
|
263
|
-
Aws::Sigv4::Signer.new(signer_opts)
|
264
|
-
end
|
265
254
|
end
|
266
255
|
end
|
267
256
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.88.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-kms
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
version: '3'
|
48
48
|
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 3.
|
50
|
+
version: 3.112.0
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
version: '3'
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 3.
|
60
|
+
version: 3.112.0
|
61
61
|
description: Official AWS Ruby gem for Amazon Simple Storage Service (Amazon S3).
|
62
62
|
This gem is part of the AWS SDK for Ruby.
|
63
63
|
email:
|