aws-sdk-s3 1.93.1 → 1.97.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -153,21 +153,35 @@ module Aws
153
153
  # obj.presigned_url(:put, acl: 'public-read')
154
154
  # #=> "https://bucket-name.s3.amazonaws.com/object-key?..."
155
155
  #
156
- # @param [Symbol] http_method
157
- # The HTTP method to generate a presigned URL for. Valid values
158
- # are `:get`, `:put`, `:head`, and `:delete`.
156
+ # @example Pre-signed UploadPart PUT
157
+ #
158
+ # # the object uploaded using this URL will be publicly accessible
159
+ # obj.presigned_url(:upload_part, part_number: 1, upload_id: 'uploadIdToken')
160
+ # #=> "https://bucket-name.s3.amazonaws.com/object-key?..."
161
+ #
162
+ # @param [Symbol] method
163
+ # The S3 operation to generate a presigned URL for. Valid values
164
+ # are `:get`, `:put`, `:head`, `:delete`, `:create_multipart_upload`,
165
+ # `:list_multipart_uploads`, `:complete_multipart_upload`,
166
+ # `:abort_multipart_upload`, `:list_parts`, and `:upload_part`.
159
167
  #
160
168
  # @param [Hash] params
161
169
  # Additional request parameters to use when generating the pre-signed
162
170
  # URL. See the related documentation in {Client} for accepted
163
171
  # params.
164
172
  #
165
- # | HTTP Method | Client Method |
166
- # |---------------|------------------------|
167
- # | `:get` | {Client#get_object} |
168
- # | `:put` | {Client#put_object} |
169
- # | `:head` | {Client#head_object} |
170
- # | `:delete` | {Client#delete_object} |
173
+ # | Method | Client Method |
174
+ # |------------------------------|------------------------------------|
175
+ # | `:get` | {Client#get_object} |
176
+ # | `:put` | {Client#put_object} |
177
+ # | `:head` | {Client#head_object} |
178
+ # | `:delete` | {Client#delete_object} |
179
+ # | `:create_multipart_upload` | {Client#create_multipart_upload} |
180
+ # | `:list_multipart_uploads` | {Client#list_multipart_uploads} |
181
+ # | `:complete_multipart_upload` | {Client#complete_multipart_upload} |
182
+ # | `:abort_multipart_upload` | {Client#abort_multipart_upload} |
183
+ # | `:list_parts` | {Client#list_parts} |
184
+ # | `:upload_part` | {Client#upload_part} |
171
185
  #
172
186
  # @option params [Boolean] :virtual_host (false) When `true` the
173
187
  # presigned URL will use the bucket name as a virtual host.
@@ -188,10 +202,15 @@ module Aws
188
202
  #
189
203
  # @return [String]
190
204
  #
191
- def presigned_url(http_method, params = {})
205
+ def presigned_url(method, params = {})
192
206
  presigner = Presigner.new(client: client)
207
+
208
+ if %w(delete head get put).include?(method.to_s)
209
+ method = "#{method}_object".to_sym
210
+ end
211
+
193
212
  presigner.presigned_url(
194
- "#{http_method.downcase}_object",
213
+ method.downcase,
195
214
  params.merge(bucket: bucket_name, key: key)
196
215
  )
197
216
  end
@@ -165,8 +165,8 @@ module Aws
165
165
  # to initialize the cipher, and the decrypter truncates the
166
166
  # auth tag from the body when writing the final bytes.
167
167
  def authenticated_decrypter(context, cipher, envelope)
168
- if RUBY_VERSION.match(/1.9/)
169
- raise "authenticated decryption not supported by OpenSSL in Ruby version ~> 1.9"
168
+ if RUBY_VERSION.match(/^1.9/)
169
+ msg = 'authenticated decryption not supported by OpenSSL in Ruby version ~> 1.9'
170
170
  raise Aws::Errors::NonSupportedRubyVersionError, msg
171
171
  end
172
172
  http_resp = context.http_response
@@ -166,8 +166,8 @@ module Aws
166
166
  # to initialize the cipher, and the decrypter truncates the
167
167
  # auth tag from the body when writing the final bytes.
168
168
  def authenticated_decrypter(context, cipher, envelope)
169
- if RUBY_VERSION.match(/1.9/)
170
- raise "authenticated decryption not supported by OpenSSL in Ruby version ~> 1.9"
169
+ if RUBY_VERSION.match(/^1.9/)
170
+ msg = 'authenticated decryption not supported by OpenSSL in Ruby version ~> 1.9'
171
171
  raise Aws::Errors::NonSupportedRubyVersionError, msg
172
172
  end
173
173
  http_resp = context.http_response
@@ -9,7 +9,7 @@ module Aws
9
9
  class EncryptHandler < Seahorse::Client::Handler
10
10
 
11
11
  def call(context)
12
- if RUBY_VERSION.match(/1.9/)
12
+ if RUBY_VERSION.match(/^1.9/)
13
13
  raise "authenticated encryption not supported by OpenSSL in Ruby version ~> 1.9"
14
14
  raise Aws::Errors::NonSupportedRubyVersionError, msg
15
15
  end
@@ -94,7 +94,12 @@ module Aws
94
94
  if @chunk_size && @chunk_size > file_size
95
95
  raise ArgumentError, ":chunk_size shouldn't exceed total file size."
96
96
  else
97
- @chunk_size || [(file_size.to_f / MAX_PARTS).ceil, MIN_CHUNK_SIZE].max.to_i
97
+ chunk_size = @chunk_size || [
98
+ (file_size.to_f / MAX_PARTS).ceil,
99
+ MIN_CHUNK_SIZE
100
+ ].max.to_i
101
+ chunk_size -= 1 if file_size % chunk_size == 1
102
+ chunk_size
98
103
  end
99
104
  end
100
105
 
@@ -228,7 +228,7 @@ module Aws::S3
228
228
  # request. Bucket owners need not specify this parameter in their
229
229
  # requests. For information about downloading objects from requester
230
230
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
231
- # in the *Amazon S3 Developer Guide*.
231
+ # in the *Amazon S3 User Guide*.
232
232
  #
233
233
  #
234
234
  #
@@ -270,7 +270,7 @@ module Aws::S3
270
270
  # request. Bucket owners need not specify this parameter in their
271
271
  # requests. For information about downloading objects from requester
272
272
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
273
- # in the *Amazon S3 Developer Guide*.
273
+ # in the *Amazon S3 User Guide*.
274
274
  #
275
275
  #
276
276
  #
@@ -329,7 +329,7 @@ module Aws::S3
329
329
  # request. Bucket owners need not specify this parameter in their
330
330
  # requests. For information about downloading objects from requester
331
331
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
332
- # in the *Amazon S3 Developer Guide*.
332
+ # in the *Amazon S3 User Guide*.
333
333
  #
334
334
  #
335
335
  #
@@ -317,7 +317,7 @@ module Aws::S3
317
317
  # request. Bucket owners need not specify this parameter in their
318
318
  # requests. For information about downloading objects from requester
319
319
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
320
- # in the *Amazon S3 Developer Guide*.
320
+ # in the *Amazon S3 User Guide*.
321
321
  #
322
322
  #
323
323
  #
@@ -384,7 +384,7 @@ module Aws::S3
384
384
  # request. Bucket owners need not specify this parameter in their
385
385
  # requests. For information about downloading objects from requester
386
386
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
387
- # in the *Amazon S3 Developer Guide*.
387
+ # in the *Amazon S3 User Guide*.
388
388
  #
389
389
  #
390
390
  #
@@ -679,7 +679,7 @@ module Aws::S3
679
679
  # and high availability. Depending on performance needs, you can specify
680
680
  # a different Storage Class. Amazon S3 on Outposts only uses the
681
681
  # OUTPOSTS Storage Class. For more information, see [Storage Classes][1]
682
- # in the *Amazon S3 Service Developer Guide*.
682
+ # in the *Amazon S3 User Guide*.
683
683
  #
684
684
  #
685
685
  #
@@ -706,8 +706,8 @@ module Aws::S3
706
706
  # PUT requests for an object protected by AWS KMS will fail if not made
707
707
  # via SSL or using SigV4. For information about configuring using any of
708
708
  # the officially supported AWS SDKs and AWS CLI, see [Specifying the
709
- # Signature Version in Request Authentication][1] in the *Amazon S3
710
- # Developer Guide*.
709
+ # Signature Version in Request Authentication][1] in the *Amazon S3 User
710
+ # Guide*.
711
711
  #
712
712
  #
713
713
  #
@@ -740,7 +740,7 @@ module Aws::S3
740
740
  # request. Bucket owners need not specify this parameter in their
741
741
  # requests. For information about downloading objects from requester
742
742
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
743
- # in the *Amazon S3 Developer Guide*.
743
+ # in the *Amazon S3 User Guide*.
744
744
  #
745
745
  #
746
746
  #
@@ -796,7 +796,7 @@ module Aws::S3
796
796
  # request. Bucket owners need not specify this parameter in their
797
797
  # requests. For information about downloading objects from requester
798
798
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
799
- # in the *Amazon S3 Developer Guide*.
799
+ # in the *Amazon S3 User Guide*.
800
800
  #
801
801
  #
802
802
  #
@@ -898,7 +898,7 @@ module Aws::S3
898
898
  # request. Bucket owners need not specify this parameter in their
899
899
  # requests. For information about downloading objects from requester
900
900
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
901
- # in the *Amazon S3 Developer Guide*.
901
+ # in the *Amazon S3 User Guide*.
902
902
  #
903
903
  #
904
904
  #
@@ -1002,7 +1002,7 @@ module Aws::S3
1002
1002
  # and high availability. Depending on performance needs, you can specify
1003
1003
  # a different Storage Class. Amazon S3 on Outposts only uses the
1004
1004
  # OUTPOSTS Storage Class. For more information, see [Storage Classes][1]
1005
- # in the *Amazon S3 Service Developer Guide*.
1005
+ # in the *Amazon S3 User Guide*.
1006
1006
  #
1007
1007
  #
1008
1008
  #
@@ -1030,7 +1030,7 @@ module Aws::S3
1030
1030
  # protected by AWS KMS will fail if not made via SSL or using SigV4. For
1031
1031
  # information about configuring using any of the officially supported
1032
1032
  # AWS SDKs and AWS CLI, see [Specifying the Signature Version in Request
1033
- # Authentication][1] in the *Amazon S3 Developer Guide*.
1033
+ # Authentication][1] in the *Amazon S3 User Guide*.
1034
1034
  #
1035
1035
  #
1036
1036
  #
@@ -1052,7 +1052,7 @@ module Aws::S3
1052
1052
  # request. Bucket owners need not specify this parameter in their
1053
1053
  # requests. For information about downloading objects from requester
1054
1054
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
1055
- # in the *Amazon S3 Developer Guide*.
1055
+ # in the *Amazon S3 User Guide*.
1056
1056
  #
1057
1057
  #
1058
1058
  #
@@ -1226,7 +1226,7 @@ module Aws::S3
1226
1226
  # and high availability. Depending on performance needs, you can specify
1227
1227
  # a different Storage Class. Amazon S3 on Outposts only uses the
1228
1228
  # OUTPOSTS Storage Class. For more information, see [Storage Classes][1]
1229
- # in the *Amazon S3 Service Developer Guide*.
1229
+ # in the *Amazon S3 User Guide*.
1230
1230
  #
1231
1231
  #
1232
1232
  #
@@ -1273,14 +1273,12 @@ module Aws::S3
1273
1273
  # If `x-amz-server-side-encryption` is present and has the value of
1274
1274
  # `aws:kms`, this header specifies the ID of the AWS Key Management
1275
1275
  # Service (AWS KMS) symmetrical customer managed customer master key
1276
- # (CMK) that was used for the object.
1277
- #
1278
- # If the value of `x-amz-server-side-encryption` is `aws:kms`, this
1279
- # header specifies the ID of the symmetric customer managed AWS KMS CMK
1280
- # that will be used for the object. If you specify
1276
+ # (CMK) that was used for the object. If you specify
1281
1277
  # `x-amz-server-side-encryption:aws:kms`, but do not provide`
1282
1278
  # x-amz-server-side-encryption-aws-kms-key-id`, Amazon S3 uses the AWS
1283
- # managed CMK in AWS to protect the data.
1279
+ # managed CMK in AWS to protect the data. If the KMS key does not exist
1280
+ # in the same account issuing the command, you must use the full ARN and
1281
+ # not just the ID.
1284
1282
  # @option options [String] :ssekms_encryption_context
1285
1283
  # Specifies the AWS KMS Encryption Context to use for object encryption.
1286
1284
  # The value of this header is a base64-encoded UTF-8 string holding JSON
@@ -1298,7 +1296,7 @@ module Aws::S3
1298
1296
  # request. Bucket owners need not specify this parameter in their
1299
1297
  # requests. For information about downloading objects from requester
1300
1298
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
1301
- # in the *Amazon S3 Developer Guide*.
1299
+ # in the *Amazon S3 User Guide*.
1302
1300
  #
1303
1301
  #
1304
1302
  #
@@ -1310,6 +1308,7 @@ module Aws::S3
1310
1308
  # The Object Lock mode that you want to apply to this object.
1311
1309
  # @option options [Time,DateTime,Date,Integer,String] :object_lock_retain_until_date
1312
1310
  # The date and time when you want this object's Object Lock to expire.
1311
+ # Must be formatted as a timestamp parameter.
1313
1312
  # @option options [String] :object_lock_legal_hold_status
1314
1313
  # Specifies whether a legal hold will be applied to this object. For
1315
1314
  # more information about S3 Object Lock, see [Object Lock][1].
@@ -1429,7 +1428,7 @@ module Aws::S3
1429
1428
  # request. Bucket owners need not specify this parameter in their
1430
1429
  # requests. For information about downloading objects from requester
1431
1430
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
1432
- # in the *Amazon S3 Developer Guide*.
1431
+ # in the *Amazon S3 User Guide*.
1433
1432
  #
1434
1433
  #
1435
1434
  #
@@ -1510,7 +1509,7 @@ module Aws::S3
1510
1509
  # request. Bucket owners need not specify this parameter in their
1511
1510
  # requests. For information about downloading objects from requester
1512
1511
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
1513
- # in the *Amazon S3 Developer Guide*.
1512
+ # in the *Amazon S3 User Guide*.
1514
1513
  #
1515
1514
  #
1516
1515
  #
@@ -1659,7 +1658,7 @@ module Aws::S3
1659
1658
  # request. Bucket owners need not specify this parameter in their
1660
1659
  # requests. For information about downloading objects from requester
1661
1660
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
1662
- # in the *Amazon S3 Developer Guide*.
1661
+ # in the *Amazon S3 User Guide*.
1663
1662
  #
1664
1663
  #
1665
1664
  #
@@ -267,8 +267,10 @@ module Aws::S3
267
267
  #
268
268
  # This action is not supported by Amazon S3 on Outposts.
269
269
  # @option options [String] :grant_write
270
- # Allows grantee to create, overwrite, and delete any object in the
271
- # bucket.
270
+ # Allows grantee to create new objects in the bucket.
271
+ #
272
+ # For the bucket and object owners of existing objects, also allows
273
+ # deletions and overwrites of those objects.
272
274
  # @option options [String] :grant_write_acp
273
275
  # Allows grantee to write the ACL for the applicable bucket.
274
276
  #
@@ -278,7 +280,7 @@ module Aws::S3
278
280
  # request. Bucket owners need not specify this parameter in their
279
281
  # requests. For information about downloading objects from requester
280
282
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
281
- # in the *Amazon S3 Developer Guide*.
283
+ # in the *Amazon S3 User Guide*.
282
284
  #
283
285
  #
284
286
  #
@@ -422,7 +422,7 @@ module Aws::S3
422
422
  # and high availability. Depending on performance needs, you can specify
423
423
  # a different Storage Class. Amazon S3 on Outposts only uses the
424
424
  # OUTPOSTS Storage Class. For more information, see [Storage Classes][1]
425
- # in the *Amazon S3 Service Developer Guide*.
425
+ # in the *Amazon S3 User Guide*.
426
426
  #
427
427
  #
428
428
  #
@@ -449,8 +449,8 @@ module Aws::S3
449
449
  # PUT requests for an object protected by AWS KMS will fail if not made
450
450
  # via SSL or using SigV4. For information about configuring using any of
451
451
  # the officially supported AWS SDKs and AWS CLI, see [Specifying the
452
- # Signature Version in Request Authentication][1] in the *Amazon S3
453
- # Developer Guide*.
452
+ # Signature Version in Request Authentication][1] in the *Amazon S3 User
453
+ # Guide*.
454
454
  #
455
455
  #
456
456
  #
@@ -483,7 +483,7 @@ module Aws::S3
483
483
  # request. Bucket owners need not specify this parameter in their
484
484
  # requests. For information about downloading objects from requester
485
485
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
486
- # in the *Amazon S3 Developer Guide*.
486
+ # in the *Amazon S3 User Guide*.
487
487
  #
488
488
  #
489
489
  #
@@ -539,7 +539,7 @@ module Aws::S3
539
539
  # request. Bucket owners need not specify this parameter in their
540
540
  # requests. For information about downloading objects from requester
541
541
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
542
- # in the *Amazon S3 Developer Guide*.
542
+ # in the *Amazon S3 User Guide*.
543
543
  #
544
544
  #
545
545
  #
@@ -641,7 +641,7 @@ module Aws::S3
641
641
  # request. Bucket owners need not specify this parameter in their
642
642
  # requests. For information about downloading objects from requester
643
643
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
644
- # in the *Amazon S3 Developer Guide*.
644
+ # in the *Amazon S3 User Guide*.
645
645
  #
646
646
  #
647
647
  #
@@ -745,7 +745,7 @@ module Aws::S3
745
745
  # and high availability. Depending on performance needs, you can specify
746
746
  # a different Storage Class. Amazon S3 on Outposts only uses the
747
747
  # OUTPOSTS Storage Class. For more information, see [Storage Classes][1]
748
- # in the *Amazon S3 Service Developer Guide*.
748
+ # in the *Amazon S3 User Guide*.
749
749
  #
750
750
  #
751
751
  #
@@ -773,7 +773,7 @@ module Aws::S3
773
773
  # protected by AWS KMS will fail if not made via SSL or using SigV4. For
774
774
  # information about configuring using any of the officially supported
775
775
  # AWS SDKs and AWS CLI, see [Specifying the Signature Version in Request
776
- # Authentication][1] in the *Amazon S3 Developer Guide*.
776
+ # Authentication][1] in the *Amazon S3 User Guide*.
777
777
  #
778
778
  #
779
779
  #
@@ -795,7 +795,7 @@ module Aws::S3
795
795
  # request. Bucket owners need not specify this parameter in their
796
796
  # requests. For information about downloading objects from requester
797
797
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
798
- # in the *Amazon S3 Developer Guide*.
798
+ # in the *Amazon S3 User Guide*.
799
799
  #
800
800
  #
801
801
  #
@@ -969,7 +969,7 @@ module Aws::S3
969
969
  # and high availability. Depending on performance needs, you can specify
970
970
  # a different Storage Class. Amazon S3 on Outposts only uses the
971
971
  # OUTPOSTS Storage Class. For more information, see [Storage Classes][1]
972
- # in the *Amazon S3 Service Developer Guide*.
972
+ # in the *Amazon S3 User Guide*.
973
973
  #
974
974
  #
975
975
  #
@@ -1016,14 +1016,12 @@ module Aws::S3
1016
1016
  # If `x-amz-server-side-encryption` is present and has the value of
1017
1017
  # `aws:kms`, this header specifies the ID of the AWS Key Management
1018
1018
  # Service (AWS KMS) symmetrical customer managed customer master key
1019
- # (CMK) that was used for the object.
1020
- #
1021
- # If the value of `x-amz-server-side-encryption` is `aws:kms`, this
1022
- # header specifies the ID of the symmetric customer managed AWS KMS CMK
1023
- # that will be used for the object. If you specify
1019
+ # (CMK) that was used for the object. If you specify
1024
1020
  # `x-amz-server-side-encryption:aws:kms`, but do not provide`
1025
1021
  # x-amz-server-side-encryption-aws-kms-key-id`, Amazon S3 uses the AWS
1026
- # managed CMK in AWS to protect the data.
1022
+ # managed CMK in AWS to protect the data. If the KMS key does not exist
1023
+ # in the same account issuing the command, you must use the full ARN and
1024
+ # not just the ID.
1027
1025
  # @option options [String] :ssekms_encryption_context
1028
1026
  # Specifies the AWS KMS Encryption Context to use for object encryption.
1029
1027
  # The value of this header is a base64-encoded UTF-8 string holding JSON
@@ -1041,7 +1039,7 @@ module Aws::S3
1041
1039
  # request. Bucket owners need not specify this parameter in their
1042
1040
  # requests. For information about downloading objects from requester
1043
1041
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
1044
- # in the *Amazon S3 Developer Guide*.
1042
+ # in the *Amazon S3 User Guide*.
1045
1043
  #
1046
1044
  #
1047
1045
  #
@@ -1053,6 +1051,7 @@ module Aws::S3
1053
1051
  # The Object Lock mode that you want to apply to this object.
1054
1052
  # @option options [Time,DateTime,Date,Integer,String] :object_lock_retain_until_date
1055
1053
  # The date and time when you want this object's Object Lock to expire.
1054
+ # Must be formatted as a timestamp parameter.
1056
1055
  # @option options [String] :object_lock_legal_hold_status
1057
1056
  # Specifies whether a legal hold will be applied to this object. For
1058
1057
  # more information about S3 Object Lock, see [Object Lock][1].
@@ -1172,7 +1171,7 @@ module Aws::S3
1172
1171
  # request. Bucket owners need not specify this parameter in their
1173
1172
  # requests. For information about downloading objects from requester
1174
1173
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
1175
- # in the *Amazon S3 Developer Guide*.
1174
+ # in the *Amazon S3 User Guide*.
1176
1175
  #
1177
1176
  #
1178
1177
  #
@@ -1325,7 +1324,7 @@ module Aws::S3
1325
1324
  # request. Bucket owners need not specify this parameter in their
1326
1325
  # requests. For information about downloading objects from requester
1327
1326
  # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
1328
- # in the *Amazon S3 Developer Guide*.
1327
+ # in the *Amazon S3 User Guide*.
1329
1328
  #
1330
1329
  #
1331
1330
  #