aws-sdk-s3 1.147.0 → 1.152.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +48 -2
- data/VERSION +1 -1
- data/lib/aws-sdk-s3/access_grants_credentials.rb +57 -0
- data/lib/aws-sdk-s3/access_grants_credentials_provider.rb +241 -0
- data/lib/aws-sdk-s3/bucket.rb +10 -10
- data/lib/aws-sdk-s3/bucket_acl.rb +3 -3
- data/lib/aws-sdk-s3/bucket_cors.rb +4 -4
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +4 -4
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +4 -4
- data/lib/aws-sdk-s3/bucket_logging.rb +3 -3
- data/lib/aws-sdk-s3/bucket_notification.rb +3 -3
- data/lib/aws-sdk-s3/bucket_policy.rb +4 -4
- data/lib/aws-sdk-s3/bucket_region_cache.rb +9 -5
- data/lib/aws-sdk-s3/bucket_request_payment.rb +3 -3
- data/lib/aws-sdk-s3/bucket_tagging.rb +4 -4
- data/lib/aws-sdk-s3/bucket_versioning.rb +5 -5
- data/lib/aws-sdk-s3/bucket_website.rb +4 -4
- data/lib/aws-sdk-s3/client.rb +174 -138
- data/lib/aws-sdk-s3/client_api.rb +3 -2
- data/lib/aws-sdk-s3/customizations/bucket.rb +1 -1
- data/lib/aws-sdk-s3/customizations/errors.rb +15 -2
- data/lib/aws-sdk-s3/customizations/object.rb +5 -5
- data/lib/aws-sdk-s3/customizations.rb +4 -1
- data/lib/aws-sdk-s3/encryption/client.rb +2 -2
- data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +2 -2
- data/lib/aws-sdk-s3/encryptionV2/client.rb +2 -2
- data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +2 -2
- data/lib/aws-sdk-s3/endpoint_parameters.rb +8 -0
- data/lib/aws-sdk-s3/endpoint_provider.rb +1 -0
- data/lib/aws-sdk-s3/endpoints.rb +100 -1
- data/lib/aws-sdk-s3/express_credentials_provider.rb +27 -4
- data/lib/aws-sdk-s3/file_downloader.rb +1 -1
- data/lib/aws-sdk-s3/file_uploader.rb +1 -1
- data/lib/aws-sdk-s3/multipart_stream_uploader.rb +1 -1
- data/lib/aws-sdk-s3/multipart_upload.rb +4 -4
- data/lib/aws-sdk-s3/multipart_upload_part.rb +3 -3
- data/lib/aws-sdk-s3/object.rb +12 -12
- data/lib/aws-sdk-s3/object_acl.rb +3 -3
- data/lib/aws-sdk-s3/object_copier.rb +1 -1
- data/lib/aws-sdk-s3/object_multipart_copier.rb +10 -8
- data/lib/aws-sdk-s3/object_summary.rb +10 -10
- data/lib/aws-sdk-s3/object_version.rb +5 -5
- data/lib/aws-sdk-s3/plugins/access_grants.rb +114 -0
- data/lib/aws-sdk-s3/plugins/express_session_auth.rb +8 -2
- data/lib/aws-sdk-s3/plugins/http_200_errors.rb +53 -16
- data/lib/aws-sdk-s3/plugins/s3_signer.rb +7 -2
- data/lib/aws-sdk-s3/presigner.rb +1 -0
- data/lib/aws-sdk-s3/resource.rb +2 -2
- data/lib/aws-sdk-s3.rb +1 -1
- data/sig/client.rbs +2 -0
- data/sig/customizations/bucket.rbs +19 -0
- data/sig/customizations/object.rbs +38 -0
- data/sig/customizations/object_summary.rbs +35 -0
- data/sig/resource.rbs +2 -0
- metadata +10 -5
- data/lib/aws-sdk-s3/express_credentials_cache.rb +0 -30
@@ -15,22 +15,67 @@ module Aws
|
|
15
15
|
|
16
16
|
def call(context)
|
17
17
|
@handler.call(context).on(200) do |response|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
return response if streaming_output?(context.operation.output)
|
19
|
+
|
20
|
+
error = check_for_error(context)
|
21
|
+
return response unless error
|
22
|
+
|
23
|
+
context.http_response.status_code = 500
|
24
|
+
response.data = nil
|
25
|
+
response.error = error
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
# Streaming outputs are not subject to 200 errors.
|
32
|
+
def streaming_output?(output)
|
33
|
+
if (payload = output[:payload_member])
|
34
|
+
# checking ref and shape
|
35
|
+
payload['streaming'] || payload.shape['streaming'] ||
|
36
|
+
payload.eventstream
|
37
|
+
else
|
38
|
+
false
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Checks if the output shape is a structure shape and has members that
|
43
|
+
# are in the body for the case of a payload and a normal structure. A
|
44
|
+
# non-structure shape will not have members in the body. In the case
|
45
|
+
# of a string or blob, the body contents would have been checked first
|
46
|
+
# before this method is called in incomplete_xml_body?.
|
47
|
+
def members_in_body?(output)
|
48
|
+
shape =
|
49
|
+
if output[:payload_member]
|
50
|
+
output[:payload_member].shape
|
51
|
+
else
|
52
|
+
output.shape
|
22
53
|
end
|
54
|
+
|
55
|
+
if structure_shape?(shape)
|
56
|
+
shape.members.any? { |_, k| k.location.nil? }
|
57
|
+
else
|
58
|
+
false
|
23
59
|
end
|
24
60
|
end
|
25
61
|
|
62
|
+
def structure_shape?(shape)
|
63
|
+
shape.is_a?(Seahorse::Model::Shapes::StructureShape)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Must have a member in the body and have the start of an XML Tag.
|
67
|
+
# Other incomplete xml bodies will result in an XML ParsingError.
|
68
|
+
def incomplete_xml_body?(xml, output)
|
69
|
+
members_in_body?(output) && !xml.match(/<\w/)
|
70
|
+
end
|
71
|
+
|
26
72
|
def check_for_error(context)
|
27
73
|
xml = context.http_response.body_contents
|
28
|
-
if xml.match(
|
74
|
+
if xml.match(/\?>\s*<Error>/)
|
29
75
|
error_code = xml.match(/<Code>(.+?)<\/Code>/)[1]
|
30
76
|
error_message = xml.match(/<Message>(.+?)<\/Message>/)[1]
|
31
77
|
S3::Errors.error_class(error_code).new(context, error_message)
|
32
|
-
elsif
|
33
|
-
# Other incomplete xml bodies will result in XML ParsingError
|
78
|
+
elsif incomplete_xml_body?(xml, context.operation.output)
|
34
79
|
Seahorse::Client::NetworkingError.new(
|
35
80
|
S3::Errors
|
36
81
|
.error_class('InternalError')
|
@@ -40,15 +85,7 @@ module Aws
|
|
40
85
|
end
|
41
86
|
end
|
42
87
|
|
43
|
-
handler(
|
44
|
-
Handler,
|
45
|
-
step: :sign,
|
46
|
-
operations: [
|
47
|
-
:complete_multipart_upload,
|
48
|
-
:copy_object,
|
49
|
-
:upload_part_copy,
|
50
|
-
]
|
51
|
-
)
|
88
|
+
handler(Handler, step: :sign)
|
52
89
|
end
|
53
90
|
end
|
54
91
|
end
|
@@ -4,6 +4,11 @@ require 'aws-sigv4'
|
|
4
4
|
|
5
5
|
module Aws
|
6
6
|
module S3
|
7
|
+
# @api private
|
8
|
+
def self.bucket_region_cache
|
9
|
+
@bucket_region_cache ||= BucketRegionCache.new
|
10
|
+
end
|
11
|
+
|
7
12
|
module Plugins
|
8
13
|
# This plugin used to have a V4 signer but it was removed in favor of
|
9
14
|
# generic Sign plugin that uses endpoint auth scheme.
|
@@ -51,7 +56,7 @@ module Aws
|
|
51
56
|
private
|
52
57
|
|
53
58
|
def check_for_cached_region(context, bucket)
|
54
|
-
cached_region = S3
|
59
|
+
cached_region = Aws::S3.bucket_region_cache[bucket]
|
55
60
|
if cached_region &&
|
56
61
|
cached_region != context.config.region &&
|
57
62
|
!S3Signer.custom_endpoint?(context)
|
@@ -97,7 +102,7 @@ module Aws
|
|
97
102
|
end
|
98
103
|
|
99
104
|
def update_bucket_cache(context, actual_region)
|
100
|
-
S3
|
105
|
+
Aws::S3.bucket_region_cache[context.params[:bucket]] = actual_region
|
101
106
|
end
|
102
107
|
|
103
108
|
def fips_region?(resp)
|
data/lib/aws-sdk-s3/presigner.rb
CHANGED
@@ -200,6 +200,7 @@ module Aws
|
|
200
200
|
req.handlers.remove(Aws::Plugins::Sign::Handler)
|
201
201
|
req.handlers.remove(Seahorse::Client::Plugins::ContentLength::Handler)
|
202
202
|
req.handlers.remove(Aws::Rest::ContentTypeHandler)
|
203
|
+
req.handlers.remove(Aws::Plugins::InvocationId::Handler)
|
203
204
|
|
204
205
|
req.handle(step: :send) do |context|
|
205
206
|
# if an endpoint was not provided, force secure or insecure
|
data/lib/aws-sdk-s3/resource.rb
CHANGED
@@ -166,7 +166,7 @@ module Aws::S3
|
|
166
166
|
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html
|
167
167
|
# @return [Bucket]
|
168
168
|
def create_bucket(options = {})
|
169
|
-
Aws::Plugins::UserAgent.
|
169
|
+
Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
170
170
|
@client.create_bucket(options)
|
171
171
|
end
|
172
172
|
Bucket.new(
|
@@ -194,7 +194,7 @@ module Aws::S3
|
|
194
194
|
def buckets(options = {})
|
195
195
|
batches = Enumerator.new do |y|
|
196
196
|
batch = []
|
197
|
-
resp = Aws::Plugins::UserAgent.
|
197
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
198
198
|
@client.list_buckets(options)
|
199
199
|
end
|
200
200
|
resp.data.buckets.each do |b|
|
data/lib/aws-sdk-s3.rb
CHANGED
data/sig/client.rbs
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Aws
|
2
|
+
module S3
|
3
|
+
class Bucket
|
4
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Bucket.html#clear!-instance_method
|
5
|
+
def clear!: () -> void
|
6
|
+
|
7
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Bucket.html#delete!-instance_method
|
8
|
+
def delete!: (?max_attempts: ::Integer, ?initial_wait: ::Float) -> void
|
9
|
+
| (?Hash[Symbol, untyped]) -> void
|
10
|
+
|
11
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Bucket.html#url-instance_method
|
12
|
+
def url: (?virtual_host: boolish, ?secure: boolish) -> String
|
13
|
+
| (?Hash[Symbol, untyped]) -> String
|
14
|
+
|
15
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Bucket.html#presigned_post-instance_method
|
16
|
+
def presigned_post: (Hash[Symbol, untyped]) -> untyped
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Aws
|
2
|
+
module S3
|
3
|
+
class Object
|
4
|
+
alias size content_length
|
5
|
+
|
6
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Object.html#copy_from-instance_method
|
7
|
+
def copy_from: (untyped source, ?Hash[Symbol, untyped] options) -> void
|
8
|
+
| ...
|
9
|
+
|
10
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Object.html#copy_to-instance_method
|
11
|
+
def copy_to: (untyped target, ?Hash[Symbol, untyped] options) -> void
|
12
|
+
|
13
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Object.html#move_to-instance_method
|
14
|
+
def move_to: (untyped target, ?Hash[Symbol, untyped] options) -> void
|
15
|
+
|
16
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Object.html#presigned_post-instance_method
|
17
|
+
def presigned_post: (?Hash[Symbol, untyped]) -> untyped
|
18
|
+
|
19
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Object.html#presigned_url-instance_method
|
20
|
+
def presigned_url: (Symbol | String method, ?Hash[Symbol, untyped] params) -> String
|
21
|
+
|
22
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Object.html#presigned_request-instance_method
|
23
|
+
def presigned_request: (Symbol | String method, ?Hash[Symbol, untyped] params) -> [String, Hash[String, String]]
|
24
|
+
|
25
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Object.html#public_url-instance_method
|
26
|
+
def public_url: (?Hash[Symbol, untyped] options) -> String
|
27
|
+
|
28
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Object.html#upload_stream-instance_method
|
29
|
+
def upload_stream: (?Hash[Symbol, untyped] options) { (IO write_stream) -> void } -> bool
|
30
|
+
|
31
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Object.html#upload_file-instance_method
|
32
|
+
def upload_file: (untyped source, ?Hash[Symbol, untyped] options) ?{ (untyped response) -> void } -> bool
|
33
|
+
|
34
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Object.html#download_file-instance_method
|
35
|
+
def download_file: (String destination, ?Hash[Symbol, untyped] options) -> bool
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Aws
|
2
|
+
module S3
|
3
|
+
class ObjectSummary
|
4
|
+
alias content_length size
|
5
|
+
|
6
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/ObjectSummary.html#copy_from-instance_method
|
7
|
+
def copy_from: (untyped source, ?Hash[Symbol, untyped] options) -> void
|
8
|
+
| ...
|
9
|
+
|
10
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/ObjectSummary.html#copy_to-instance_method
|
11
|
+
def copy_to: (untyped target, ?Hash[Symbol, untyped] options) -> void
|
12
|
+
|
13
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/ObjectSummary.html#move_to-instance_method
|
14
|
+
def move_to: (untyped target, ?Hash[Symbol, untyped] options) -> void
|
15
|
+
|
16
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/ObjectSummary.html#presigned_post-instance_method
|
17
|
+
def presigned_post: (Hash[Symbol, untyped]) -> untyped
|
18
|
+
|
19
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/ObjectSummary.html#presigned_url-instance_method
|
20
|
+
def presigned_url: (Symbol | String method, ?Hash[Symbol, untyped] params) -> String
|
21
|
+
|
22
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/ObjectSummary.html#public_url-instance_method
|
23
|
+
def public_url: (?Hash[Symbol, untyped] options) -> String
|
24
|
+
|
25
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/ObjectSummary.html#upload_file-instance_method
|
26
|
+
def upload_file: (untyped source, ?Hash[Symbol, untyped] options) ?{ (untyped response) -> void } -> bool
|
27
|
+
|
28
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/ObjectSummary.html#upload_stream-instance_method
|
29
|
+
def upload_stream: (?Hash[Symbol, untyped] options) { (IO write_stream) -> void } -> bool
|
30
|
+
|
31
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/ObjectSummary.html#download_file-instance_method
|
32
|
+
def download_file: (String destination, ?Hash[Symbol, untyped] options) -> bool
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/sig/resource.rbs
CHANGED
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.152.3
|
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: 2024-
|
11
|
+
date: 2024-06-13 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.197.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.197.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:
|
@@ -70,6 +70,8 @@ files:
|
|
70
70
|
- LICENSE.txt
|
71
71
|
- VERSION
|
72
72
|
- lib/aws-sdk-s3.rb
|
73
|
+
- lib/aws-sdk-s3/access_grants_credentials.rb
|
74
|
+
- lib/aws-sdk-s3/access_grants_credentials_provider.rb
|
73
75
|
- lib/aws-sdk-s3/bucket.rb
|
74
76
|
- lib/aws-sdk-s3/bucket_acl.rb
|
75
77
|
- lib/aws-sdk-s3/bucket_cors.rb
|
@@ -127,7 +129,6 @@ files:
|
|
127
129
|
- lib/aws-sdk-s3/errors.rb
|
128
130
|
- lib/aws-sdk-s3/event_streams.rb
|
129
131
|
- lib/aws-sdk-s3/express_credentials.rb
|
130
|
-
- lib/aws-sdk-s3/express_credentials_cache.rb
|
131
132
|
- lib/aws-sdk-s3/express_credentials_provider.rb
|
132
133
|
- lib/aws-sdk-s3/file_downloader.rb
|
133
134
|
- lib/aws-sdk-s3/file_part.rb
|
@@ -145,6 +146,7 @@ files:
|
|
145
146
|
- lib/aws-sdk-s3/object_summary.rb
|
146
147
|
- lib/aws-sdk-s3/object_version.rb
|
147
148
|
- lib/aws-sdk-s3/plugins/accelerate.rb
|
149
|
+
- lib/aws-sdk-s3/plugins/access_grants.rb
|
148
150
|
- lib/aws-sdk-s3/plugins/arn.rb
|
149
151
|
- lib/aws-sdk-s3/plugins/bucket_dns.rb
|
150
152
|
- lib/aws-sdk-s3/plugins/bucket_name_restrictions.rb
|
@@ -182,6 +184,9 @@ files:
|
|
182
184
|
- sig/bucket_versioning.rbs
|
183
185
|
- sig/bucket_website.rbs
|
184
186
|
- sig/client.rbs
|
187
|
+
- sig/customizations/bucket.rbs
|
188
|
+
- sig/customizations/object.rbs
|
189
|
+
- sig/customizations/object_summary.rbs
|
185
190
|
- sig/errors.rbs
|
186
191
|
- sig/multipart_upload.rbs
|
187
192
|
- sig/multipart_upload_part.rbs
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Aws
|
4
|
-
module S3
|
5
|
-
# @api private
|
6
|
-
class ExpressCredentialsCache
|
7
|
-
def initialize
|
8
|
-
@credentials = {}
|
9
|
-
@mutex = Mutex.new
|
10
|
-
end
|
11
|
-
|
12
|
-
def [](bucket_name)
|
13
|
-
@mutex.synchronize { @credentials[bucket_name] }
|
14
|
-
end
|
15
|
-
|
16
|
-
def []=(bucket_name, credential_provider)
|
17
|
-
@mutex.synchronize do
|
18
|
-
@credentials[bucket_name] = credential_provider
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def clear
|
23
|
-
@mutex.synchronize { @credentials = {} }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# @api private
|
28
|
-
EXPRESS_CREDENTIALS_CACHE = ExpressCredentialsCache.new
|
29
|
-
end
|
30
|
-
end
|