aws-sdk-s3 1.174.0 → 1.179.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 +32 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-s3/bucket.rb +40 -26
- data/lib/aws-sdk-s3/bucket_acl.rb +5 -4
- data/lib/aws-sdk-s3/bucket_cors.rb +5 -4
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +1 -1
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +2 -2
- data/lib/aws-sdk-s3/bucket_logging.rb +1 -1
- data/lib/aws-sdk-s3/bucket_policy.rb +9 -8
- data/lib/aws-sdk-s3/bucket_request_payment.rb +2 -2
- data/lib/aws-sdk-s3/bucket_tagging.rb +2 -2
- data/lib/aws-sdk-s3/bucket_versioning.rb +6 -6
- data/lib/aws-sdk-s3/bucket_website.rb +2 -2
- data/lib/aws-sdk-s3/client.rb +1409 -867
- data/lib/aws-sdk-s3/client_api.rb +128 -2
- data/lib/aws-sdk-s3/endpoint_provider.rb +36 -0
- data/lib/aws-sdk-s3/endpoints.rb +42 -0
- data/lib/aws-sdk-s3/file_downloader.rb +4 -21
- data/lib/aws-sdk-s3/multipart_file_uploader.rb +31 -13
- data/lib/aws-sdk-s3/multipart_upload.rb +48 -6
- data/lib/aws-sdk-s3/multipart_upload_part.rb +52 -36
- data/lib/aws-sdk-s3/object.rb +111 -59
- data/lib/aws-sdk-s3/object_acl.rb +4 -4
- data/lib/aws-sdk-s3/object_summary.rb +63 -28
- data/lib/aws-sdk-s3/object_version.rb +21 -8
- data/lib/aws-sdk-s3/plugins/checksum_algorithm.rb +31 -0
- data/lib/aws-sdk-s3/plugins/express_session_auth.rb +11 -20
- data/lib/aws-sdk-s3/plugins/md5s.rb +10 -71
- data/lib/aws-sdk-s3/presigner.rb +5 -5
- data/lib/aws-sdk-s3/resource.rb +9 -8
- data/lib/aws-sdk-s3/types.rb +1264 -528
- data/lib/aws-sdk-s3.rb +1 -1
- data/sig/bucket.rbs +5 -4
- data/sig/bucket_acl.rbs +1 -1
- data/sig/bucket_cors.rbs +1 -1
- data/sig/bucket_lifecycle.rbs +1 -1
- data/sig/bucket_lifecycle_configuration.rbs +1 -1
- data/sig/bucket_logging.rbs +1 -1
- data/sig/bucket_policy.rbs +1 -1
- data/sig/bucket_request_payment.rbs +1 -1
- data/sig/bucket_tagging.rbs +1 -1
- data/sig/bucket_versioning.rbs +3 -3
- data/sig/bucket_website.rbs +1 -1
- data/sig/client.rbs +85 -31
- data/sig/multipart_upload.rbs +8 -1
- data/sig/multipart_upload_part.rbs +5 -1
- data/sig/object.rbs +13 -5
- data/sig/object_acl.rbs +1 -1
- data/sig/object_summary.rbs +11 -6
- data/sig/object_version.rbs +5 -2
- data/sig/resource.rbs +4 -2
- data/sig/types.rbs +126 -34
- metadata +5 -5
- data/lib/aws-sdk-s3/plugins/skip_whole_multipart_get_checksums.rb +0 -31
@@ -29,24 +29,17 @@ for different buckets.
|
|
29
29
|
# @api private
|
30
30
|
class Handler < Seahorse::Client::Handler
|
31
31
|
def call(context)
|
32
|
-
if (
|
33
|
-
# S3 Express endpoint - turn off md5 and enable crc32 default
|
34
|
-
if props['backend'] == 'S3Express'
|
35
|
-
if context.operation_name == :put_object || checksum_required?(context)
|
36
|
-
context[:default_request_checksum_algorithm] = 'CRC32'
|
37
|
-
end
|
38
|
-
context[:s3_express_endpoint] = true
|
39
|
-
end
|
32
|
+
context[:s3_express_endpoint] = true if s3_express_endpoint?(context)
|
40
33
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
end
|
34
|
+
# if s3 express auth, use new credentials and sign additional header
|
35
|
+
if context[:auth_scheme]['name'] == 'sigv4-s3express' &&
|
36
|
+
!context.config.disable_s3_express_session_auth
|
37
|
+
bucket = context.params[:bucket]
|
38
|
+
credentials_provider = context.config.express_credentials_provider
|
39
|
+
credentials = credentials_provider.express_credentials_for(bucket)
|
40
|
+
context[:sigv4_credentials] = credentials # Sign will use this
|
49
41
|
end
|
42
|
+
|
50
43
|
with_metric(credentials) { @handler.call(context) }
|
51
44
|
end
|
52
45
|
|
@@ -58,10 +51,8 @@ for different buckets.
|
|
58
51
|
Aws::Plugins::UserAgent.metric('S3_EXPRESS_BUCKET', &block)
|
59
52
|
end
|
60
53
|
|
61
|
-
def
|
62
|
-
context
|
63
|
-
(context.operation.http_checksum &&
|
64
|
-
context.operation.http_checksum['requestChecksumRequired'])
|
54
|
+
def s3_express_endpoint?(context)
|
55
|
+
context[:endpoint_properties]['backend'] == 'S3Express'
|
65
56
|
end
|
66
57
|
end
|
67
58
|
|
@@ -6,81 +6,20 @@ module Aws
|
|
6
6
|
module S3
|
7
7
|
module Plugins
|
8
8
|
# @api private
|
9
|
-
# This plugin is
|
9
|
+
# This plugin is deprecated in favor of modeled
|
10
10
|
# httpChecksumRequired traits.
|
11
11
|
class Md5s < Seahorse::Client::Plugin
|
12
|
-
# These operations allow Content MD5 but are not required by
|
13
|
-
# httpChecksumRequired. This list should not grow.
|
14
|
-
OPTIONAL_OPERATIONS = [
|
15
|
-
:put_object,
|
16
|
-
:upload_part
|
17
|
-
]
|
18
|
-
|
19
|
-
# @api private
|
20
|
-
class Handler < Seahorse::Client::Handler
|
21
|
-
|
22
|
-
CHUNK_SIZE = 1 * 1024 * 1024 # one MB
|
23
|
-
|
24
|
-
def call(context)
|
25
|
-
if !context[:checksum_algorithms] && # skip in favor of flexible checksum
|
26
|
-
!context[:s3_express_endpoint] # s3 express endpoints do not support md5
|
27
|
-
body = context.http_request.body
|
28
|
-
if body.respond_to?(:size) && body.size > 0
|
29
|
-
context.http_request.headers['Content-Md5'] ||= md5(body)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
@handler.call(context)
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
# @param [File, Tempfile, IO#read, String] value
|
38
|
-
# @return [String<MD5>]
|
39
|
-
def md5(value)
|
40
|
-
if (File === value || Tempfile === value) && !value.path.nil? && File.exist?(value.path)
|
41
|
-
OpenSSL::Digest::MD5.file(value).base64digest
|
42
|
-
elsif value.respond_to?(:read)
|
43
|
-
md5 = OpenSSL::Digest::MD5.new
|
44
|
-
update_in_chunks(md5, value)
|
45
|
-
md5.base64digest
|
46
|
-
else
|
47
|
-
OpenSSL::Digest::MD5.digest(value).base64digest
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def update_in_chunks(digest, io)
|
52
|
-
loop do
|
53
|
-
chunk = io.read(CHUNK_SIZE)
|
54
|
-
break unless chunk
|
55
|
-
digest.update(chunk)
|
56
|
-
end
|
57
|
-
io.rewind
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
12
|
option(:compute_checksums,
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
def add_handlers(handlers, config)
|
74
|
-
if config.compute_checksums
|
75
|
-
# priority set low to ensure md5 is computed AFTER the request is
|
76
|
-
# built but before it is signed
|
77
|
-
handlers.add(
|
78
|
-
Handler,
|
79
|
-
priority: 10, step: :build, operations: OPTIONAL_OPERATIONS
|
80
|
-
)
|
81
|
-
end
|
13
|
+
default: true,
|
14
|
+
doc_type: 'Boolean',
|
15
|
+
docstring: <<~DOCS)
|
16
|
+
This option is deprecated. Please use `:request_checksum_calculation` instead.
|
17
|
+
When `false`, `request_checksum_calculation` is overridden to `when_required`.
|
18
|
+
DOCS
|
19
|
+
|
20
|
+
def after_initialize(client)
|
21
|
+
client.config.request_checksum_calculation = 'when_required' unless client.config.compute_checksums
|
82
22
|
end
|
83
|
-
|
84
23
|
end
|
85
24
|
end
|
86
25
|
end
|
data/lib/aws-sdk-s3/presigner.rb
CHANGED
@@ -193,15 +193,14 @@ module Aws
|
|
193
193
|
req, expires_in, secure, time, unsigned_headers, hoist = true
|
194
194
|
)
|
195
195
|
x_amz_headers = {}
|
196
|
-
|
197
196
|
http_req = req.context.http_request
|
198
|
-
|
199
|
-
req.handlers.remove(Aws::S3::Plugins::S3Signer::LegacyHandler)
|
200
|
-
req.handlers.remove(Aws::Plugins::Sign::Handler)
|
201
197
|
req.handlers.remove(Seahorse::Client::Plugins::ContentLength::Handler)
|
202
198
|
req.handlers.remove(Aws::Rest::ContentTypeHandler)
|
199
|
+
req.handlers.remove(Aws::Plugins::ChecksumAlgorithm::OptionHandler)
|
200
|
+
req.handlers.remove(Aws::Plugins::ChecksumAlgorithm::ChecksumHandler)
|
203
201
|
req.handlers.remove(Aws::Plugins::InvocationId::Handler)
|
204
|
-
|
202
|
+
req.handlers.remove(Aws::Plugins::Sign::Handler)
|
203
|
+
req.handlers.remove(Aws::S3::Plugins::S3Signer::LegacyHandler)
|
205
204
|
req.handle(step: :send) do |context|
|
206
205
|
# if an endpoint was not provided, force secure or insecure
|
207
206
|
if context.config.regional_endpoint
|
@@ -238,6 +237,7 @@ module Aws
|
|
238
237
|
credentials_provider: context[:sigv4_credentials] || context.config.credentials,
|
239
238
|
signing_algorithm: scheme_name.to_sym,
|
240
239
|
uri_escape_path: !!!auth_scheme['disableDoubleEncoding'],
|
240
|
+
normalize_path: !!!auth_scheme['disableNormalizePath'],
|
241
241
|
unsigned_headers: unsigned_headers,
|
242
242
|
apply_checksum_header: false
|
243
243
|
)
|
data/lib/aws-sdk-s3/resource.rb
CHANGED
@@ -43,11 +43,11 @@ module Aws::S3
|
|
43
43
|
# create_bucket_configuration: {
|
44
44
|
# location_constraint: "af-south-1", # accepts af-south-1, ap-east-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-south-2, ap-southeast-1, ap-southeast-2, ap-southeast-3, ca-central-1, cn-north-1, cn-northwest-1, EU, eu-central-1, eu-north-1, eu-south-1, eu-south-2, eu-west-1, eu-west-2, eu-west-3, me-south-1, sa-east-1, us-east-2, us-gov-east-1, us-gov-west-1, us-west-1, us-west-2
|
45
45
|
# location: {
|
46
|
-
# type: "AvailabilityZone", # accepts AvailabilityZone
|
46
|
+
# type: "AvailabilityZone", # accepts AvailabilityZone, LocalZone
|
47
47
|
# name: "LocationNameAsString",
|
48
48
|
# },
|
49
49
|
# bucket: {
|
50
|
-
# data_redundancy: "SingleAvailabilityZone", # accepts SingleAvailabilityZone
|
50
|
+
# data_redundancy: "SingleAvailabilityZone", # accepts SingleAvailabilityZone, SingleLocalZone
|
51
51
|
# type: "Directory", # accepts Directory
|
52
52
|
# },
|
53
53
|
# },
|
@@ -75,13 +75,14 @@ module Aws::S3
|
|
75
75
|
#
|
76
76
|
# <b>Directory buckets </b> - When you use this operation with a
|
77
77
|
# directory bucket, you must use path-style requests in the format
|
78
|
-
# `https://s3express-control.
|
78
|
+
# `https://s3express-control.region-code.amazonaws.com/bucket-name `.
|
79
79
|
# Virtual-hosted-style requests aren't supported. Directory bucket
|
80
|
-
# names must be unique in the chosen Availability Zone
|
81
|
-
# must also follow the format `
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
80
|
+
# names must be unique in the chosen Zone (Availability Zone or Local
|
81
|
+
# Zone). Bucket names must also follow the format `
|
82
|
+
# bucket-base-name--zone-id--x-s3` (for example, `
|
83
|
+
# DOC-EXAMPLE-BUCKET--usw2-az1--x-s3`). For information about bucket
|
84
|
+
# naming restrictions, see [Directory bucket naming rules][2] in the
|
85
|
+
# *Amazon S3 User Guide*
|
85
86
|
#
|
86
87
|
#
|
87
88
|
#
|