aws-sdk-s3 1.102.0 → 1.112.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.
@@ -22,6 +22,7 @@ module Aws::S3
22
22
  AcceptRanges = Shapes::StringShape.new(name: 'AcceptRanges')
23
23
  AccessControlPolicy = Shapes::StructureShape.new(name: 'AccessControlPolicy')
24
24
  AccessControlTranslation = Shapes::StructureShape.new(name: 'AccessControlTranslation')
25
+ AccessPointArn = Shapes::StringShape.new(name: 'AccessPointArn')
25
26
  AccountId = Shapes::StringShape.new(name: 'AccountId')
26
27
  AllowQuotedRecordDelimiter = Shapes::BooleanShape.new(name: 'AllowQuotedRecordDelimiter')
27
28
  AllowedHeader = Shapes::StringShape.new(name: 'AllowedHeader')
@@ -157,6 +158,7 @@ module Aws::S3
157
158
  ErrorMessage = Shapes::StringShape.new(name: 'ErrorMessage')
158
159
  Errors = Shapes::ListShape.new(name: 'Errors', flattened: true)
159
160
  Event = Shapes::StringShape.new(name: 'Event')
161
+ EventBridgeConfiguration = Shapes::StructureShape.new(name: 'EventBridgeConfiguration')
160
162
  EventList = Shapes::ListShape.new(name: 'EventList', flattened: true)
161
163
  ExistingObjectReplication = Shapes::StructureShape.new(name: 'ExistingObjectReplication')
162
164
  ExistingObjectReplicationStatus = Shapes::StringShape.new(name: 'ExistingObjectReplicationStatus')
@@ -385,6 +387,8 @@ module Aws::S3
385
387
  ObjectLockToken = Shapes::StringShape.new(name: 'ObjectLockToken')
386
388
  ObjectNotInActiveTierError = Shapes::StructureShape.new(name: 'ObjectNotInActiveTierError')
387
389
  ObjectOwnership = Shapes::StringShape.new(name: 'ObjectOwnership')
390
+ ObjectSizeGreaterThanBytes = Shapes::IntegerShape.new(name: 'ObjectSizeGreaterThanBytes')
391
+ ObjectSizeLessThanBytes = Shapes::IntegerShape.new(name: 'ObjectSizeLessThanBytes')
388
392
  ObjectStorageClass = Shapes::StringShape.new(name: 'ObjectStorageClass')
389
393
  ObjectVersion = Shapes::StructureShape.new(name: 'ObjectVersion')
390
394
  ObjectVersionId = Shapes::StringShape.new(name: 'ObjectVersionId')
@@ -518,6 +522,7 @@ module Aws::S3
518
522
  ServerSideEncryptionRules = Shapes::ListShape.new(name: 'ServerSideEncryptionRules', flattened: true)
519
523
  Setting = Shapes::BooleanShape.new(name: 'Setting')
520
524
  Size = Shapes::IntegerShape.new(name: 'Size')
525
+ SkipValidation = Shapes::BooleanShape.new(name: 'SkipValidation')
521
526
  SourceSelectionCriteria = Shapes::StructureShape.new(name: 'SourceSelectionCriteria')
522
527
  SseKmsEncryptedObjects = Shapes::StructureShape.new(name: 'SseKmsEncryptedObjects')
523
528
  SseKmsEncryptedObjectsStatus = Shapes::StringShape.new(name: 'SseKmsEncryptedObjectsStatus')
@@ -560,6 +565,7 @@ module Aws::S3
560
565
  UploadPartRequest = Shapes::StructureShape.new(name: 'UploadPartRequest')
561
566
  UserMetadata = Shapes::ListShape.new(name: 'UserMetadata')
562
567
  Value = Shapes::StringShape.new(name: 'Value')
568
+ VersionCount = Shapes::IntegerShape.new(name: 'VersionCount')
563
569
  VersionIdMarker = Shapes::StringShape.new(name: 'VersionIdMarker')
564
570
  VersioningConfiguration = Shapes::StructureShape.new(name: 'VersioningConfiguration')
565
571
  WebsiteConfiguration = Shapes::StructureShape.new(name: 'WebsiteConfiguration')
@@ -795,6 +801,7 @@ module Aws::S3
795
801
  CreateBucketRequest.add_member(:grant_write, Shapes::ShapeRef.new(shape: GrantWrite, location: "header", location_name: "x-amz-grant-write"))
796
802
  CreateBucketRequest.add_member(:grant_write_acp, Shapes::ShapeRef.new(shape: GrantWriteACP, location: "header", location_name: "x-amz-grant-write-acp"))
797
803
  CreateBucketRequest.add_member(:object_lock_enabled_for_bucket, Shapes::ShapeRef.new(shape: ObjectLockEnabledForBucket, location: "header", location_name: "x-amz-bucket-object-lock-enabled"))
804
+ CreateBucketRequest.add_member(:object_ownership, Shapes::ShapeRef.new(shape: ObjectOwnership, location: "header", location_name: "x-amz-object-ownership"))
798
805
  CreateBucketRequest.struct_class = Types::CreateBucketRequest
799
806
  CreateBucketRequest[:payload] = :create_bucket_configuration
800
807
  CreateBucketRequest[:payload_member] = CreateBucketRequest.member(:create_bucket_configuration)
@@ -1000,6 +1007,8 @@ module Aws::S3
1000
1007
 
1001
1008
  Errors.member = Shapes::ShapeRef.new(shape: Error)
1002
1009
 
1010
+ EventBridgeConfiguration.struct_class = Types::EventBridgeConfiguration
1011
+
1003
1012
  EventList.member = Shapes::ShapeRef.new(shape: Event)
1004
1013
 
1005
1014
  ExistingObjectReplication.add_member(:status, Shapes::ShapeRef.new(shape: ExistingObjectReplicationStatus, required: true, location_name: "Status"))
@@ -1490,10 +1499,14 @@ module Aws::S3
1490
1499
 
1491
1500
  LifecycleRuleAndOperator.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
1492
1501
  LifecycleRuleAndOperator.add_member(:tags, Shapes::ShapeRef.new(shape: TagSet, location_name: "Tag", metadata: {"flattened"=>true}))
1502
+ LifecycleRuleAndOperator.add_member(:object_size_greater_than, Shapes::ShapeRef.new(shape: ObjectSizeGreaterThanBytes, location_name: "ObjectSizeGreaterThan"))
1503
+ LifecycleRuleAndOperator.add_member(:object_size_less_than, Shapes::ShapeRef.new(shape: ObjectSizeLessThanBytes, location_name: "ObjectSizeLessThan"))
1493
1504
  LifecycleRuleAndOperator.struct_class = Types::LifecycleRuleAndOperator
1494
1505
 
1495
1506
  LifecycleRuleFilter.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
1496
1507
  LifecycleRuleFilter.add_member(:tag, Shapes::ShapeRef.new(shape: Tag, location_name: "Tag"))
1508
+ LifecycleRuleFilter.add_member(:object_size_greater_than, Shapes::ShapeRef.new(shape: ObjectSizeGreaterThanBytes, location_name: "ObjectSizeGreaterThan"))
1509
+ LifecycleRuleFilter.add_member(:object_size_less_than, Shapes::ShapeRef.new(shape: ObjectSizeLessThanBytes, location_name: "ObjectSizeLessThan"))
1497
1510
  LifecycleRuleFilter.add_member(:and, Shapes::ShapeRef.new(shape: LifecycleRuleAndOperator, location_name: "And"))
1498
1511
  LifecycleRuleFilter.struct_class = Types::LifecycleRuleFilter
1499
1512
 
@@ -1686,6 +1699,7 @@ module Aws::S3
1686
1699
 
1687
1700
  MetricsAndOperator.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
1688
1701
  MetricsAndOperator.add_member(:tags, Shapes::ShapeRef.new(shape: TagSet, location_name: "Tag", metadata: {"flattened"=>true}))
1702
+ MetricsAndOperator.add_member(:access_point_arn, Shapes::ShapeRef.new(shape: AccessPointArn, location_name: "AccessPointArn"))
1689
1703
  MetricsAndOperator.struct_class = Types::MetricsAndOperator
1690
1704
 
1691
1705
  MetricsConfiguration.add_member(:id, Shapes::ShapeRef.new(shape: MetricsId, required: true, location_name: "Id"))
@@ -1696,6 +1710,7 @@ module Aws::S3
1696
1710
 
1697
1711
  MetricsFilter.add_member(:prefix, Shapes::ShapeRef.new(shape: Prefix, location_name: "Prefix"))
1698
1712
  MetricsFilter.add_member(:tag, Shapes::ShapeRef.new(shape: Tag, location_name: "Tag"))
1713
+ MetricsFilter.add_member(:access_point_arn, Shapes::ShapeRef.new(shape: AccessPointArn, location_name: "AccessPointArn"))
1699
1714
  MetricsFilter.add_member(:and, Shapes::ShapeRef.new(shape: MetricsAndOperator, location_name: "And"))
1700
1715
  MetricsFilter.struct_class = Types::MetricsFilter
1701
1716
 
@@ -1716,10 +1731,12 @@ module Aws::S3
1716
1731
  NoSuchUpload.struct_class = Types::NoSuchUpload
1717
1732
 
1718
1733
  NoncurrentVersionExpiration.add_member(:noncurrent_days, Shapes::ShapeRef.new(shape: Days, location_name: "NoncurrentDays"))
1734
+ NoncurrentVersionExpiration.add_member(:newer_noncurrent_versions, Shapes::ShapeRef.new(shape: VersionCount, location_name: "NewerNoncurrentVersions"))
1719
1735
  NoncurrentVersionExpiration.struct_class = Types::NoncurrentVersionExpiration
1720
1736
 
1721
1737
  NoncurrentVersionTransition.add_member(:noncurrent_days, Shapes::ShapeRef.new(shape: Days, location_name: "NoncurrentDays"))
1722
1738
  NoncurrentVersionTransition.add_member(:storage_class, Shapes::ShapeRef.new(shape: TransitionStorageClass, location_name: "StorageClass"))
1739
+ NoncurrentVersionTransition.add_member(:newer_noncurrent_versions, Shapes::ShapeRef.new(shape: VersionCount, location_name: "NewerNoncurrentVersions"))
1723
1740
  NoncurrentVersionTransition.struct_class = Types::NoncurrentVersionTransition
1724
1741
 
1725
1742
  NoncurrentVersionTransitionList.member = Shapes::ShapeRef.new(shape: NoncurrentVersionTransition)
@@ -1727,6 +1744,7 @@ module Aws::S3
1727
1744
  NotificationConfiguration.add_member(:topic_configurations, Shapes::ShapeRef.new(shape: TopicConfigurationList, location_name: "TopicConfiguration"))
1728
1745
  NotificationConfiguration.add_member(:queue_configurations, Shapes::ShapeRef.new(shape: QueueConfigurationList, location_name: "QueueConfiguration"))
1729
1746
  NotificationConfiguration.add_member(:lambda_function_configurations, Shapes::ShapeRef.new(shape: LambdaFunctionConfigurationList, location_name: "CloudFunctionConfiguration"))
1747
+ NotificationConfiguration.add_member(:event_bridge_configuration, Shapes::ShapeRef.new(shape: EventBridgeConfiguration, location_name: "EventBridgeConfiguration"))
1730
1748
  NotificationConfiguration.struct_class = Types::NotificationConfiguration
1731
1749
 
1732
1750
  NotificationConfigurationDeprecated.add_member(:topic_configuration, Shapes::ShapeRef.new(shape: TopicConfigurationDeprecated, location_name: "TopicConfiguration"))
@@ -1923,6 +1941,7 @@ module Aws::S3
1923
1941
  PutBucketNotificationConfigurationRequest.add_member(:bucket, Shapes::ShapeRef.new(shape: BucketName, required: true, location: "uri", location_name: "Bucket"))
1924
1942
  PutBucketNotificationConfigurationRequest.add_member(:notification_configuration, Shapes::ShapeRef.new(shape: NotificationConfiguration, required: true, location_name: "NotificationConfiguration", metadata: {"xmlNamespace"=>{"uri"=>"http://s3.amazonaws.com/doc/2006-03-01/"}}))
1925
1943
  PutBucketNotificationConfigurationRequest.add_member(:expected_bucket_owner, Shapes::ShapeRef.new(shape: AccountId, location: "header", location_name: "x-amz-expected-bucket-owner"))
1944
+ PutBucketNotificationConfigurationRequest.add_member(:skip_destination_validation, Shapes::ShapeRef.new(shape: SkipValidation, location: "header", location_name: "x-amz-skip-destination-validation"))
1926
1945
  PutBucketNotificationConfigurationRequest.struct_class = Types::PutBucketNotificationConfigurationRequest
1927
1946
  PutBucketNotificationConfigurationRequest[:payload] = :notification_configuration
1928
1947
  PutBucketNotificationConfigurationRequest[:payload_member] = PutBucketNotificationConfigurationRequest.member(:notification_configuration)
@@ -161,7 +161,7 @@ module Aws
161
161
  #
162
162
  # @param [Symbol] method
163
163
  # The S3 operation to generate a presigned URL for. Valid values
164
- # are `:get`, `:put`, `:head`, `:delete`, `:create_multipart_upload`,
164
+ # are `:get`, `:put`, `:head`, `:delete`, `:create_multipart_upload`,
165
165
  # `:list_multipart_uploads`, `:complete_multipart_upload`,
166
166
  # `:abort_multipart_upload`, `:list_parts`, and `:upload_part`.
167
167
  #
@@ -215,6 +215,79 @@ module Aws
215
215
  )
216
216
  end
217
217
 
218
+ # Allows you to create presigned URL requests for S3 operations. This
219
+ # method returns a tuple containing the URL and the signed X-amz-* headers
220
+ # to be used with the presigned url.
221
+ #
222
+ # @example Pre-signed GET URL, valid for one hour
223
+ #
224
+ # obj.presigned_request(:get, expires_in: 3600)
225
+ # #=> ["https://bucket-name.s3.amazonaws.com/object-key?...", {}]
226
+ #
227
+ # @example Pre-signed PUT with a canned ACL
228
+ #
229
+ # # the object uploaded using this URL will be publicly accessible
230
+ # obj.presigned_request(:put, acl: 'public-read')
231
+ # #=> ["https://bucket-name.s3.amazonaws.com/object-key?...",
232
+ # {"x-amz-acl"=>"public-read"}]
233
+ #
234
+ # @param [Symbol] method
235
+ # The S3 operation to generate a presigned request for. Valid values
236
+ # are `:get`, `:put`, `:head`, `:delete`, `:create_multipart_upload`,
237
+ # `:list_multipart_uploads`, `:complete_multipart_upload`,
238
+ # `:abort_multipart_upload`, `:list_parts`, and `:upload_part`.
239
+ #
240
+ # @param [Hash] params
241
+ # Additional request parameters to use when generating the pre-signed
242
+ # request. See the related documentation in {Client} for accepted
243
+ # params.
244
+ #
245
+ # | Method | Client Method |
246
+ # |------------------------------|------------------------------------|
247
+ # | `:get` | {Client#get_object} |
248
+ # | `:put` | {Client#put_object} |
249
+ # | `:head` | {Client#head_object} |
250
+ # | `:delete` | {Client#delete_object} |
251
+ # | `:create_multipart_upload` | {Client#create_multipart_upload} |
252
+ # | `:list_multipart_uploads` | {Client#list_multipart_uploads} |
253
+ # | `:complete_multipart_upload` | {Client#complete_multipart_upload} |
254
+ # | `:abort_multipart_upload` | {Client#abort_multipart_upload} |
255
+ # | `:list_parts` | {Client#list_parts} |
256
+ # | `:upload_part` | {Client#upload_part} |
257
+ #
258
+ # @option params [Boolean] :virtual_host (false) When `true` the
259
+ # presigned URL will use the bucket name as a virtual host.
260
+ #
261
+ # bucket = Aws::S3::Bucket.new('my.bucket.com')
262
+ # bucket.object('key').presigned_request(virtual_host: true)
263
+ # #=> ["http://my.bucket.com/key?...", {}]
264
+ #
265
+ # @option params [Integer] :expires_in (900) Number of seconds before
266
+ # the pre-signed URL expires. This may not exceed one week (604800
267
+ # seconds). Note that the pre-signed URL is also only valid as long as
268
+ # credentials used to sign it are. For example, when using IAM roles,
269
+ # temporary tokens generated for signing also have a default expiration
270
+ # which will affect the effective expiration of the pre-signed URL.
271
+ #
272
+ # @raise [ArgumentError] Raised if `:expires_in` exceeds one week
273
+ # (604800 seconds).
274
+ #
275
+ # @return [String, Hash] A tuple with a presigned URL and headers that
276
+ # should be included with the request.
277
+ #
278
+ def presigned_request(method, params = {})
279
+ presigner = Presigner.new(client: client)
280
+
281
+ if %w(delete head get put).include?(method.to_s)
282
+ method = "#{method}_object".to_sym
283
+ end
284
+
285
+ presigner.presigned_request(
286
+ method.downcase,
287
+ params.merge(bucket: bucket_name, key: key)
288
+ )
289
+ end
290
+
218
291
  # Returns the public (un-signed) URL for this object.
219
292
  #
220
293
  # s3.bucket('bucket-name').object('obj-key').public_url
@@ -134,7 +134,7 @@ module Aws
134
134
  def write(resp)
135
135
  range, _ = resp.content_range.split(' ').last.split('/')
136
136
  head, _ = range.split('-').map {|s| s.to_i}
137
- IO.write(@path, resp.body.read, head)
137
+ File.write(@path, resp.body.read, head)
138
138
  end
139
139
 
140
140
  def single_request
@@ -32,11 +32,16 @@ module Aws
32
32
  # @option options [Proc] :progress_callback
33
33
  # A Proc that will be called when each chunk of the upload is sent.
34
34
  # It will be invoked with [bytes_read], [total_sizes]
35
+ # @option options [Integer] :thread_count
36
+ # The thread count to use for multipart uploads. Ignored for
37
+ # objects smaller than the multipart threshold.
35
38
  # @return [void]
36
39
  def upload(source, options = {})
37
40
  if File.size(source) >= multipart_threshold
38
41
  MultipartFileUploader.new(@options).upload(source, options)
39
42
  else
43
+ # remove multipart parameters not supported by put_object
44
+ options.delete(:thread_count)
40
45
  put_object(source, options)
41
46
  end
42
47
  end
@@ -184,10 +184,10 @@ module Aws::S3
184
184
  end
185
185
 
186
186
  # If the object is stored using server-side encryption either with an
187
- # Amazon Web Services KMS customer master key (CMK) or an Amazon
188
- # S3-managed encryption key, the response includes this header with the
189
- # value of the server-side encryption algorithm used when storing this
190
- # object in Amazon S3 (for example, AES256, aws:kms).
187
+ # Amazon Web Services KMS key or an Amazon S3-managed encryption key,
188
+ # the response includes this header with the value of the server-side
189
+ # encryption algorithm used when storing this object in Amazon S3 (for
190
+ # example, AES256, aws:kms).
191
191
  # @return [String]
192
192
  def server_side_encryption
193
193
  data[:server_side_encryption]
@@ -217,8 +217,8 @@ module Aws::S3
217
217
  end
218
218
 
219
219
  # If present, specifies the ID of the Amazon Web Services Key Management
220
- # Service (Amazon Web Services KMS) symmetric customer managed customer
221
- # master key (CMK) that was used for the object.
220
+ # Service (Amazon Web Services KMS) symmetric customer managed key that
221
+ # was used for the object.
222
222
  # @return [String]
223
223
  def ssekms_key_id
224
224
  data[:ssekms_key_id]
@@ -552,7 +552,7 @@ module Aws::S3
552
552
  # metadata_directive: "COPY", # accepts COPY, REPLACE
553
553
  # tagging_directive: "COPY", # accepts COPY, REPLACE
554
554
  # server_side_encryption: "AES256", # accepts AES256, aws:kms
555
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS
555
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR
556
556
  # website_redirect_location: "WebsiteRedirectLocation",
557
557
  # sse_customer_algorithm: "SSECustomerAlgorithm",
558
558
  # sse_customer_key: "SSECustomerKey",
@@ -943,7 +943,7 @@ module Aws::S3
943
943
  # "MetadataKey" => "MetadataValue",
944
944
  # },
945
945
  # server_side_encryption: "AES256", # accepts AES256, aws:kms
946
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS
946
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR
947
947
  # website_redirect_location: "WebsiteRedirectLocation",
948
948
  # sse_customer_algorithm: "SSECustomerAlgorithm",
949
949
  # sse_customer_key: "SSECustomerKey",
@@ -1028,13 +1028,13 @@ module Aws::S3
1028
1028
  # RFC 1321. Amazon S3 uses this header for a message integrity check to
1029
1029
  # ensure that the encryption key was transmitted without error.
1030
1030
  # @option options [String] :ssekms_key_id
1031
- # Specifies the ID of the symmetric customer managed Amazon Web Services
1032
- # KMS CMK to use for object encryption. All GET and PUT requests for an
1033
- # object protected by Amazon Web Services KMS will fail if not made via
1034
- # SSL or using SigV4. For information about configuring using any of the
1035
- # officially supported Amazon Web Services SDKs and Amazon Web Services
1036
- # CLI, see [Specifying the Signature Version in Request
1037
- # Authentication][1] in the *Amazon S3 User Guide*.
1031
+ # Specifies the ID of the symmetric customer managed key to use for
1032
+ # object encryption. All GET and PUT requests for an object protected by
1033
+ # Amazon Web Services KMS will fail if not made via SSL or using SigV4.
1034
+ # For information about configuring using any of the officially
1035
+ # supported Amazon Web Services SDKs and Amazon Web Services CLI, see
1036
+ # [Specifying the Signature Version in Request Authentication][1] in the
1037
+ # *Amazon S3 User Guide*.
1038
1038
  #
1039
1039
  #
1040
1040
  #
@@ -1112,7 +1112,7 @@ module Aws::S3
1112
1112
  # "MetadataKey" => "MetadataValue",
1113
1113
  # },
1114
1114
  # server_side_encryption: "AES256", # accepts AES256, aws:kms
1115
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS
1115
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR
1116
1116
  # website_redirect_location: "WebsiteRedirectLocation",
1117
1117
  # sse_customer_algorithm: "SSECustomerAlgorithm",
1118
1118
  # sse_customer_key: "SSECustomerKey",
@@ -1277,12 +1277,12 @@ module Aws::S3
1277
1277
  # If `x-amz-server-side-encryption` is present and has the value of
1278
1278
  # `aws:kms`, this header specifies the ID of the Amazon Web Services Key
1279
1279
  # Management Service (Amazon Web Services KMS) symmetrical customer
1280
- # managed customer master key (CMK) that was used for the object. If you
1281
- # specify `x-amz-server-side-encryption:aws:kms`, but do not provide`
1280
+ # managed key that was used for the object. If you specify
1281
+ # `x-amz-server-side-encryption:aws:kms`, but do not provide`
1282
1282
  # x-amz-server-side-encryption-aws-kms-key-id`, Amazon S3 uses the
1283
- # Amazon Web Services managed CMK in Amazon Web Services to protect the
1284
- # data. If the KMS key does not exist in the same account issuing the
1285
- # command, you must use the full ARN and not just the ID.
1283
+ # Amazon Web Services managed key to protect the data. If the KMS key
1284
+ # does not exist in the same account issuing the command, you must use
1285
+ # the full ARN and not just the ID.
1286
1286
  # @option options [String] :ssekms_encryption_context
1287
1287
  # Specifies the Amazon Web Services KMS Encryption Context to use for
1288
1288
  # object encryption. The value of this header is a base64-encoded UTF-8
@@ -1415,7 +1415,7 @@ module Aws::S3
1415
1415
  # value: "MetadataValue",
1416
1416
  # },
1417
1417
  # ],
1418
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS
1418
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR
1419
1419
  # },
1420
1420
  # },
1421
1421
  # },
@@ -1481,18 +1481,8 @@ module Aws::S3
1481
1481
  # Return the object only if it has not been modified since the specified
1482
1482
  # time, otherwise return a 412 (precondition failed).
1483
1483
  # @option options [String] :range
1484
- # Downloads the specified range bytes of an object. For more information
1485
- # about the HTTP Range header, see
1486
- # [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35][1].
1487
- #
1488
- # <note markdown="1"> Amazon S3 doesn't support retrieving multiple ranges of data per
1489
- # `GET` request.
1490
- #
1491
- # </note>
1492
- #
1493
- #
1494
- #
1495
- # [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
1484
+ # Because `HeadObject` returns only the metadata for an object, this
1485
+ # parameter has no effect.
1496
1486
  # @option options [String] :version_id
1497
1487
  # VersionId used to reference a specific version of the object.
1498
1488
  # @option options [String] :sse_customer_algorithm
@@ -296,7 +296,7 @@ module Aws::S3
296
296
  # metadata_directive: "COPY", # accepts COPY, REPLACE
297
297
  # tagging_directive: "COPY", # accepts COPY, REPLACE
298
298
  # server_side_encryption: "AES256", # accepts AES256, aws:kms
299
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS
299
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR
300
300
  # website_redirect_location: "WebsiteRedirectLocation",
301
301
  # sse_customer_algorithm: "SSECustomerAlgorithm",
302
302
  # sse_customer_key: "SSECustomerKey",
@@ -687,7 +687,7 @@ module Aws::S3
687
687
  # "MetadataKey" => "MetadataValue",
688
688
  # },
689
689
  # server_side_encryption: "AES256", # accepts AES256, aws:kms
690
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS
690
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR
691
691
  # website_redirect_location: "WebsiteRedirectLocation",
692
692
  # sse_customer_algorithm: "SSECustomerAlgorithm",
693
693
  # sse_customer_key: "SSECustomerKey",
@@ -772,13 +772,13 @@ module Aws::S3
772
772
  # RFC 1321. Amazon S3 uses this header for a message integrity check to
773
773
  # ensure that the encryption key was transmitted without error.
774
774
  # @option options [String] :ssekms_key_id
775
- # Specifies the ID of the symmetric customer managed Amazon Web Services
776
- # KMS CMK to use for object encryption. All GET and PUT requests for an
777
- # object protected by Amazon Web Services KMS will fail if not made via
778
- # SSL or using SigV4. For information about configuring using any of the
779
- # officially supported Amazon Web Services SDKs and Amazon Web Services
780
- # CLI, see [Specifying the Signature Version in Request
781
- # Authentication][1] in the *Amazon S3 User Guide*.
775
+ # Specifies the ID of the symmetric customer managed key to use for
776
+ # object encryption. All GET and PUT requests for an object protected by
777
+ # Amazon Web Services KMS will fail if not made via SSL or using SigV4.
778
+ # For information about configuring using any of the officially
779
+ # supported Amazon Web Services SDKs and Amazon Web Services CLI, see
780
+ # [Specifying the Signature Version in Request Authentication][1] in the
781
+ # *Amazon S3 User Guide*.
782
782
  #
783
783
  #
784
784
  #
@@ -856,7 +856,7 @@ module Aws::S3
856
856
  # "MetadataKey" => "MetadataValue",
857
857
  # },
858
858
  # server_side_encryption: "AES256", # accepts AES256, aws:kms
859
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS
859
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR
860
860
  # website_redirect_location: "WebsiteRedirectLocation",
861
861
  # sse_customer_algorithm: "SSECustomerAlgorithm",
862
862
  # sse_customer_key: "SSECustomerKey",
@@ -1021,12 +1021,12 @@ module Aws::S3
1021
1021
  # If `x-amz-server-side-encryption` is present and has the value of
1022
1022
  # `aws:kms`, this header specifies the ID of the Amazon Web Services Key
1023
1023
  # Management Service (Amazon Web Services KMS) symmetrical customer
1024
- # managed customer master key (CMK) that was used for the object. If you
1025
- # specify `x-amz-server-side-encryption:aws:kms`, but do not provide`
1024
+ # managed key that was used for the object. If you specify
1025
+ # `x-amz-server-side-encryption:aws:kms`, but do not provide`
1026
1026
  # x-amz-server-side-encryption-aws-kms-key-id`, Amazon S3 uses the
1027
- # Amazon Web Services managed CMK in Amazon Web Services to protect the
1028
- # data. If the KMS key does not exist in the same account issuing the
1029
- # command, you must use the full ARN and not just the ID.
1027
+ # Amazon Web Services managed key to protect the data. If the KMS key
1028
+ # does not exist in the same account issuing the command, you must use
1029
+ # the full ARN and not just the ID.
1030
1030
  # @option options [String] :ssekms_encryption_context
1031
1031
  # Specifies the Amazon Web Services KMS Encryption Context to use for
1032
1032
  # object encryption. The value of this header is a base64-encoded UTF-8
@@ -1159,7 +1159,7 @@ module Aws::S3
1159
1159
  # value: "MetadataValue",
1160
1160
  # },
1161
1161
  # ],
1162
- # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS
1162
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, OUTPOSTS, GLACIER_IR
1163
1163
  # },
1164
1164
  # },
1165
1165
  # },
@@ -402,18 +402,8 @@ module Aws::S3
402
402
  # Return the object only if it has not been modified since the specified
403
403
  # time, otherwise return a 412 (precondition failed).
404
404
  # @option options [String] :range
405
- # Downloads the specified range bytes of an object. For more information
406
- # about the HTTP Range header, see
407
- # [http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35][1].
408
- #
409
- # <note markdown="1"> Amazon S3 doesn't support retrieving multiple ranges of data per
410
- # `GET` request.
411
- #
412
- # </note>
413
- #
414
- #
415
- #
416
- # [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
405
+ # Because `HeadObject` returns only the metadata for an object, this
406
+ # parameter has no effect.
417
407
  # @option options [String] :sse_customer_algorithm
418
408
  # Specifies the algorithm to use to when encrypting the object (for
419
409
  # example, AES256).
@@ -41,11 +41,17 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/
41
41
  accelerate = context.params.delete(:use_accelerate_endpoint)
42
42
  end
43
43
  accelerate = context.config.use_accelerate_endpoint if accelerate.nil?
44
- # Raise if :endpoint and dualstack are both provided
44
+ # Raise if :endpoint and accelerate are both provided
45
45
  if accelerate && !context.config.regional_endpoint
46
46
  raise ArgumentError,
47
47
  'Cannot use both :use_accelerate_endpoint and :endpoint'
48
48
  end
49
+ # Raise if :use_fips_endpoint and accelerate are both provided
50
+ if accelerate && context.config.use_fips_endpoint
51
+ raise ArgumentError,
52
+ 'Cannot use both :use_accelerate_endpoint and '\
53
+ ':use_fips_endpoint'
54
+ end
49
55
  context[:use_accelerate_endpoint] = accelerate
50
56
  @handler.call(context)
51
57
  end
@@ -77,17 +77,10 @@ result in cross region requests.
77
77
  if arn
78
78
  validate_config!(context, arn)
79
79
 
80
- fips = false
81
- if resolved_region.include?('fips')
82
- fips = true
83
- resolved_region = resolved_region.gsub('fips-', '')
84
- .gsub('-fips', '')
85
- end
86
-
87
80
  context.metadata[:s3_arn] = {
88
81
  arn: arn,
89
82
  resolved_region: resolved_region,
90
- fips: fips,
83
+ fips: context.config.use_fips_endpoint,
91
84
  dualstack: extract_dualstack_config!(context)
92
85
  }
93
86
  end
@@ -126,7 +119,8 @@ result in cross region requests.
126
119
 
127
120
  if !arn.support_dualstack? && context[:use_dualstack_endpoint]
128
121
  raise ArgumentError,
129
- 'Cannot provide an Outpost Access Point or Multi-region Access Point ARN'\
122
+ 'Cannot provide an Outpost Access Point, Object Lambda, '\
123
+ 'or Multi-region Access Point ARN'\
130
124
  ' when `:use_dualstack_endpoint` is set to true.'
131
125
  end
132
126
 
@@ -135,6 +129,12 @@ result in cross region requests.
135
129
  'Cannot provide a Multi-region Access Point ARN with '\
136
130
  '`:s3_disable_multiregion_access_points` set to true'
137
131
  end
132
+
133
+ if context.config.use_fips_endpoint && !arn.support_fips?
134
+ raise ArgumentError,
135
+ 'FIPS client regions are not supported for this type '\
136
+ 'of ARN.'
137
+ end
138
138
  end
139
139
  end
140
140
 
@@ -146,7 +146,7 @@ result in cross region requests.
146
146
  s3_arn = resolve_arn_type!(arn)
147
147
  s3_arn.validate_arn!
148
148
  validate_region_config!(s3_arn, region, use_arn_region)
149
- region = s3_arn.region if use_arn_region && !region.include?('fips')
149
+ region = s3_arn.region if use_arn_region
150
150
  [region, s3_arn]
151
151
  else
152
152
  [region]
@@ -231,19 +231,6 @@ result in cross region requests.
231
231
  raise Aws::Errors::InvalidARNPartitionError
232
232
  end
233
233
  else
234
- if region.include?('fips')
235
- # If ARN type doesn't support FIPS but the client region is FIPS
236
- unless arn.support_fips?
237
- raise ArgumentError,
238
- 'FIPS client regions are not supported for this type '\
239
- 'of ARN.'
240
- end
241
-
242
- fips = true
243
- # Normalize the region so we can compare partition and regions
244
- region = region.gsub('fips-', '').gsub('-fips', '')
245
- end
246
-
247
234
  # use_arn_region does not apply to MRAP (global) arns
248
235
  unless arn.region.empty?
249
236
  # Raise if the ARN and client regions are in different partitions
@@ -254,7 +241,7 @@ result in cross region requests.
254
241
 
255
242
  # Raise if regions mismatch
256
243
  # Either when it's a fips client or not using the ARN region
257
- if (!use_arn_region || fips) && region != arn.region
244
+ if !use_arn_region && region != arn.region
258
245
  raise Aws::Errors::InvalidARNRegionError
259
246
  end
260
247
  end
@@ -24,7 +24,7 @@ request URI and never moved to the host as a sub-domain.
24
24
  DOCS
25
25
 
26
26
  def add_handlers(handlers, config)
27
- handlers.add(Handler) unless config.force_path_style
27
+ handlers.add(Handler, priority: 48) unless config.force_path_style
28
28
  end
29
29
 
30
30
  # @api private
@@ -5,18 +5,9 @@ module Aws
5
5
  module Plugins
6
6
  # @api private
7
7
  class Dualstack < Seahorse::Client::Plugin
8
-
9
- option(:use_dualstack_endpoint,
10
- default: false,
11
- doc_type: 'Boolean',
12
- docstring: <<-DOCS)
13
- When set to `true`, IPv6-compatible bucket endpoints will be used
14
- for all operations.
15
- DOCS
16
-
17
8
  def add_handlers(handlers, config)
18
9
  handlers.add(OptionHandler, step: :initialize)
19
- handlers.add(DualstackHandler, step: :build, priority: 11)
10
+ handlers.add(DualstackHandler, step: :build, priority: 49)
20
11
  end
21
12
 
22
13
  # @api private
@@ -40,38 +31,41 @@ for all operations.
40
31
  # @api private
41
32
  class DualstackHandler < Seahorse::Client::Handler
42
33
  def call(context)
43
- if context.config.regional_endpoint && use_dualstack_endpoint?(context)
34
+ # only rewrite the endpoint if it's not a custom endpoint
35
+ # accelerate/ARN already handle dualstack cases, so ignore these
36
+ # check to see if dualstack is on but configured off via operation
37
+ if context.config.regional_endpoint &&
38
+ use_dualstack_endpoint?(context)
44
39
  apply_dualstack_endpoint(context)
45
40
  end
46
41
  @handler.call(context)
47
42
  end
48
43
 
49
44
  private
50
- def apply_dualstack_endpoint(context)
51
- bucket_name = context.params[:bucket]
52
- region = context.config.region
53
- dns_suffix = Aws::Partitions::EndpointProvider.dns_suffix_for(region)
54
45
 
55
- if use_bucket_dns?(bucket_name, context)
56
- host = "#{bucket_name}.s3.dualstack.#{region}.#{dns_suffix}"
57
- else
58
- host = "s3.dualstack.#{region}.#{dns_suffix}"
59
- end
46
+ def apply_dualstack_endpoint(context)
47
+ new_endpoint = Aws::Partitions::EndpointProvider.resolve(
48
+ context.config.region,
49
+ 's3',
50
+ 'regional',
51
+ {
52
+ dualstack: context[:use_dualstack_endpoint],
53
+ fips: context.config.use_fips_endpoint
54
+ }
55
+ )
60
56
  endpoint = URI.parse(context.http_request.endpoint.to_s)
61
- endpoint.scheme = context.http_request.endpoint.scheme
62
- endpoint.port = context.http_request.endpoint.port
63
- endpoint.host = host
64
- context.http_request.endpoint = endpoint.to_s
65
- end
66
-
67
- def use_bucket_dns?(bucket_name, context)
68
- ssl = context.http_request.endpoint.scheme == "https"
69
- bucket_name && BucketDns.dns_compatible?(bucket_name, ssl) &&
70
- !context.config.force_path_style
57
+ endpoint.host = URI.parse(new_endpoint).host
58
+ context.http_request.endpoint = endpoint
71
59
  end
72
60
 
73
61
  def use_dualstack_endpoint?(context)
74
- context[:use_dualstack_endpoint] && !context[:use_accelerate_endpoint]
62
+ # case when dualstack is turned off via operation
63
+ (context[:use_dualstack_endpoint] ||
64
+ context.config.use_dualstack_endpoint) &&
65
+ # accelerate plugin already applies dualstack
66
+ !context[:use_accelerate_endpoint] &&
67
+ # arns handle dualstack
68
+ !context.metadata[:s3_arn]
75
69
  end
76
70
  end
77
71