aws-sdk-s3 1.60.2 → 1.61.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws-sdk-s3.rb +7 -4
- data/lib/aws-sdk-s3/bucket.rb +1 -0
- data/lib/aws-sdk-s3/bucket_acl.rb +1 -0
- data/lib/aws-sdk-s3/bucket_cors.rb +1 -0
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +1 -0
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +1 -0
- data/lib/aws-sdk-s3/bucket_logging.rb +1 -0
- data/lib/aws-sdk-s3/bucket_notification.rb +1 -0
- data/lib/aws-sdk-s3/bucket_policy.rb +1 -0
- data/lib/aws-sdk-s3/bucket_request_payment.rb +1 -0
- data/lib/aws-sdk-s3/bucket_tagging.rb +1 -0
- data/lib/aws-sdk-s3/bucket_versioning.rb +1 -0
- data/lib/aws-sdk-s3/bucket_website.rb +1 -0
- data/lib/aws-sdk-s3/client.rb +61 -10
- data/lib/aws-sdk-s3/client_api.rb +14 -0
- data/lib/aws-sdk-s3/errors.rb +99 -0
- data/lib/aws-sdk-s3/multipart_upload.rb +1 -0
- data/lib/aws-sdk-s3/multipart_upload_part.rb +1 -0
- data/lib/aws-sdk-s3/object.rb +1 -0
- data/lib/aws-sdk-s3/object_acl.rb +1 -0
- data/lib/aws-sdk-s3/object_summary.rb +1 -0
- data/lib/aws-sdk-s3/object_version.rb +1 -0
- data/lib/aws-sdk-s3/plugins/s3_signer.rb +23 -26
- data/lib/aws-sdk-s3/resource.rb +7 -0
- data/lib/aws-sdk-s3/types.rb +49 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0da3bfd3b5b86514694701d043129e63a20061d5
|
4
|
+
data.tar.gz: 23b6ae8f0aa5237eea50c2f0615085c05fadecac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c48ccfd91350839d27f92712ce9d167eeff24bbdab758cd1c7ff999c0914510ad1180a888114ba1da9aa2518cb14ca2590f523173b15e93350bfe59af9b032e6
|
7
|
+
data.tar.gz: 6cc8009f8566e5f44f19e51b6d5e6d083c5247a7c9f0c8518b6383e8022007b6d43082743ececc647924757c66c65543d602f496a3b6739ef56e1329afb1429b
|
data/lib/aws-sdk-s3.rb
CHANGED
@@ -45,17 +45,20 @@ require_relative 'aws-sdk-s3/event_streams'
|
|
45
45
|
# methods each accept a hash of request parameters and return a response
|
46
46
|
# structure.
|
47
47
|
#
|
48
|
+
# s3 = Aws::S3::Client.new
|
49
|
+
# resp = s3.abort_multipart_upload(params)
|
50
|
+
#
|
48
51
|
# See {Client} for more information.
|
49
52
|
#
|
50
53
|
# # Errors
|
51
54
|
#
|
52
|
-
# Errors returned from Amazon Simple Storage Service
|
53
|
-
# extend {Errors::ServiceError}.
|
55
|
+
# Errors returned from Amazon Simple Storage Service are defined in the
|
56
|
+
# {Errors} module and all extend {Errors::ServiceError}.
|
54
57
|
#
|
55
58
|
# begin
|
56
59
|
# # do stuff
|
57
60
|
# rescue Aws::S3::Errors::ServiceError
|
58
|
-
# # rescues all
|
61
|
+
# # rescues all Amazon Simple Storage Service API errors
|
59
62
|
# end
|
60
63
|
#
|
61
64
|
# See {Errors} for more information.
|
@@ -63,6 +66,6 @@ require_relative 'aws-sdk-s3/event_streams'
|
|
63
66
|
# @service
|
64
67
|
module Aws::S3
|
65
68
|
|
66
|
-
GEM_VERSION = '1.
|
69
|
+
GEM_VERSION = '1.61.0'
|
67
70
|
|
68
71
|
end
|
data/lib/aws-sdk-s3/bucket.rb
CHANGED
data/lib/aws-sdk-s3/client.rb
CHANGED
@@ -46,6 +46,18 @@ require 'aws-sdk-core/plugins/event_stream_configuration.rb'
|
|
46
46
|
Aws::Plugins::GlobalConfiguration.add_identifier(:s3)
|
47
47
|
|
48
48
|
module Aws::S3
|
49
|
+
# An API client for S3. To construct a client, you need to configure a `:region` and `:credentials`.
|
50
|
+
#
|
51
|
+
# client = Aws::S3::Client.new(
|
52
|
+
# region: region_name,
|
53
|
+
# credentials: credentials,
|
54
|
+
# # ...
|
55
|
+
# )
|
56
|
+
#
|
57
|
+
# For details on configuring region and credentials see
|
58
|
+
# the [developer guide](/sdk-for-ruby/v3/developer-guide/setup-config.html).
|
59
|
+
#
|
60
|
+
# See {#initialize} for a full list of supported configuration options.
|
49
61
|
class Client < Seahorse::Client::Base
|
50
62
|
|
51
63
|
include Aws::ClientStubs
|
@@ -140,6 +152,12 @@ module Aws::S3
|
|
140
152
|
# When set to `true`, a thread polling for endpoints will be running in
|
141
153
|
# the background every 60 secs (default). Defaults to `false`.
|
142
154
|
#
|
155
|
+
# @option options [Boolean] :adaptive_retry_wait_to_fill (true)
|
156
|
+
# Used only in `adaptive` retry mode. When true, the request will sleep
|
157
|
+
# until there is sufficent client side capacity to retry the request.
|
158
|
+
# When false, the request will raise a `RetryCapacityNotAvailableError` and will
|
159
|
+
# not retry instead of sleeping.
|
160
|
+
#
|
143
161
|
# @option options [Boolean] :client_side_monitoring (false)
|
144
162
|
# When `true`, client-side metrics will be collected for all API requests from
|
145
163
|
# this client.
|
@@ -170,6 +188,10 @@ module Aws::S3
|
|
170
188
|
# When `true`, an attempt is made to coerce request parameters into
|
171
189
|
# the required types.
|
172
190
|
#
|
191
|
+
# @option options [Boolean] :correct_clock_skew (true)
|
192
|
+
# Used only in `standard` and adaptive retry modes. Specifies whether to apply
|
193
|
+
# a clock skew correction and retry requests with skewed client clocks.
|
194
|
+
#
|
173
195
|
# @option options [Boolean] :disable_host_prefix_injection (false)
|
174
196
|
# Set to true to disable SDK automatically adding host prefix
|
175
197
|
# to default service endpoint when available.
|
@@ -218,6 +240,12 @@ module Aws::S3
|
|
218
240
|
# The Logger instance to send log messages to. If this option
|
219
241
|
# is not set, logging will be disabled.
|
220
242
|
#
|
243
|
+
# @option options [Integer] :max_attempts (3)
|
244
|
+
# An integer representing the maximum number attempts that will be made for
|
245
|
+
# a single request, including the initial attempt. For example,
|
246
|
+
# setting this value to 5 will result in a request being retried up to
|
247
|
+
# 4 times. Used in `standard` and `adaptive` retry modes.
|
248
|
+
#
|
221
249
|
# @option options [Proc] :output_event_stream_handler
|
222
250
|
# When an EventStream or Proc object is provided, it will be used as callback for each chunk of event stream response received along the way.
|
223
251
|
#
|
@@ -230,11 +258,19 @@ module Aws::S3
|
|
230
258
|
# where server-side-encryption is used with customer-provided keys.
|
231
259
|
# This should only be disabled for local testing.
|
232
260
|
#
|
261
|
+
# @option options [Proc] :retry_backoff
|
262
|
+
# A proc or lambda used for backoff. Defaults to 2**retries * retry_base_delay.
|
263
|
+
# This option is only used in the `legacy` retry mode.
|
264
|
+
#
|
233
265
|
# @option options [Float] :retry_base_delay (0.3)
|
234
|
-
# The base delay in seconds used by the default backoff function.
|
266
|
+
# The base delay in seconds used by the default backoff function. This option
|
267
|
+
# is only used in the `legacy` retry mode.
|
235
268
|
#
|
236
269
|
# @option options [Symbol] :retry_jitter (:none)
|
237
|
-
# A delay randomiser function used by the default backoff function.
|
270
|
+
# A delay randomiser function used by the default backoff function.
|
271
|
+
# Some predefined functions can be referenced by name - :none, :equal, :full,
|
272
|
+
# otherwise a Proc that takes and returns a number. This option is only used
|
273
|
+
# in the `legacy` retry mode.
|
238
274
|
#
|
239
275
|
# @see https://www.awsarchitectureblog.com/2015/03/backoff.html
|
240
276
|
#
|
@@ -242,11 +278,26 @@ module Aws::S3
|
|
242
278
|
# The maximum number of times to retry failed requests. Only
|
243
279
|
# ~ 500 level server errors and certain ~ 400 level client errors
|
244
280
|
# are retried. Generally, these are throttling errors, data
|
245
|
-
# checksum errors, networking errors, timeout errors
|
246
|
-
# errors from expired credentials.
|
281
|
+
# checksum errors, networking errors, timeout errors, auth errors,
|
282
|
+
# endpoint discovery, and errors from expired credentials.
|
283
|
+
# This option is only used in the `legacy` retry mode.
|
247
284
|
#
|
248
285
|
# @option options [Integer] :retry_max_delay (0)
|
249
|
-
# The maximum number of seconds to delay between retries (0 for no limit)
|
286
|
+
# The maximum number of seconds to delay between retries (0 for no limit)
|
287
|
+
# used by the default backoff function. This option is only used in the
|
288
|
+
# `legacy` retry mode.
|
289
|
+
#
|
290
|
+
# @option options [String] :retry_mode ("legacy")
|
291
|
+
# Specifies which retry algorithm to use. Values are:
|
292
|
+
# * `legacy` - The pre-existing retry behavior. This is default value if
|
293
|
+
# no retry mode is provided.
|
294
|
+
# * `standard` - A standardized set of retry rules across the AWS SDKs.
|
295
|
+
# This includes support for retry quotas, which limit the number of
|
296
|
+
# unsuccessful retries a client can make.
|
297
|
+
# * `adaptive` - An experimental retry mode that includes all the
|
298
|
+
# functionality of `standard` mode along with automatic client side
|
299
|
+
# throttling. This is a provisional mode that may change behavior
|
300
|
+
# in the future.
|
250
301
|
#
|
251
302
|
# @option options [String] :s3_us_east_1_regional_endpoint ("legacy")
|
252
303
|
# Passing in `regional` to enable regional endpoint for S3's `us-east-1`
|
@@ -287,16 +338,16 @@ module Aws::S3
|
|
287
338
|
# requests through. Formatted like 'http://proxy.com:123'.
|
288
339
|
#
|
289
340
|
# @option options [Float] :http_open_timeout (15) The number of
|
290
|
-
# seconds to wait when opening a HTTP session before
|
341
|
+
# seconds to wait when opening a HTTP session before raising a
|
291
342
|
# `Timeout::Error`.
|
292
343
|
#
|
293
344
|
# @option options [Integer] :http_read_timeout (60) The default
|
294
345
|
# number of seconds to wait for response data. This value can
|
295
346
|
# safely be set
|
296
|
-
# per-request on the session
|
347
|
+
# per-request on the session yielded by {#session_for}.
|
297
348
|
#
|
298
349
|
# @option options [Float] :http_idle_timeout (5) The number of
|
299
|
-
# seconds a connection is allowed to sit
|
350
|
+
# seconds a connection is allowed to sit idle before it is
|
300
351
|
# considered stale. Stale connections are closed and removed
|
301
352
|
# from the pool before making a request.
|
302
353
|
#
|
@@ -305,7 +356,7 @@ module Aws::S3
|
|
305
356
|
# request body. This option has no effect unless the request has
|
306
357
|
# "Expect" header set to "100-continue". Defaults to `nil` which
|
307
358
|
# disables this behaviour. This value can safely be set per
|
308
|
-
# request on the session
|
359
|
+
# request on the session yielded by {#session_for}.
|
309
360
|
#
|
310
361
|
# @option options [Boolean] :http_wire_trace (false) When `true`,
|
311
362
|
# HTTP debug output will be sent to the `:logger`.
|
@@ -11713,7 +11764,7 @@ module Aws::S3
|
|
11713
11764
|
params: params,
|
11714
11765
|
config: config)
|
11715
11766
|
context[:gem_name] = 'aws-sdk-s3'
|
11716
|
-
context[:gem_version] = '1.
|
11767
|
+
context[:gem_version] = '1.61.0'
|
11717
11768
|
Seahorse::Client::Request.new(handlers, context)
|
11718
11769
|
end
|
11719
11770
|
|
@@ -587,6 +587,10 @@ module Aws::S3
|
|
587
587
|
Bucket.add_member(:creation_date, Shapes::ShapeRef.new(shape: CreationDate, location_name: "CreationDate"))
|
588
588
|
Bucket.struct_class = Types::Bucket
|
589
589
|
|
590
|
+
BucketAlreadyExists.struct_class = Types::BucketAlreadyExists
|
591
|
+
|
592
|
+
BucketAlreadyOwnedByYou.struct_class = Types::BucketAlreadyOwnedByYou
|
593
|
+
|
590
594
|
BucketLifecycleConfiguration.add_member(:rules, Shapes::ShapeRef.new(shape: LifecycleRules, required: true, location_name: "Rule"))
|
591
595
|
BucketLifecycleConfiguration.struct_class = Types::BucketLifecycleConfiguration
|
592
596
|
|
@@ -1544,6 +1548,12 @@ module Aws::S3
|
|
1544
1548
|
|
1545
1549
|
MultipartUploadList.member = Shapes::ShapeRef.new(shape: MultipartUpload)
|
1546
1550
|
|
1551
|
+
NoSuchBucket.struct_class = Types::NoSuchBucket
|
1552
|
+
|
1553
|
+
NoSuchKey.struct_class = Types::NoSuchKey
|
1554
|
+
|
1555
|
+
NoSuchUpload.struct_class = Types::NoSuchUpload
|
1556
|
+
|
1547
1557
|
NoncurrentVersionExpiration.add_member(:noncurrent_days, Shapes::ShapeRef.new(shape: Days, location_name: "NoncurrentDays"))
|
1548
1558
|
NoncurrentVersionExpiration.struct_class = Types::NoncurrentVersionExpiration
|
1549
1559
|
|
@@ -1574,6 +1584,8 @@ module Aws::S3
|
|
1574
1584
|
Object.add_member(:owner, Shapes::ShapeRef.new(shape: Owner, location_name: "Owner"))
|
1575
1585
|
Object.struct_class = Types::Object
|
1576
1586
|
|
1587
|
+
ObjectAlreadyInActiveTierError.struct_class = Types::ObjectAlreadyInActiveTierError
|
1588
|
+
|
1577
1589
|
ObjectIdentifier.add_member(:key, Shapes::ShapeRef.new(shape: ObjectKey, required: true, location_name: "Key"))
|
1578
1590
|
ObjectIdentifier.add_member(:version_id, Shapes::ShapeRef.new(shape: ObjectVersionId, location_name: "VersionId"))
|
1579
1591
|
ObjectIdentifier.struct_class = Types::ObjectIdentifier
|
@@ -1596,6 +1608,8 @@ module Aws::S3
|
|
1596
1608
|
ObjectLockRule.add_member(:default_retention, Shapes::ShapeRef.new(shape: DefaultRetention, location_name: "DefaultRetention"))
|
1597
1609
|
ObjectLockRule.struct_class = Types::ObjectLockRule
|
1598
1610
|
|
1611
|
+
ObjectNotInActiveTierError.struct_class = Types::ObjectNotInActiveTierError
|
1612
|
+
|
1599
1613
|
ObjectVersion.add_member(:etag, Shapes::ShapeRef.new(shape: ETag, location_name: "ETag"))
|
1600
1614
|
ObjectVersion.add_member(:size, Shapes::ShapeRef.new(shape: Size, location_name: "Size"))
|
1601
1615
|
ObjectVersion.add_member(:storage_class, Shapes::ShapeRef.new(shape: ObjectVersionStorageClass, location_name: "StorageClass"))
|
data/lib/aws-sdk-s3/errors.rb
CHANGED
@@ -6,9 +6,108 @@
|
|
6
6
|
# WARNING ABOUT GENERATED CODE
|
7
7
|
|
8
8
|
module Aws::S3
|
9
|
+
|
10
|
+
# When S3 returns an error response, the Ruby SDK constructs and raises an error.
|
11
|
+
# These errors all extend Aws::S3::Errors::ServiceError < {Aws::Errors::ServiceError}
|
12
|
+
#
|
13
|
+
# You can rescue all S3 errors using ServiceError:
|
14
|
+
#
|
15
|
+
# begin
|
16
|
+
# # do stuff
|
17
|
+
# rescue Aws::S3::Errors::ServiceError
|
18
|
+
# # rescues all S3 API errors
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
#
|
22
|
+
# ## Request Context
|
23
|
+
# ServiceError objects have a {Aws::Errors::ServiceError#context #context} method that returns
|
24
|
+
# information about the request that generated the error.
|
25
|
+
# See {Seahorse::Client::RequestContext} for more information.
|
26
|
+
#
|
27
|
+
# ## Error Classes
|
28
|
+
# * {BucketAlreadyExists}
|
29
|
+
# * {BucketAlreadyOwnedByYou}
|
30
|
+
# * {NoSuchBucket}
|
31
|
+
# * {NoSuchKey}
|
32
|
+
# * {NoSuchUpload}
|
33
|
+
# * {ObjectAlreadyInActiveTierError}
|
34
|
+
# * {ObjectNotInActiveTierError}
|
35
|
+
#
|
36
|
+
# Additionally, error classes are dynamically generated for service errors based on the error code
|
37
|
+
# if they are not defined above.
|
9
38
|
module Errors
|
10
39
|
|
11
40
|
extend Aws::Errors::DynamicErrors
|
12
41
|
|
42
|
+
class BucketAlreadyExists < ServiceError
|
43
|
+
|
44
|
+
# @param [Seahorse::Client::RequestContext] context
|
45
|
+
# @param [String] message
|
46
|
+
# @param [Aws::S3::Types::BucketAlreadyExists] data
|
47
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
48
|
+
super(context, message, data)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class BucketAlreadyOwnedByYou < ServiceError
|
53
|
+
|
54
|
+
# @param [Seahorse::Client::RequestContext] context
|
55
|
+
# @param [String] message
|
56
|
+
# @param [Aws::S3::Types::BucketAlreadyOwnedByYou] data
|
57
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
58
|
+
super(context, message, data)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
class NoSuchBucket < ServiceError
|
63
|
+
|
64
|
+
# @param [Seahorse::Client::RequestContext] context
|
65
|
+
# @param [String] message
|
66
|
+
# @param [Aws::S3::Types::NoSuchBucket] data
|
67
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
68
|
+
super(context, message, data)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
class NoSuchKey < ServiceError
|
73
|
+
|
74
|
+
# @param [Seahorse::Client::RequestContext] context
|
75
|
+
# @param [String] message
|
76
|
+
# @param [Aws::S3::Types::NoSuchKey] data
|
77
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
78
|
+
super(context, message, data)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class NoSuchUpload < ServiceError
|
83
|
+
|
84
|
+
# @param [Seahorse::Client::RequestContext] context
|
85
|
+
# @param [String] message
|
86
|
+
# @param [Aws::S3::Types::NoSuchUpload] data
|
87
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
88
|
+
super(context, message, data)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
class ObjectAlreadyInActiveTierError < ServiceError
|
93
|
+
|
94
|
+
# @param [Seahorse::Client::RequestContext] context
|
95
|
+
# @param [String] message
|
96
|
+
# @param [Aws::S3::Types::ObjectAlreadyInActiveTierError] data
|
97
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
98
|
+
super(context, message, data)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
class ObjectNotInActiveTierError < ServiceError
|
103
|
+
|
104
|
+
# @param [Seahorse::Client::RequestContext] context
|
105
|
+
# @param [String] message
|
106
|
+
# @param [Aws::S3::Types::ObjectNotInActiveTierError] data
|
107
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
108
|
+
super(context, message, data)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
13
112
|
end
|
14
113
|
end
|
data/lib/aws-sdk-s3/object.rb
CHANGED
@@ -6,7 +6,6 @@ module Aws
|
|
6
6
|
# This plugin is an implementation detail and may be modified.
|
7
7
|
# @api private
|
8
8
|
class S3Signer < Seahorse::Client::Plugin
|
9
|
-
|
10
9
|
option(:signature_version, 'v4')
|
11
10
|
|
12
11
|
option(:sigv4_signer) do |cfg|
|
@@ -50,7 +49,6 @@ module Aws
|
|
50
49
|
end
|
51
50
|
|
52
51
|
class V4Handler < Seahorse::Client::Handler
|
53
|
-
|
54
52
|
def call(context)
|
55
53
|
Aws::Plugins::SignatureV4.apply_signature(
|
56
54
|
context: context,
|
@@ -64,10 +62,8 @@ module Aws
|
|
64
62
|
def sigv4_signer(context)
|
65
63
|
# If the client was configured with the wrong region,
|
66
64
|
# we have to build a new signer.
|
67
|
-
if
|
68
|
-
|
69
|
-
context[:cached_sigv4_region] != context.config.sigv4_signer.region
|
70
|
-
then
|
65
|
+
if context[:cached_sigv4_region] &&
|
66
|
+
context[:cached_sigv4_region] != context.config.sigv4_signer.region
|
71
67
|
S3Signer.build_v4_signer(
|
72
68
|
region: context[:cached_sigv4_region],
|
73
69
|
credentials: context.config.credentials
|
@@ -76,13 +72,11 @@ module Aws
|
|
76
72
|
context.config.sigv4_signer
|
77
73
|
end
|
78
74
|
end
|
79
|
-
|
80
75
|
end
|
81
76
|
|
82
77
|
# This handler will update the http endpoint when the bucket region
|
83
78
|
# is known/cached.
|
84
79
|
class CachedBucketRegionHandler < Seahorse::Client::Handler
|
85
|
-
|
86
80
|
def call(context)
|
87
81
|
bucket = context.params[:bucket]
|
88
82
|
check_for_cached_region(context, bucket) if bucket
|
@@ -98,7 +92,6 @@ module Aws
|
|
98
92
|
context[:cached_sigv4_region] = cached_region
|
99
93
|
end
|
100
94
|
end
|
101
|
-
|
102
95
|
end
|
103
96
|
|
104
97
|
# This handler detects when a request fails because of a mismatched bucket
|
@@ -106,7 +99,6 @@ module Aws
|
|
106
99
|
# region, then finally a version 4 signed request against the correct
|
107
100
|
# regional endpoint.
|
108
101
|
class BucketRegionErrorHandler < Seahorse::Client::Handler
|
109
|
-
|
110
102
|
def call(context)
|
111
103
|
response = @handler.call(context)
|
112
104
|
handle_region_errors(response)
|
@@ -115,7 +107,9 @@ module Aws
|
|
115
107
|
private
|
116
108
|
|
117
109
|
def handle_region_errors(response)
|
118
|
-
if wrong_sigv4_region?(response) &&
|
110
|
+
if wrong_sigv4_region?(response) &&
|
111
|
+
!fips_region?(response) &&
|
112
|
+
!custom_endpoint?(response)
|
119
113
|
get_region_and_retry(response.context)
|
120
114
|
else
|
121
115
|
response
|
@@ -139,12 +133,17 @@ module Aws
|
|
139
133
|
resp.context.http_request.endpoint.host.include?('fips')
|
140
134
|
end
|
141
135
|
|
136
|
+
def custom_endpoint?(resp)
|
137
|
+
resolved_suffix = Aws::Partitions::EndpointProvider.dns_suffix_for(
|
138
|
+
resp.context.config.region
|
139
|
+
)
|
140
|
+
!resp.context.http_request.endpoint.hostname.include?(resolved_suffix)
|
141
|
+
end
|
142
|
+
|
142
143
|
def wrong_sigv4_region?(resp)
|
143
144
|
resp.context.http_response.status_code == 400 &&
|
144
|
-
|
145
|
-
|
146
|
-
resp.context.http_response.body_contents.match(/<Region>.+?<\/Region>/)
|
147
|
-
)
|
145
|
+
(resp.context.http_response.headers['x-amz-bucket-region'] ||
|
146
|
+
resp.context.http_response.body_contents.match(/<Region>.+?<\/Region>/))
|
148
147
|
end
|
149
148
|
|
150
149
|
def resign_with_new_region(context, actual_region)
|
@@ -162,7 +161,7 @@ module Aws
|
|
162
161
|
|
163
162
|
def region_from_body(body)
|
164
163
|
region = body.match(/<Region>(.+?)<\/Region>/)[1]
|
165
|
-
if region.nil? || region ==
|
164
|
+
if region.nil? || region == ''
|
166
165
|
raise "couldn't get region from body: #{body}"
|
167
166
|
else
|
168
167
|
region
|
@@ -170,32 +169,30 @@ module Aws
|
|
170
169
|
end
|
171
170
|
|
172
171
|
def log_warning(context, actual_region)
|
173
|
-
msg = "S3 client configured for #{context.config.region.inspect} "
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
if logger = context.config.logger
|
172
|
+
msg = "S3 client configured for #{context.config.region.inspect} " \
|
173
|
+
"but the bucket #{context.params[:bucket].inspect} is in " \
|
174
|
+
"#{actual_region.inspect}; Please configure the proper region " \
|
175
|
+
"to avoid multiple unnecessary redirects and signing attempts\n"
|
176
|
+
if (logger = context.config.logger)
|
178
177
|
logger.warn(msg)
|
179
178
|
else
|
180
179
|
warn(msg)
|
181
180
|
end
|
182
181
|
end
|
183
|
-
|
184
182
|
end
|
185
183
|
|
186
184
|
class << self
|
187
|
-
|
188
185
|
# @option options [required, String] :region
|
189
186
|
# @option options [required, #credentials] :credentials
|
190
187
|
# @api private
|
191
188
|
def build_v4_signer(options = {})
|
192
|
-
Aws::Sigv4::Signer.new(
|
189
|
+
Aws::Sigv4::Signer.new(
|
193
190
|
service: 's3',
|
194
191
|
region: options[:region],
|
195
192
|
credentials_provider: options[:credentials],
|
196
193
|
uri_escape_path: false,
|
197
|
-
unsigned_headers: ['content-length', 'x-amzn-trace-id']
|
198
|
-
|
194
|
+
unsigned_headers: ['content-length', 'x-amzn-trace-id']
|
195
|
+
)
|
199
196
|
end
|
200
197
|
|
201
198
|
def new_hostname(context, region)
|
data/lib/aws-sdk-s3/resource.rb
CHANGED
@@ -6,6 +6,13 @@
|
|
6
6
|
# WARNING ABOUT GENERATED CODE
|
7
7
|
|
8
8
|
module Aws::S3
|
9
|
+
# This class provides a resource oriented interface for S3.
|
10
|
+
# To create a resource object:
|
11
|
+
# resource = Aws::S3::Resource.new(region: 'us-west-2')
|
12
|
+
# You can supply a client object with custom configuration that will be used for all resource operations.
|
13
|
+
# If you do not pass +:client+, a default client will be constructed.
|
14
|
+
# client = Aws::S3::Client.new(region: 'us-west-2')
|
15
|
+
# resource = Aws::S3::Resource.new(client: client)
|
9
16
|
class Resource
|
10
17
|
|
11
18
|
# @param options ({})
|
data/lib/aws-sdk-s3/types.rb
CHANGED
@@ -433,6 +433,24 @@ module Aws::S3
|
|
433
433
|
include Aws::Structure
|
434
434
|
end
|
435
435
|
|
436
|
+
# The requested bucket name is not available. The bucket namespace is
|
437
|
+
# shared by all users of the system. Please select a different name and
|
438
|
+
# try again.
|
439
|
+
#
|
440
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/BucketAlreadyExists AWS API Documentation
|
441
|
+
#
|
442
|
+
class BucketAlreadyExists < Aws::EmptyStructure; end
|
443
|
+
|
444
|
+
# The bucket you tried to create already exists, and you own it. Amazon
|
445
|
+
# S3 returns this error in all AWS Regions except in the North Virginia
|
446
|
+
# Region. For legacy compatibility, if you re-create an existing bucket
|
447
|
+
# that you already own in the North Virginia Region, Amazon S3 returns
|
448
|
+
# 200 OK and resets the bucket access control lists (ACLs).
|
449
|
+
#
|
450
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/BucketAlreadyOwnedByYou AWS API Documentation
|
451
|
+
#
|
452
|
+
class BucketAlreadyOwnedByYou < Aws::EmptyStructure; end
|
453
|
+
|
436
454
|
# Specifies the lifecycle configuration for objects in an Amazon S3
|
437
455
|
# bucket. For more information, see [Object Lifecycle Management][1] in
|
438
456
|
# the *Amazon Simple Storage Service Developer Guide*.
|
@@ -7614,6 +7632,24 @@ module Aws::S3
|
|
7614
7632
|
include Aws::Structure
|
7615
7633
|
end
|
7616
7634
|
|
7635
|
+
# The specified bucket does not exist.
|
7636
|
+
#
|
7637
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/NoSuchBucket AWS API Documentation
|
7638
|
+
#
|
7639
|
+
class NoSuchBucket < Aws::EmptyStructure; end
|
7640
|
+
|
7641
|
+
# The specified key does not exist.
|
7642
|
+
#
|
7643
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/NoSuchKey AWS API Documentation
|
7644
|
+
#
|
7645
|
+
class NoSuchKey < Aws::EmptyStructure; end
|
7646
|
+
|
7647
|
+
# The specified multipart upload does not exist.
|
7648
|
+
#
|
7649
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/NoSuchUpload AWS API Documentation
|
7650
|
+
#
|
7651
|
+
class NoSuchUpload < Aws::EmptyStructure; end
|
7652
|
+
|
7617
7653
|
# Specifies when noncurrent object versions expire. Upon expiration,
|
7618
7654
|
# Amazon S3 permanently deletes the noncurrent object versions. You set
|
7619
7655
|
# this lifecycle configuration action on a bucket that has versioning
|
@@ -7896,6 +7932,12 @@ module Aws::S3
|
|
7896
7932
|
include Aws::Structure
|
7897
7933
|
end
|
7898
7934
|
|
7935
|
+
# This operation is not allowed against this storage tier.
|
7936
|
+
#
|
7937
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ObjectAlreadyInActiveTierError AWS API Documentation
|
7938
|
+
#
|
7939
|
+
class ObjectAlreadyInActiveTierError < Aws::EmptyStructure; end
|
7940
|
+
|
7899
7941
|
# Object Identifier is unique value to identify objects.
|
7900
7942
|
#
|
7901
7943
|
# @note When making an API call, you may pass ObjectIdentifier
|
@@ -8026,6 +8068,13 @@ module Aws::S3
|
|
8026
8068
|
include Aws::Structure
|
8027
8069
|
end
|
8028
8070
|
|
8071
|
+
# The source object of the COPY operation is not in the active tier and
|
8072
|
+
# is only stored in Amazon S3 Glacier.
|
8073
|
+
#
|
8074
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ObjectNotInActiveTierError AWS API Documentation
|
8075
|
+
#
|
8076
|
+
class ObjectNotInActiveTierError < Aws::EmptyStructure; end
|
8077
|
+
|
8029
8078
|
# The version of an object.
|
8030
8079
|
#
|
8031
8080
|
# @!attribute [rw] etag
|
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.61.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: 2020-
|
11
|
+
date: 2020-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-kms
|