aws-sdk-s3 1.119.2 → 1.158.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 +263 -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 +250 -0
- data/lib/aws-sdk-s3/bucket.rb +573 -133
- data/lib/aws-sdk-s3/bucket_acl.rb +18 -12
- data/lib/aws-sdk-s3/bucket_cors.rb +24 -16
- data/lib/aws-sdk-s3/bucket_lifecycle.rb +24 -16
- data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +24 -16
- data/lib/aws-sdk-s3/bucket_logging.rb +25 -12
- data/lib/aws-sdk-s3/bucket_notification.rb +12 -6
- data/lib/aws-sdk-s3/bucket_policy.rb +70 -18
- data/lib/aws-sdk-s3/bucket_region_cache.rb +9 -5
- data/lib/aws-sdk-s3/bucket_request_payment.rb +18 -12
- data/lib/aws-sdk-s3/bucket_tagging.rb +24 -16
- data/lib/aws-sdk-s3/bucket_versioning.rb +42 -32
- data/lib/aws-sdk-s3/bucket_website.rb +24 -16
- data/lib/aws-sdk-s3/client.rb +6866 -3226
- data/lib/aws-sdk-s3/client_api.rb +162 -21
- data/lib/aws-sdk-s3/customizations/bucket.rb +3 -1
- data/lib/aws-sdk-s3/customizations/errors.rb +16 -3
- data/lib/aws-sdk-s3/customizations/object.rb +91 -18
- data/lib/aws-sdk-s3/customizations.rb +8 -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 +44 -0
- data/lib/aws-sdk-s3/endpoint_provider.rb +186 -327
- data/lib/aws-sdk-s3/endpoints.rb +540 -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 +169 -44
- data/lib/aws-sdk-s3/file_uploader.rb +8 -6
- data/lib/aws-sdk-s3/multipart_file_uploader.rb +4 -4
- data/lib/aws-sdk-s3/multipart_stream_uploader.rb +10 -7
- data/lib/aws-sdk-s3/multipart_upload.rb +81 -20
- data/lib/aws-sdk-s3/multipart_upload_part.rb +169 -38
- data/lib/aws-sdk-s3/object.rb +1590 -275
- data/lib/aws-sdk-s3/object_acl.rb +38 -18
- data/lib/aws-sdk-s3/object_copier.rb +7 -5
- data/lib/aws-sdk-s3/object_multipart_copier.rb +42 -24
- data/lib/aws-sdk-s3/object_summary.rb +1437 -285
- data/lib/aws-sdk-s3/object_version.rb +350 -51
- data/lib/aws-sdk-s3/plugins/access_grants.rb +178 -0
- data/lib/aws-sdk-s3/plugins/endpoints.rb +14 -2
- 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/location_constraint.rb +3 -1
- data/lib/aws-sdk-s3/plugins/md5s.rb +2 -1
- data/lib/aws-sdk-s3/plugins/s3_signer.rb +20 -13
- data/lib/aws-sdk-s3/presigned_post.rb +52 -43
- data/lib/aws-sdk-s3/presigner.rb +8 -4
- data/lib/aws-sdk-s3/resource.rb +99 -21
- data/lib/aws-sdk-s3/types.rb +5285 -1632
- data/lib/aws-sdk-s3.rb +1 -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 +2385 -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 +128 -0
- data/sig/types.rbs +2575 -0
- data/sig/waiters.rbs +95 -0
- metadata +43 -11
| @@ -134,7 +134,9 @@ module Aws | |
| 134 134 |  | 
| 135 135 | 
             
                  # @api private
         | 
| 136 136 | 
             
                  def load
         | 
| 137 | 
            -
                    @data =  | 
| 137 | 
            +
                    @data = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
         | 
| 138 | 
            +
                      client.list_buckets.buckets.find { |b| b.name == name }
         | 
| 139 | 
            +
                    end
         | 
| 138 140 | 
             
                    raise "unable to load bucket #{name}" if @data.nil?
         | 
| 139 141 |  | 
| 140 142 | 
             
                    self
         | 
| @@ -3,12 +3,12 @@ | |
| 3 3 | 
             
            module Aws
         | 
| 4 4 | 
             
              module S3
         | 
| 5 5 | 
             
                module Errors
         | 
| 6 | 
            -
                  # Hijack PermanentRedirect dynamic error to  | 
| 7 | 
            -
                  # and  | 
| 6 | 
            +
                  # Hijack PermanentRedirect dynamic error to include the bucket, region,
         | 
| 7 | 
            +
                  # and endpoint.
         | 
| 8 8 | 
             
                  class PermanentRedirect < ServiceError
         | 
| 9 9 | 
             
                    # @param [Seahorse::Client::RequestContext] context
         | 
| 10 10 | 
             
                    # @param [String] message
         | 
| 11 | 
            -
                    # @param [Aws::S3::Types::PermanentRedirect]  | 
| 11 | 
            +
                    # @param [Aws::S3::Types::PermanentRedirect] _data
         | 
| 12 12 | 
             
                    def initialize(context, message, _data = Aws::EmptyStructure.new)
         | 
| 13 13 | 
             
                      data = Aws::S3::Types::PermanentRedirect.new(message: message)
         | 
| 14 14 | 
             
                      body = context.http_response.body_contents
         | 
| @@ -22,6 +22,19 @@ module Aws | |
| 22 22 | 
             
                      super(context, message, data)
         | 
| 23 23 | 
             
                    end
         | 
| 24 24 | 
             
                  end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  # Hijack PermanentRedirect (HeadBucket case - no body) dynamic error to
         | 
| 27 | 
            +
                  # include the region.
         | 
| 28 | 
            +
                  class Http301Error < ServiceError
         | 
| 29 | 
            +
                    # @param [Seahorse::Client::RequestContext] context
         | 
| 30 | 
            +
                    # @param [String] message
         | 
| 31 | 
            +
                    # @param [Aws::S3::Types::PermanentRedirect] _data
         | 
| 32 | 
            +
                    def initialize(context, message, _data = Aws::EmptyStructure.new)
         | 
| 33 | 
            +
                      data = Aws::S3::Types::PermanentRedirect.new(message: message)
         | 
| 34 | 
            +
                      data.region = context.http_response.headers['x-amz-bucket-region']
         | 
| 35 | 
            +
                      super(context, message, data)
         | 
| 36 | 
            +
                    end
         | 
| 37 | 
            +
                  end
         | 
| 25 38 | 
             
                end
         | 
| 26 39 | 
             
              end
         | 
| 27 40 | 
             
            end
         | 
| @@ -46,6 +46,14 @@ module Aws | |
| 46 46 | 
             
                  #   different region. You do not need to specify this option
         | 
| 47 47 | 
             
                  #   if you have provided a `:source_client` or a `:content_length`.
         | 
| 48 48 | 
             
                  #
         | 
| 49 | 
            +
                  # @option options [Boolean] :use_source_parts (false) Only used when
         | 
| 50 | 
            +
                  #   `:multipart_copy` is `true`. Use part sizes defined on the source
         | 
| 51 | 
            +
                  #   object if any exist. If copying or moving an object that
         | 
| 52 | 
            +
                  #   is already multipart, this does not re-part the object, instead
         | 
| 53 | 
            +
                  #   re-using the part definitions on the original. That means the etag
         | 
| 54 | 
            +
                  #   and any checksums will not change. This is especially useful if the
         | 
| 55 | 
            +
                  #   source object has parts with varied sizes.
         | 
| 56 | 
            +
                  #
         | 
| 49 57 | 
             
                  # @example Basic object copy
         | 
| 50 58 | 
             
                  #
         | 
| 51 59 | 
             
                  #   bucket = Aws::S3::Bucket.new('target-bucket')
         | 
| @@ -68,11 +76,13 @@ module Aws | |
| 68 76 | 
             
                  # @see #copy_to
         | 
| 69 77 | 
             
                  #
         | 
| 70 78 | 
             
                  def copy_from(source, options = {})
         | 
| 71 | 
            -
                     | 
| 72 | 
            -
                       | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
                       | 
| 79 | 
            +
                    Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
         | 
| 80 | 
            +
                      if Hash === source && source[:copy_source]
         | 
| 81 | 
            +
                        # for backwards compatibility
         | 
| 82 | 
            +
                        @client.copy_object(source.merge(bucket: bucket_name, key: key))
         | 
| 83 | 
            +
                      else
         | 
| 84 | 
            +
                        ObjectCopier.new(self, options).copy_from(source, options)
         | 
| 85 | 
            +
                      end
         | 
| 76 86 | 
             
                    end
         | 
| 77 87 | 
             
                  end
         | 
| 78 88 |  | 
| @@ -109,7 +119,9 @@ module Aws | |
| 109 119 | 
             
                  #   object.copy_to('src-bucket/src-key', multipart_copy: true)
         | 
| 110 120 | 
             
                  #
         | 
| 111 121 | 
             
                  def copy_to(target, options = {})
         | 
| 112 | 
            -
                     | 
| 122 | 
            +
                    Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
         | 
| 123 | 
            +
                      ObjectCopier.new(self, options).copy_to(target, options)
         | 
| 124 | 
            +
                    end
         | 
| 113 125 | 
             
                  end
         | 
| 114 126 |  | 
| 115 127 | 
             
                  # Copies and deletes the current object. The object will only be deleted
         | 
| @@ -341,6 +353,10 @@ module Aws | |
| 341 353 | 
             
                  #     obj.upload_stream do |write_stream|
         | 
| 342 354 | 
             
                  #       IO.copy_stream(STDIN, write_stream)
         | 
| 343 355 | 
             
                  #     end
         | 
| 356 | 
            +
                  # @param [Hash] options
         | 
| 357 | 
            +
                  #   Additional options for {Client#create_multipart_upload},
         | 
| 358 | 
            +
                  #   {Client#complete_multipart_upload},
         | 
| 359 | 
            +
                  #   and {Client#upload_part} can be provided.
         | 
| 344 360 | 
             
                  #
         | 
| 345 361 | 
             
                  # @option options [Integer] :thread_count (10) The number of parallel
         | 
| 346 362 | 
             
                  #   multipart uploads
         | 
| @@ -363,6 +379,9 @@ module Aws | |
| 363 379 | 
             
                  # @return [Boolean] Returns `true` when the object is uploaded
         | 
| 364 380 | 
             
                  #   without any errors.
         | 
| 365 381 | 
             
                  #
         | 
| 382 | 
            +
                  # @see Client#create_multipart_upload
         | 
| 383 | 
            +
                  # @see Client#complete_multipart_upload
         | 
| 384 | 
            +
                  # @see Client#upload_part
         | 
| 366 385 | 
             
                  def upload_stream(options = {}, &block)
         | 
| 367 386 | 
             
                    uploading_options = options.dup
         | 
| 368 387 | 
             
                    uploader = MultipartStreamUploader.new(
         | 
| @@ -371,10 +390,12 @@ module Aws | |
| 371 390 | 
             
                      tempfile: uploading_options.delete(:tempfile),
         | 
| 372 391 | 
             
                      part_size: uploading_options.delete(:part_size)
         | 
| 373 392 | 
             
                    )
         | 
| 374 | 
            -
                     | 
| 375 | 
            -
                       | 
| 376 | 
            -
             | 
| 377 | 
            -
             | 
| 393 | 
            +
                    Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
         | 
| 394 | 
            +
                      uploader.upload(
         | 
| 395 | 
            +
                        uploading_options.merge(bucket: bucket_name, key: key),
         | 
| 396 | 
            +
                        &block
         | 
| 397 | 
            +
                      )
         | 
| 398 | 
            +
                    end
         | 
| 378 399 | 
             
                    true
         | 
| 379 400 | 
             
                  end
         | 
| 380 401 |  | 
| @@ -413,6 +434,13 @@ module Aws | |
| 413 434 | 
             
                  #   using an open Tempfile, rewind it before uploading or else the object
         | 
| 414 435 | 
             
                  #   will be empty.
         | 
| 415 436 | 
             
                  #
         | 
| 437 | 
            +
                  # @param [Hash] options
         | 
| 438 | 
            +
                  #   Additional options for {Client#put_object}
         | 
| 439 | 
            +
                  #   when file sizes below the multipart threshold. For files larger than
         | 
| 440 | 
            +
                  #   the multipart threshold, options for {Client#create_multipart_upload},
         | 
| 441 | 
            +
                  #   {Client#complete_multipart_upload},
         | 
| 442 | 
            +
                  #   and {Client#upload_part} can be provided.
         | 
| 443 | 
            +
                  #
         | 
| 416 444 | 
             
                  # @option options [Integer] :multipart_threshold (104857600) Files larger
         | 
| 417 445 | 
             
                  #   than or equal to `:multipart_threshold` are uploaded using the S3
         | 
| 418 446 | 
             
                  #   multipart APIs.
         | 
| @@ -434,16 +462,23 @@ module Aws | |
| 434 462 | 
             
                  #
         | 
| 435 463 | 
             
                  # @return [Boolean] Returns `true` when the object is uploaded
         | 
| 436 464 | 
             
                  #   without any errors.
         | 
| 465 | 
            +
                  #
         | 
| 466 | 
            +
                  # @see Client#put_object
         | 
| 467 | 
            +
                  # @see Client#create_multipart_upload
         | 
| 468 | 
            +
                  # @see Client#complete_multipart_upload
         | 
| 469 | 
            +
                  # @see Client#upload_part
         | 
| 437 470 | 
             
                  def upload_file(source, options = {})
         | 
| 438 471 | 
             
                    uploading_options = options.dup
         | 
| 439 472 | 
             
                    uploader = FileUploader.new(
         | 
| 440 473 | 
             
                      multipart_threshold: uploading_options.delete(:multipart_threshold),
         | 
| 441 474 | 
             
                      client: client
         | 
| 442 475 | 
             
                    )
         | 
| 443 | 
            -
                    response =  | 
| 444 | 
            -
                       | 
| 445 | 
            -
             | 
| 446 | 
            -
             | 
| 476 | 
            +
                    response = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
         | 
| 477 | 
            +
                      uploader.upload(
         | 
| 478 | 
            +
                        source,
         | 
| 479 | 
            +
                        uploading_options.merge(bucket: bucket_name, key: key)
         | 
| 480 | 
            +
                      )
         | 
| 481 | 
            +
                    end
         | 
| 447 482 | 
             
                    yield response if block_given?
         | 
| 448 483 | 
             
                    true
         | 
| 449 484 | 
             
                  end
         | 
| @@ -459,8 +494,21 @@ module Aws | |
| 459 494 | 
             
                  #     # and the parts are downloaded in parallel
         | 
| 460 495 | 
             
                  #     obj.download_file('/path/to/very_large_file')
         | 
| 461 496 | 
             
                  #
         | 
| 497 | 
            +
                  # You can provide a callback to monitor progress of the download:
         | 
| 498 | 
            +
                  #
         | 
| 499 | 
            +
                  #     # bytes and part_sizes are each an array with 1 entry per part
         | 
| 500 | 
            +
                  #     # part_sizes may not be known until the first bytes are retrieved
         | 
| 501 | 
            +
                  #     progress = Proc.new do |bytes, part_sizes, file_size|
         | 
| 502 | 
            +
                  #       puts bytes.map.with_index { |b, i| "Part #{i+1}: #{b} / #{part_sizes[i]}"}.join(' ') + "Total: #{100.0 * bytes.sum / file_size}%" }
         | 
| 503 | 
            +
                  #     end
         | 
| 504 | 
            +
                  #     obj.download_file('/path/to/file', progress_callback: progress)
         | 
| 505 | 
            +
                  #
         | 
| 462 506 | 
             
                  # @param [String] destination Where to download the file to.
         | 
| 463 507 | 
             
                  #
         | 
| 508 | 
            +
                  # @param [Hash] options
         | 
| 509 | 
            +
                  #   Additional options for {Client#get_object} and #{Client#head_object}
         | 
| 510 | 
            +
                  #   may be provided.
         | 
| 511 | 
            +
                  #
         | 
| 464 512 | 
             
                  # @option options [String] mode `auto`, `single_request`, `get_range`
         | 
| 465 513 | 
             
                  #  `single_request` mode forces only 1 GET request is made in download,
         | 
| 466 514 | 
             
                  #  `get_range` mode allows `chunk_size` parameter to configured in
         | 
| @@ -476,14 +524,39 @@ module Aws | |
| 476 524 | 
             
                  #   retrieve the object. For more about object versioning, see:
         | 
| 477 525 | 
             
                  #   https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectVersioning.html
         | 
| 478 526 | 
             
                  #
         | 
| 527 | 
            +
                  # @option options [String] checksum_mode (ENABLED) When `ENABLED` and
         | 
| 528 | 
            +
                  #   the object has a stored checksum, it will be used to validate the
         | 
| 529 | 
            +
                  #   download and will raise an `Aws::Errors::ChecksumError` if
         | 
| 530 | 
            +
                  #   checksum validation fails. You may provide a `on_checksum_validated`
         | 
| 531 | 
            +
                  #   callback if you need to verify that validation occurred and which
         | 
| 532 | 
            +
                  #   algorithm was used.  To disable checksum validation, set
         | 
| 533 | 
            +
                  #   `checksum_mode` to "DISABLED".
         | 
| 534 | 
            +
                  #
         | 
| 535 | 
            +
                  # @option options [Callable] on_checksum_validated Called each time a
         | 
| 536 | 
            +
                  #   request's checksum is validated with the checksum algorithm and the
         | 
| 537 | 
            +
                  #   response.  For multipart downloads, this will be called for each
         | 
| 538 | 
            +
                  #   part that is downloaded and validated.
         | 
| 539 | 
            +
                  #
         | 
| 540 | 
            +
                  # @option options [Proc] :progress_callback
         | 
| 541 | 
            +
                  #   A Proc that will be called when each chunk of the download is received.
         | 
| 542 | 
            +
                  #   It will be invoked with [bytes_read], [part_sizes], file_size.
         | 
| 543 | 
            +
                  #   When the object is downloaded as parts (rather than by ranges), the
         | 
| 544 | 
            +
                  #   part_sizes will not be known ahead of time and will be nil in the
         | 
| 545 | 
            +
                  #   callback until the first bytes in the part are received.
         | 
| 546 | 
            +
                  #
         | 
| 479 547 | 
             
                  # @return [Boolean] Returns `true` when the file is downloaded without
         | 
| 480 548 | 
             
                  #   any errors.
         | 
| 549 | 
            +
                  #
         | 
| 550 | 
            +
                  # @see Client#get_object
         | 
| 551 | 
            +
                  # @see Client#head_object
         | 
| 481 552 | 
             
                  def download_file(destination, options = {})
         | 
| 482 553 | 
             
                    downloader = FileDownloader.new(client: client)
         | 
| 483 | 
            -
                     | 
| 484 | 
            -
                       | 
| 485 | 
            -
             | 
| 486 | 
            -
             | 
| 554 | 
            +
                    Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
         | 
| 555 | 
            +
                      downloader.download(
         | 
| 556 | 
            +
                        destination,
         | 
| 557 | 
            +
                        options.merge(bucket: bucket_name, key: key)
         | 
| 558 | 
            +
                      )
         | 
| 559 | 
            +
                    end
         | 
| 487 560 | 
             
                    true
         | 
| 488 561 | 
             
                  end
         | 
| 489 562 | 
             
                end
         | 
| @@ -16,6 +16,14 @@ require 'aws-sdk-s3/object_multipart_copier' | |
| 16 16 | 
             
            require 'aws-sdk-s3/presigned_post'
         | 
| 17 17 | 
             
            require 'aws-sdk-s3/presigner'
         | 
| 18 18 |  | 
| 19 | 
            +
            # s3 express session auth
         | 
| 20 | 
            +
            require 'aws-sdk-s3/express_credentials'
         | 
| 21 | 
            +
            require 'aws-sdk-s3/express_credentials_provider'
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            # s3 access grants auth
         | 
| 24 | 
            +
            require 'aws-sdk-s3/access_grants_credentials'
         | 
| 25 | 
            +
            require 'aws-sdk-s3/access_grants_credentials_provider'
         | 
| 26 | 
            +
             | 
| 19 27 | 
             
            # customizations to generated classes
         | 
| 20 28 | 
             
            require 'aws-sdk-s3/customizations/bucket'
         | 
| 21 29 | 
             
            require 'aws-sdk-s3/customizations/errors'
         | 
| @@ -270,7 +270,9 @@ module Aws | |
| 270 270 | 
             
                        envelope_location: @envelope_location,
         | 
| 271 271 | 
             
                        instruction_file_suffix: @instruction_file_suffix,
         | 
| 272 272 | 
             
                      }
         | 
| 273 | 
            -
                       | 
| 273 | 
            +
                      Aws::Plugins::UserAgent.metric('S3_CRYPTO_V1N') do
         | 
| 274 | 
            +
                        req.send_request
         | 
| 275 | 
            +
                      end
         | 
| 274 276 | 
             
                    end
         | 
| 275 277 |  | 
| 276 278 | 
             
                    # Gets an object from Amazon S3, decrypting  data locally.
         | 
| @@ -298,7 +300,9 @@ module Aws | |
| 298 300 | 
             
                        envelope_location: envelope_location,
         | 
| 299 301 | 
             
                        instruction_file_suffix: instruction_file_suffix,
         | 
| 300 302 | 
             
                      }
         | 
| 301 | 
            -
                       | 
| 303 | 
            +
                      Aws::Plugins::UserAgent.metric('S3_CRYPTO_V1N') do
         | 
| 304 | 
            +
                        req.send_request(target: block)
         | 
| 305 | 
            +
                      end
         | 
| 302 306 | 
             
                    end
         | 
| 303 307 |  | 
| 304 308 | 
             
                    private
         | 
| @@ -17,11 +17,13 @@ module Aws | |
| 17 17 | 
             
                    #   envelope and encryption cipher.
         | 
| 18 18 | 
             
                    def encryption_cipher
         | 
| 19 19 | 
             
                      encryption_context = { "kms_cmk_id" => @kms_key_id }
         | 
| 20 | 
            -
                      key_data =  | 
| 21 | 
            -
                         | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 20 | 
            +
                      key_data = Aws::Plugins::UserAgent.metric('S3_CRYPTO_V1N') do
         | 
| 21 | 
            +
                        @kms_client.generate_data_key(
         | 
| 22 | 
            +
                          key_id: @kms_key_id,
         | 
| 23 | 
            +
                          encryption_context: encryption_context,
         | 
| 24 | 
            +
                          key_spec: 'AES_256'
         | 
| 25 | 
            +
                        )
         | 
| 26 | 
            +
                      end
         | 
| 25 27 | 
             
                      cipher = Utils.aes_encryption_cipher(:CBC)
         | 
| 26 28 | 
             
                      cipher.key = key_data.plaintext
         | 
| 27 29 | 
             
                      envelope = {
         | 
| @@ -58,10 +60,12 @@ module Aws | |
| 58 60 | 
             
                            "#{envelope['x-amz-wrap-alg']}"
         | 
| 59 61 | 
             
                      end
         | 
| 60 62 |  | 
| 61 | 
            -
                      key =  | 
| 62 | 
            -
                         | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 63 | 
            +
                      key = Aws::Plugins::UserAgent.metric('S3_CRYPTO_V1N') do
         | 
| 64 | 
            +
                        @kms_client.decrypt(
         | 
| 65 | 
            +
                          ciphertext_blob: decode64(envelope['x-amz-key-v2']),
         | 
| 66 | 
            +
                          encryption_context: encryption_context
         | 
| 67 | 
            +
                        ).plaintext
         | 
| 68 | 
            +
                      end
         | 
| 65 69 |  | 
| 66 70 | 
             
                      iv = decode64(envelope['x-amz-iv'])
         | 
| 67 71 | 
             
                      block_mode =
         | 
| @@ -361,7 +361,9 @@ module Aws | |
| 361 361 | 
             
                        instruction_file_suffix: @instruction_file_suffix,
         | 
| 362 362 | 
             
                        kms_encryption_context: kms_encryption_context
         | 
| 363 363 | 
             
                      }
         | 
| 364 | 
            -
                       | 
| 364 | 
            +
                      Aws::Plugins::UserAgent.metric('S3_CRYPTO_V2') do
         | 
| 365 | 
            +
                        req.send_request
         | 
| 366 | 
            +
                      end
         | 
| 365 367 | 
             
                    end
         | 
| 366 368 |  | 
| 367 369 | 
             
                    # Gets an object from Amazon S3, decrypting data locally.
         | 
| @@ -414,7 +416,9 @@ module Aws | |
| 414 416 | 
             
                        kms_allow_decrypt_with_any_cmk: kms_any_cmk_mode,
         | 
| 415 417 | 
             
                        security_profile: security_profile
         | 
| 416 418 | 
             
                      }
         | 
| 417 | 
            -
                       | 
| 419 | 
            +
                      Aws::Plugins::UserAgent.metric('S3_CRYPTO_V2') do
         | 
| 420 | 
            +
                        req.send_request(target: block)
         | 
| 421 | 
            +
                      end
         | 
| 418 422 | 
             
                    end
         | 
| 419 423 |  | 
| 420 424 | 
             
                    private
         | 
| @@ -24,11 +24,13 @@ module Aws | |
| 24 24 | 
             
                    def encryption_cipher(options = {})
         | 
| 25 25 | 
             
                      validate_key_for_encryption
         | 
| 26 26 | 
             
                      encryption_context = build_encryption_context(@content_encryption_schema, options)
         | 
| 27 | 
            -
                      key_data =  | 
| 28 | 
            -
                         | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 27 | 
            +
                      key_data = Aws::Plugins::UserAgent.metric('S3_CRYPTO_V2') do
         | 
| 28 | 
            +
                        @kms_client.generate_data_key(
         | 
| 29 | 
            +
                          key_id: @kms_key_id,
         | 
| 30 | 
            +
                          encryption_context: encryption_context,
         | 
| 31 | 
            +
                          key_spec: 'AES_256'
         | 
| 32 | 
            +
                        )
         | 
| 33 | 
            +
                      end
         | 
| 32 34 | 
             
                      cipher = Utils.aes_encryption_cipher(:GCM)
         | 
| 33 35 | 
             
                      cipher.key = key_data.plaintext
         | 
| 34 36 | 
             
                      envelope = {
         | 
| @@ -83,7 +85,9 @@ module Aws | |
| 83 85 | 
             
                        decrypt_options[:key_id] = @kms_key_id
         | 
| 84 86 | 
             
                      end
         | 
| 85 87 |  | 
| 86 | 
            -
                      key =  | 
| 88 | 
            +
                      key = Aws::Plugins::UserAgent.metric('S3_CRYPTO_V2') do
         | 
| 89 | 
            +
                        @kms_client.decrypt(decrypt_options).plaintext
         | 
| 90 | 
            +
                      end
         | 
| 87 91 | 
             
                      iv = decode64(envelope['x-amz-iv'])
         | 
| 88 92 | 
             
                      block_mode =
         | 
| 89 93 | 
             
                        case cek_alg
         | 
| @@ -55,6 +55,21 @@ module Aws::S3 | |
| 55 55 | 
             
              #
         | 
| 56 56 | 
             
              #   @return [Boolean]
         | 
| 57 57 | 
             
              #
         | 
| 58 | 
            +
              # @!attribute key
         | 
| 59 | 
            +
              #   The S3 Key used to send the request. This is an optional parameter that will be set automatically for operations that are scoped to an S3 Key.
         | 
| 60 | 
            +
              #
         | 
| 61 | 
            +
              #   @return [String]
         | 
| 62 | 
            +
              #
         | 
| 63 | 
            +
              # @!attribute prefix
         | 
| 64 | 
            +
              #   The S3 Prefix used to send the request. This is an optional parameter that will be set automatically for operations that are scoped to an S3 Prefix.
         | 
| 65 | 
            +
              #
         | 
| 66 | 
            +
              #   @return [String]
         | 
| 67 | 
            +
              #
         | 
| 68 | 
            +
              # @!attribute copy_source
         | 
| 69 | 
            +
              #   The Copy Source used for Copy Object request. This is an optional parameter that will be set automatically for operations that are scoped to Copy Source.
         | 
| 70 | 
            +
              #
         | 
| 71 | 
            +
              #   @return [String]
         | 
| 72 | 
            +
              #
         | 
| 58 73 | 
             
              # @!attribute disable_access_points
         | 
| 59 74 | 
             
              #   Internal parameter to disable Access Point Buckets
         | 
| 60 75 | 
             
              #
         | 
| @@ -70,6 +85,16 @@ module Aws::S3 | |
| 70 85 | 
             
              #
         | 
| 71 86 | 
             
              #   @return [Boolean]
         | 
| 72 87 | 
             
              #
         | 
| 88 | 
            +
              # @!attribute use_s3_express_control_endpoint
         | 
| 89 | 
            +
              #   Internal parameter to indicate whether S3Express operation should use control plane, (ex. CreateBucket)
         | 
| 90 | 
            +
              #
         | 
| 91 | 
            +
              #   @return [Boolean]
         | 
| 92 | 
            +
              #
         | 
| 93 | 
            +
              # @!attribute disable_s3_express_session_auth
         | 
| 94 | 
            +
              #   Parameter to indicate whether S3Express session auth should be disabled
         | 
| 95 | 
            +
              #
         | 
| 96 | 
            +
              #   @return [Boolean]
         | 
| 97 | 
            +
              #
         | 
| 73 98 | 
             
              EndpointParameters = Struct.new(
         | 
| 74 99 | 
             
                :bucket,
         | 
| 75 100 | 
             
                :region,
         | 
| @@ -80,9 +105,14 @@ module Aws::S3 | |
| 80 105 | 
             
                :accelerate,
         | 
| 81 106 | 
             
                :use_global_endpoint,
         | 
| 82 107 | 
             
                :use_object_lambda_endpoint,
         | 
| 108 | 
            +
                :key,
         | 
| 109 | 
            +
                :prefix,
         | 
| 110 | 
            +
                :copy_source,
         | 
| 83 111 | 
             
                :disable_access_points,
         | 
| 84 112 | 
             
                :disable_multi_region_access_points,
         | 
| 85 113 | 
             
                :use_arn_region,
         | 
| 114 | 
            +
                :use_s3_express_control_endpoint,
         | 
| 115 | 
            +
                :disable_s3_express_session_auth,
         | 
| 86 116 | 
             
              ) do
         | 
| 87 117 | 
             
                include Aws::Structure
         | 
| 88 118 |  | 
| @@ -98,9 +128,14 @@ module Aws::S3 | |
| 98 128 | 
             
                    'Accelerate' => :accelerate,
         | 
| 99 129 | 
             
                    'UseGlobalEndpoint' => :use_global_endpoint,
         | 
| 100 130 | 
             
                    'UseObjectLambdaEndpoint' => :use_object_lambda_endpoint,
         | 
| 131 | 
            +
                    'Key' => :key,
         | 
| 132 | 
            +
                    'Prefix' => :prefix,
         | 
| 133 | 
            +
                    'CopySource' => :copy_source,
         | 
| 101 134 | 
             
                    'DisableAccessPoints' => :disable_access_points,
         | 
| 102 135 | 
             
                    'DisableMultiRegionAccessPoints' => :disable_multi_region_access_points,
         | 
| 103 136 | 
             
                    'UseArnRegion' => :use_arn_region,
         | 
| 137 | 
            +
                    'UseS3ExpressControlEndpoint' => :use_s3_express_control_endpoint,
         | 
| 138 | 
            +
                    'DisableS3ExpressSessionAuth' => :disable_s3_express_session_auth,
         | 
| 104 139 | 
             
                  }.freeze
         | 
| 105 140 | 
             
                end
         | 
| 106 141 |  | 
| @@ -119,6 +154,10 @@ module Aws::S3 | |
| 119 154 | 
             
                  end
         | 
| 120 155 | 
             
                  self[:endpoint] = options[:endpoint]
         | 
| 121 156 | 
             
                  self[:force_path_style] = options[:force_path_style]
         | 
| 157 | 
            +
                  self[:force_path_style] = false if self[:force_path_style].nil?
         | 
| 158 | 
            +
                  if self[:force_path_style].nil?
         | 
| 159 | 
            +
                    raise ArgumentError, "Missing required EndpointParameter: :force_path_style"
         | 
| 160 | 
            +
                  end
         | 
| 122 161 | 
             
                  self[:accelerate] = options[:accelerate]
         | 
| 123 162 | 
             
                  self[:accelerate] = false if self[:accelerate].nil?
         | 
| 124 163 | 
             
                  if self[:accelerate].nil?
         | 
| @@ -130,6 +169,9 @@ module Aws::S3 | |
| 130 169 | 
             
                    raise ArgumentError, "Missing required EndpointParameter: :use_global_endpoint"
         | 
| 131 170 | 
             
                  end
         | 
| 132 171 | 
             
                  self[:use_object_lambda_endpoint] = options[:use_object_lambda_endpoint]
         | 
| 172 | 
            +
                  self[:key] = options[:key]
         | 
| 173 | 
            +
                  self[:prefix] = options[:prefix]
         | 
| 174 | 
            +
                  self[:copy_source] = options[:copy_source]
         | 
| 133 175 | 
             
                  self[:disable_access_points] = options[:disable_access_points]
         | 
| 134 176 | 
             
                  self[:disable_multi_region_access_points] = options[:disable_multi_region_access_points]
         | 
| 135 177 | 
             
                  self[:disable_multi_region_access_points] = false if self[:disable_multi_region_access_points].nil?
         | 
| @@ -137,6 +179,8 @@ module Aws::S3 | |
| 137 179 | 
             
                    raise ArgumentError, "Missing required EndpointParameter: :disable_multi_region_access_points"
         | 
| 138 180 | 
             
                  end
         | 
| 139 181 | 
             
                  self[:use_arn_region] = options[:use_arn_region]
         | 
| 182 | 
            +
                  self[:use_s3_express_control_endpoint] = options[:use_s3_express_control_endpoint]
         | 
| 183 | 
            +
                  self[:disable_s3_express_session_auth] = options[:disable_s3_express_session_auth]
         | 
| 140 184 | 
             
                end
         | 
| 141 185 | 
             
              end
         | 
| 142 186 | 
             
            end
         |