aws-sdk-s3 1.109.0 → 1.156.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/CHANGELOG.md +352 -0
- 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 +585 -110
- data/lib/aws-sdk-s3/bucket_acl.rb +28 -6
- data/lib/aws-sdk-s3/bucket_cors.rb +34 -10
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +34 -10
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +34 -10
- data/lib/aws-sdk-s3/bucket_logging.rb +35 -6
- data/lib/aws-sdk-s3/bucket_notification.rb +12 -6
- data/lib/aws-sdk-s3/bucket_policy.rb +78 -10
- data/lib/aws-sdk-s3/bucket_region_cache.rb +9 -5
- data/lib/aws-sdk-s3/bucket_request_payment.rb +28 -6
- data/lib/aws-sdk-s3/bucket_tagging.rb +34 -10
- data/lib/aws-sdk-s3/bucket_versioning.rb +72 -14
- data/lib/aws-sdk-s3/bucket_website.rb +34 -10
- data/lib/aws-sdk-s3/client.rb +7900 -3252
- data/lib/aws-sdk-s3/client_api.rb +706 -228
- data/lib/aws-sdk-s3/customizations/bucket.rb +23 -47
- data/lib/aws-sdk-s3/customizations/errors.rb +40 -0
- data/lib/aws-sdk-s3/customizations/object.rb +97 -21
- data/lib/aws-sdk-s3/customizations/types/permanent_redirect.rb +26 -0
- data/lib/aws-sdk-s3/customizations.rb +10 -0
- data/lib/aws-sdk-s3/encryption/client.rb +6 -2
- data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +13 -9
- data/lib/aws-sdk-s3/encryptionV2/client.rb +6 -2
- data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +1 -0
- data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +10 -6
- data/lib/aws-sdk-s3/endpoint_parameters.rb +186 -0
- data/lib/aws-sdk-s3/endpoint_provider.rb +592 -0
- data/lib/aws-sdk-s3/endpoints.rb +2689 -0
- data/lib/aws-sdk-s3/express_credentials.rb +55 -0
- data/lib/aws-sdk-s3/express_credentials_provider.rb +59 -0
- data/lib/aws-sdk-s3/file_downloader.rb +170 -45
- data/lib/aws-sdk-s3/file_uploader.rb +11 -4
- data/lib/aws-sdk-s3/multipart_file_uploader.rb +30 -11
- data/lib/aws-sdk-s3/multipart_stream_uploader.rb +46 -17
- data/lib/aws-sdk-s3/multipart_upload.rb +194 -19
- data/lib/aws-sdk-s3/multipart_upload_part.rb +280 -30
- data/lib/aws-sdk-s3/object.rb +1753 -266
- data/lib/aws-sdk-s3/object_acl.rb +49 -13
- data/lib/aws-sdk-s3/object_copier.rb +7 -5
- data/lib/aws-sdk-s3/object_multipart_copier.rb +46 -22
- data/lib/aws-sdk-s3/object_summary.rb +1497 -221
- data/lib/aws-sdk-s3/object_version.rb +383 -58
- data/lib/aws-sdk-s3/plugins/accelerate.rb +3 -50
- data/lib/aws-sdk-s3/plugins/access_grants.rb +114 -0
- data/lib/aws-sdk-s3/plugins/arn.rb +0 -184
- 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 +1 -49
- data/lib/aws-sdk-s3/plugins/endpoints.rb +274 -0
- data/lib/aws-sdk-s3/plugins/expect_100_continue.rb +2 -1
- data/lib/aws-sdk-s3/plugins/express_session_auth.rb +97 -0
- data/lib/aws-sdk-s3/plugins/http_200_errors.rb +53 -16
- data/lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb +6 -29
- 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 +42 -126
- 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 +28 -37
- data/lib/aws-sdk-s3/resource.rb +89 -13
- data/lib/aws-sdk-s3/types.rb +6544 -4909
- data/lib/aws-sdk-s3.rb +5 -1
- 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 +2381 -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/errors.rbs +34 -0
- data/sig/multipart_upload.rbs +110 -0
- data/sig/multipart_upload_part.rbs +105 -0
- data/sig/object.rbs +442 -0
- data/sig/object_acl.rbs +86 -0
- data/sig/object_summary.rbs +334 -0
- data/sig/object_version.rbs +137 -0
- data/sig/resource.rbs +127 -0
- data/sig/types.rbs +2568 -0
- data/sig/waiters.rbs +95 -0
- metadata +50 -16
- data/lib/aws-sdk-s3/arn/access_point_arn.rb +0 -69
- data/lib/aws-sdk-s3/arn/multi_region_access_point_arn.rb +0 -68
- data/lib/aws-sdk-s3/arn/object_lambda_arn.rb +0 -69
- data/lib/aws-sdk-s3/arn/outpost_access_point_arn.rb +0 -74
- data/lib/aws-sdk-s3/plugins/object_lambda_endpoint.rb +0 -25
data/lib/aws-sdk-s3/presigner.rb
CHANGED
@@ -49,7 +49,8 @@ module Aws
|
|
49
49
|
# before the presigned URL expires. Defaults to 15 minutes. As signature
|
50
50
|
# version 4 has a maximum expiry time of one week for presigned URLs,
|
51
51
|
# attempts to set this value to greater than one week (604800) will
|
52
|
-
# raise an exception.
|
52
|
+
# raise an exception. The min value of this option and the credentials
|
53
|
+
# expiration time is used in the presigned URL.
|
53
54
|
#
|
54
55
|
# @option params [Time] :time (Time.now) The starting time for when the
|
55
56
|
# presigned url becomes active.
|
@@ -96,7 +97,8 @@ module Aws
|
|
96
97
|
# before the presigned URL expires. Defaults to 15 minutes. As signature
|
97
98
|
# version 4 has a maximum expiry time of one week for presigned URLs,
|
98
99
|
# attempts to set this value to greater than one week (604800) will
|
99
|
-
# raise an exception.
|
100
|
+
# raise an exception. The min value of this option and the credentials
|
101
|
+
# expiration time is used in the presigned URL.
|
100
102
|
#
|
101
103
|
# @option params [Time] :time (Time.now) The starting time for when the
|
102
104
|
# presigned url becomes active.
|
@@ -133,7 +135,7 @@ module Aws
|
|
133
135
|
virtual_host = params.delete(:virtual_host)
|
134
136
|
time = params.delete(:time)
|
135
137
|
unsigned_headers = unsigned_headers(params)
|
136
|
-
|
138
|
+
secure = params.delete(:secure) != false
|
137
139
|
expires_in = expires_in(params)
|
138
140
|
|
139
141
|
req = @client.build_request(method, params)
|
@@ -141,7 +143,7 @@ module Aws
|
|
141
143
|
handle_presigned_url_context(req)
|
142
144
|
|
143
145
|
x_amz_headers = sign_but_dont_send(
|
144
|
-
req, expires_in,
|
146
|
+
req, expires_in, secure, time, unsigned_headers, hoist
|
145
147
|
)
|
146
148
|
[req.send_request.data, x_amz_headers]
|
147
149
|
end
|
@@ -151,14 +153,6 @@ module Aws
|
|
151
153
|
BLACKLISTED_HEADERS - whitelist_headers
|
152
154
|
end
|
153
155
|
|
154
|
-
def http_scheme(params)
|
155
|
-
if params.delete(:secure) == false
|
156
|
-
'http'
|
157
|
-
else
|
158
|
-
@client.config.endpoint.scheme
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
156
|
def expires_in(params)
|
163
157
|
if (expires_in = params.delete(:expires_in))
|
164
158
|
if expires_in > ONE_WEEK
|
@@ -175,8 +169,7 @@ module Aws
|
|
175
169
|
end
|
176
170
|
|
177
171
|
def use_bucket_as_hostname(req)
|
178
|
-
req.
|
179
|
-
req.handle do |context|
|
172
|
+
req.handle(priority: 35) do |context|
|
180
173
|
uri = context.http_request.endpoint
|
181
174
|
uri.host = context.params[:bucket]
|
182
175
|
uri.path.sub!("/#{context.params[:bucket]}", '')
|
@@ -197,22 +190,23 @@ module Aws
|
|
197
190
|
|
198
191
|
# @param [Seahorse::Client::Request] req
|
199
192
|
def sign_but_dont_send(
|
200
|
-
req, expires_in,
|
193
|
+
req, expires_in, secure, time, unsigned_headers, hoist = true
|
201
194
|
)
|
202
195
|
x_amz_headers = {}
|
203
196
|
|
204
197
|
http_req = req.context.http_request
|
205
198
|
|
206
199
|
req.handlers.remove(Aws::S3::Plugins::S3Signer::LegacyHandler)
|
207
|
-
req.handlers.remove(Aws::
|
200
|
+
req.handlers.remove(Aws::Plugins::Sign::Handler)
|
208
201
|
req.handlers.remove(Seahorse::Client::Plugins::ContentLength::Handler)
|
202
|
+
req.handlers.remove(Aws::Rest::ContentTypeHandler)
|
203
|
+
req.handlers.remove(Aws::Plugins::InvocationId::Handler)
|
209
204
|
|
210
205
|
req.handle(step: :send) do |context|
|
211
|
-
if
|
212
|
-
|
213
|
-
endpoint.scheme =
|
214
|
-
endpoint.port =
|
215
|
-
http_req.endpoint = URI.parse(endpoint.to_s)
|
206
|
+
# if an endpoint was not provided, force secure or insecure
|
207
|
+
if context.config.regional_endpoint
|
208
|
+
http_req.endpoint.scheme = secure ? 'https' : 'http'
|
209
|
+
http_req.endpoint.port = secure ? 443 : 80
|
216
210
|
end
|
217
211
|
|
218
212
|
query = http_req.endpoint.query ? http_req.endpoint.query.split('&') : []
|
@@ -231,24 +225,21 @@ module Aws
|
|
231
225
|
end
|
232
226
|
http_req.endpoint.query = query.join('&') unless query.empty?
|
233
227
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
signing_algorithm = arn[:arn].is_a?(MultiRegionAccessPointARN) ? :sigv4a : :sigv4
|
242
|
-
end
|
243
|
-
|
228
|
+
auth_scheme = context[:auth_scheme]
|
229
|
+
scheme_name = auth_scheme['name']
|
230
|
+
region = if scheme_name == 'sigv4a'
|
231
|
+
auth_scheme['signingRegionSet'].first
|
232
|
+
else
|
233
|
+
auth_scheme['signingRegion']
|
234
|
+
end
|
244
235
|
signer = Aws::Sigv4::Signer.new(
|
245
|
-
service:
|
246
|
-
region: region || context.config.region,
|
247
|
-
|
248
|
-
|
236
|
+
service: auth_scheme['signingName'] || 's3',
|
237
|
+
region: context[:sigv4_region] || region || context.config.region,
|
238
|
+
credentials_provider: context[:sigv4_credentials] || context.config.credentials,
|
239
|
+
signing_algorithm: scheme_name.to_sym,
|
240
|
+
uri_escape_path: !!!auth_scheme['disableDoubleEncoding'],
|
249
241
|
unsigned_headers: unsigned_headers,
|
250
|
-
apply_checksum_header: false
|
251
|
-
uri_escape_path: false
|
242
|
+
apply_checksum_header: false
|
252
243
|
)
|
253
244
|
|
254
245
|
url = signer.presign_url(
|
data/lib/aws-sdk-s3/resource.rb
CHANGED
@@ -41,7 +41,15 @@ module Aws::S3
|
|
41
41
|
# acl: "private", # accepts private, public-read, public-read-write, authenticated-read
|
42
42
|
# bucket: "BucketName", # required
|
43
43
|
# create_bucket_configuration: {
|
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-southeast-1, ap-southeast-2, ca-central-1, cn-north-1, cn-northwest-1, EU, eu-central-1, eu-north-1, eu-south-1, 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
|
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
|
+
# location: {
|
46
|
+
# type: "AvailabilityZone", # accepts AvailabilityZone
|
47
|
+
# name: "LocationNameAsString",
|
48
|
+
# },
|
49
|
+
# bucket: {
|
50
|
+
# data_redundancy: "SingleAvailabilityZone", # accepts SingleAvailabilityZone
|
51
|
+
# type: "Directory", # accepts Directory
|
52
|
+
# },
|
45
53
|
# },
|
46
54
|
# grant_full_control: "GrantFullControl",
|
47
55
|
# grant_read: "GrantRead",
|
@@ -54,47 +62,113 @@ module Aws::S3
|
|
54
62
|
# @param [Hash] options ({})
|
55
63
|
# @option options [String] :acl
|
56
64
|
# The canned ACL to apply to the bucket.
|
65
|
+
#
|
66
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
67
|
+
#
|
68
|
+
# </note>
|
57
69
|
# @option options [required, String] :bucket
|
58
70
|
# The name of the bucket to create.
|
71
|
+
#
|
72
|
+
# **General purpose buckets** - For information about bucket naming
|
73
|
+
# restrictions, see [Bucket naming rules][1] in the *Amazon S3 User
|
74
|
+
# Guide*.
|
75
|
+
#
|
76
|
+
# <b>Directory buckets </b> - When you use this operation with a
|
77
|
+
# directory bucket, you must use path-style requests in the format
|
78
|
+
# `https://s3express-control.region_code.amazonaws.com/bucket-name `.
|
79
|
+
# Virtual-hosted-style requests aren't supported. Directory bucket
|
80
|
+
# names must be unique in the chosen Availability Zone. Bucket names
|
81
|
+
# must also follow the format ` bucket_base_name--az_id--x-s3` (for
|
82
|
+
# example, ` DOC-EXAMPLE-BUCKET--usw2-az1--x-s3`). For information about
|
83
|
+
# bucket naming restrictions, see [Directory bucket naming rules][2] in
|
84
|
+
# the *Amazon S3 User Guide*
|
85
|
+
#
|
86
|
+
#
|
87
|
+
#
|
88
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html
|
89
|
+
# [2]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-bucket-naming-rules.html
|
59
90
|
# @option options [Types::CreateBucketConfiguration] :create_bucket_configuration
|
60
91
|
# The configuration information for the bucket.
|
61
92
|
# @option options [String] :grant_full_control
|
62
93
|
# Allows grantee the read, write, read ACP, and write ACP permissions on
|
63
94
|
# the bucket.
|
95
|
+
#
|
96
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
97
|
+
#
|
98
|
+
# </note>
|
64
99
|
# @option options [String] :grant_read
|
65
100
|
# Allows grantee to list the objects in the bucket.
|
101
|
+
#
|
102
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
103
|
+
#
|
104
|
+
# </note>
|
66
105
|
# @option options [String] :grant_read_acp
|
67
106
|
# Allows grantee to read the bucket ACL.
|
107
|
+
#
|
108
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
109
|
+
#
|
110
|
+
# </note>
|
68
111
|
# @option options [String] :grant_write
|
69
112
|
# Allows grantee to create new objects in the bucket.
|
70
113
|
#
|
71
114
|
# For the bucket and object owners of existing objects, also allows
|
72
115
|
# deletions and overwrites of those objects.
|
116
|
+
#
|
117
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
118
|
+
#
|
119
|
+
# </note>
|
73
120
|
# @option options [String] :grant_write_acp
|
74
121
|
# Allows grantee to write the ACL for the applicable bucket.
|
122
|
+
#
|
123
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
124
|
+
#
|
125
|
+
# </note>
|
75
126
|
# @option options [Boolean] :object_lock_enabled_for_bucket
|
76
127
|
# Specifies whether you want S3 Object Lock to be enabled for the new
|
77
128
|
# bucket.
|
129
|
+
#
|
130
|
+
# <note markdown="1"> This functionality is not supported for directory buckets.
|
131
|
+
#
|
132
|
+
# </note>
|
78
133
|
# @option options [String] :object_ownership
|
79
134
|
# The container element for object ownership for a bucket's ownership
|
80
135
|
# controls.
|
81
136
|
#
|
82
|
-
# BucketOwnerPreferred - Objects uploaded to the bucket change
|
83
|
-
# to the bucket owner if the objects are uploaded with the
|
137
|
+
# `BucketOwnerPreferred` - Objects uploaded to the bucket change
|
138
|
+
# ownership to the bucket owner if the objects are uploaded with the
|
84
139
|
# `bucket-owner-full-control` canned ACL.
|
85
140
|
#
|
86
|
-
# ObjectWriter - The uploading account will own the object if the
|
87
|
-
# is uploaded with the `bucket-owner-full-control` canned ACL.
|
141
|
+
# `ObjectWriter` - The uploading account will own the object if the
|
142
|
+
# object is uploaded with the `bucket-owner-full-control` canned ACL.
|
143
|
+
#
|
144
|
+
# `BucketOwnerEnforced` - Access control lists (ACLs) are disabled and
|
145
|
+
# no longer affect permissions. The bucket owner automatically owns and
|
146
|
+
# has full control over every object in the bucket. The bucket only
|
147
|
+
# accepts PUT requests that don't specify an ACL or specify bucket
|
148
|
+
# owner full control ACLs (such as the predefined
|
149
|
+
# `bucket-owner-full-control` canned ACL or a custom ACL in XML format
|
150
|
+
# that grants the same permissions).
|
151
|
+
#
|
152
|
+
# By default, `ObjectOwnership` is set to `BucketOwnerEnforced` and ACLs
|
153
|
+
# are disabled. We recommend keeping ACLs disabled, except in uncommon
|
154
|
+
# use cases where you must control access for each object individually.
|
155
|
+
# For more information about S3 Object Ownership, see [Controlling
|
156
|
+
# ownership of objects and disabling ACLs for your bucket][1] in the
|
157
|
+
# *Amazon S3 User Guide*.
|
88
158
|
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
159
|
+
# <note markdown="1"> This functionality is not supported for directory buckets. Directory
|
160
|
+
# buckets use the bucket owner enforced setting for S3 Object Ownership.
|
161
|
+
#
|
162
|
+
# </note>
|
163
|
+
#
|
164
|
+
#
|
165
|
+
#
|
166
|
+
# [1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html
|
95
167
|
# @return [Bucket]
|
96
168
|
def create_bucket(options = {})
|
97
|
-
|
169
|
+
Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
170
|
+
@client.create_bucket(options)
|
171
|
+
end
|
98
172
|
Bucket.new(
|
99
173
|
name: options[:bucket],
|
100
174
|
client: @client
|
@@ -120,7 +194,9 @@ module Aws::S3
|
|
120
194
|
def buckets(options = {})
|
121
195
|
batches = Enumerator.new do |y|
|
122
196
|
batch = []
|
123
|
-
resp =
|
197
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
198
|
+
@client.list_buckets(options)
|
199
|
+
end
|
124
200
|
resp.data.buckets.each do |b|
|
125
201
|
batch << Bucket.new(
|
126
202
|
name: b.name,
|