aws-sdk-s3 1.74.0 → 1.79.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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aws-sdk-s3.rb +2 -2
  3. data/lib/aws-sdk-s3/bucket.rb +2 -2
  4. data/lib/aws-sdk-s3/client.rb +148 -120
  5. data/lib/aws-sdk-s3/customizations/object.rb +12 -1
  6. data/lib/aws-sdk-s3/encryption.rb +2 -0
  7. data/lib/aws-sdk-s3/encryption/client.rb +11 -0
  8. data/lib/aws-sdk-s3/encryption/decrypt_handler.rb +64 -29
  9. data/lib/aws-sdk-s3/encryption/default_cipher_provider.rb +41 -5
  10. data/lib/aws-sdk-s3/encryption/encrypt_handler.rb +5 -5
  11. data/lib/aws-sdk-s3/encryption/io_decrypter.rb +7 -6
  12. data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +32 -3
  13. data/lib/aws-sdk-s3/encryption/utils.rb +23 -0
  14. data/lib/aws-sdk-s3/encryptionV2/client.rb +201 -23
  15. data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +40 -12
  16. data/lib/aws-sdk-s3/encryptionV2/default_cipher_provider.rb +77 -10
  17. data/lib/aws-sdk-s3/encryptionV2/default_key_provider.rb +2 -0
  18. data/lib/aws-sdk-s3/encryptionV2/encrypt_handler.rb +7 -4
  19. data/lib/aws-sdk-s3/encryptionV2/errors.rb +24 -0
  20. data/lib/aws-sdk-s3/encryptionV2/io_auth_decrypter.rb +2 -0
  21. data/lib/aws-sdk-s3/encryptionV2/io_decrypter.rb +2 -0
  22. data/lib/aws-sdk-s3/encryptionV2/io_encrypter.rb +2 -0
  23. data/lib/aws-sdk-s3/encryptionV2/key_provider.rb +2 -0
  24. data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +90 -20
  25. data/lib/aws-sdk-s3/encryptionV2/materials.rb +2 -0
  26. data/lib/aws-sdk-s3/encryptionV2/utils.rb +2 -15
  27. data/lib/aws-sdk-s3/encryption_v2.rb +4 -1
  28. data/lib/aws-sdk-s3/file_uploader.rb +11 -0
  29. data/lib/aws-sdk-s3/multipart_file_uploader.rb +37 -2
  30. data/lib/aws-sdk-s3/multipart_upload_part.rb +1 -1
  31. data/lib/aws-sdk-s3/object.rb +1 -1
  32. data/lib/aws-sdk-s3/object_summary.rb +19 -3
  33. data/lib/aws-sdk-s3/plugins/accelerate.rb +3 -1
  34. data/lib/aws-sdk-s3/plugins/dualstack.rb +3 -1
  35. data/lib/aws-sdk-s3/plugins/sse_cpk.rb +1 -1
  36. data/lib/aws-sdk-s3/presigner.rb +2 -2
  37. data/lib/aws-sdk-s3/resource.rb +1 -1
  38. data/lib/aws-sdk-s3/types.rb +25 -8
  39. metadata +4 -4
@@ -29,6 +29,9 @@ module Aws
29
29
  # @param [String, Pathname, File, Tempfile] source The file to upload.
30
30
  # @option options [required, String] :bucket The bucket to upload to.
31
31
  # @option options [required, String] :key The key for the object.
32
+ # @option options [Proc] :progress_callback
33
+ # A Proc that will be called when each chunk of the upload is sent.
34
+ # It will be invoked with [bytes_read], [total_sizes]
32
35
  # @return [void]
33
36
  def upload(source, options = {})
34
37
  if File.size(source) >= multipart_threshold
@@ -49,11 +52,19 @@ module Aws
49
52
  end
50
53
 
51
54
  def put_object(source, options)
55
+ if (callback = options.delete(:progress_callback))
56
+ options[:on_chunk_sent] = single_part_progress(callback)
57
+ end
52
58
  open_file(source) do |file|
53
59
  @client.put_object(options.merge(body: file))
54
60
  end
55
61
  end
56
62
 
63
+ def single_part_progress(progress_callback)
64
+ proc do |_chunk, bytes_read, total_size|
65
+ progress_callback.call([bytes_read], [total_size])
66
+ end
67
+ end
57
68
  end
58
69
  end
59
70
  end
@@ -39,6 +39,9 @@ module Aws
39
39
  # @param [String, Pathname, File, Tempfile] source The file to upload.
40
40
  # @option options [required, String] :bucket The bucket to upload to.
41
41
  # @option options [required, String] :key The key for the object.
42
+ # @option options [Proc] :progress_callback
43
+ # A Proc that will be called when each chunk of the upload is sent.
44
+ # It will be invoked with [bytes_read], [total_sizes]
42
45
  # @return [void]
43
46
  def upload(source, options = {})
44
47
  if File.size(source) < MIN_PART_SIZE
@@ -68,7 +71,7 @@ module Aws
68
71
  def upload_parts(upload_id, source, options)
69
72
  pending = PartList.new(compute_parts(upload_id, source, options))
70
73
  completed = PartList.new
71
- errors = upload_in_threads(pending, completed)
74
+ errors = upload_in_threads(pending, completed, options)
72
75
  if errors.empty?
73
76
  completed.to_a.sort_by { |part| part[:part_number] }
74
77
  else
@@ -127,12 +130,21 @@ module Aws
127
130
  end
128
131
  end
129
132
 
130
- def upload_in_threads(pending, completed)
133
+ def upload_in_threads(pending, completed, options)
131
134
  threads = []
135
+ if (callback = options[:progress_callback])
136
+ progress = MultipartProgress.new(pending, callback)
137
+ end
132
138
  @thread_count.times do
133
139
  thread = Thread.new do
134
140
  begin
135
141
  while part = pending.shift
142
+ if progress
143
+ part[:on_chunk_sent] =
144
+ proc do |_chunk, bytes, _total|
145
+ progress.call(part[:part_number], bytes)
146
+ end
147
+ end
136
148
  resp = @client.upload_part(part)
137
149
  part[:body].close
138
150
  completed.push(etag: resp.etag, part_number: part[:part_number])
@@ -182,11 +194,34 @@ module Aws
182
194
  @mutex.synchronize { @parts.clear }
183
195
  end
184
196
 
197
+ def size
198
+ @mutex.synchronize { @parts.size }
199
+ end
200
+
201
+ def part_sizes
202
+ @mutex.synchronize { @parts.map { |p| p[:body].size } }
203
+ end
204
+
185
205
  def to_a
186
206
  @mutex.synchronize { @parts.dup }
187
207
  end
188
208
 
189
209
  end
210
+
211
+ # @api private
212
+ class MultipartProgress
213
+ def initialize(parts, progress_callback)
214
+ @bytes_sent = Array.new(parts.size, 0)
215
+ @total_sizes = parts.part_sizes
216
+ @progress_callback = progress_callback
217
+ end
218
+
219
+ def call(part_number, bytes_read)
220
+ # part numbers start at 1
221
+ @bytes_sent[part_number - 1] = bytes_read
222
+ @progress_callback.call(@bytes_sent, @total_sizes)
223
+ end
224
+ end
190
225
  end
191
226
  end
192
227
  end
@@ -302,7 +302,7 @@ module Aws::S3
302
302
  # request_payer: "requester", # accepts requester
303
303
  # })
304
304
  # @param [Hash] options ({})
305
- # @option options [String, IO] :body
305
+ # @option options [String, StringIO, File] :body
306
306
  # Object data.
307
307
  # @option options [Integer] :content_length
308
308
  # Size of the body in bytes. This parameter is useful when the size of
@@ -983,7 +983,7 @@ module Aws::S3
983
983
  #
984
984
  #
985
985
  # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL
986
- # @option options [String, IO] :body
986
+ # @option options [String, StringIO, File] :body
987
987
  # Object data.
988
988
  # @option options [String] :cache_control
989
989
  # Can be used to specify caching behavior along the request/reply chain.
@@ -48,8 +48,24 @@ module Aws::S3
48
48
  data[:last_modified]
49
49
  end
50
50
 
51
- # The entity tag is an MD5 hash of the object. ETag reflects only
52
- # changes to the contents of an object, not its metadata.
51
+ # The entity tag is a hash of the object. The ETag reflects changes only
52
+ # to the contents of an object, not its metadata. The ETag may or may
53
+ # not be an MD5 digest of the object data. Whether or not it is depends
54
+ # on how the object was created and how it is encrypted as described
55
+ # below:
56
+ #
57
+ # * Objects created by the PUT Object, POST Object, or Copy operation,
58
+ # or through the AWS Management Console, and are encrypted by SSE-S3
59
+ # or plaintext, have ETags that are an MD5 digest of their object
60
+ # data.
61
+ #
62
+ # * Objects created by the PUT Object, POST Object, or Copy operation,
63
+ # or through the AWS Management Console, and are encrypted by SSE-C or
64
+ # SSE-KMS, have ETags that are not an MD5 digest of their object data.
65
+ #
66
+ # * If an object is created by either the Multipart Upload or Part Copy
67
+ # operation, the ETag is not an MD5 digest, regardless of the method
68
+ # of encryption.
53
69
  # @return [String]
54
70
  def etag
55
71
  data[:etag]
@@ -733,7 +749,7 @@ module Aws::S3
733
749
  #
734
750
  #
735
751
  # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL
736
- # @option options [String, IO] :body
752
+ # @option options [String, StringIO, File] :body
737
753
  # Object data.
738
754
  # @option options [String] :cache_control
739
755
  # Can be used to specify caching behavior along the request/reply chain.
@@ -37,7 +37,9 @@ each bucket. [Go here for more information](http://docs.aws.amazon.com/AmazonS3/
37
37
  class OptionHandler < Seahorse::Client::Handler
38
38
  def call(context)
39
39
  # Support client configuration and per-operation configuration
40
- accelerate = context.params.delete(:use_accelerate_endpoint)
40
+ if context.params.is_a?(Hash)
41
+ accelerate = context.params.delete(:use_accelerate_endpoint)
42
+ end
41
43
  if accelerate.nil?
42
44
  accelerate = context.config.use_accelerate_endpoint
43
45
  end
@@ -22,7 +22,9 @@ for all operations.
22
22
  # @api private
23
23
  class OptionHandler < Seahorse::Client::Handler
24
24
  def call(context)
25
- dualstack = context.params.delete(:use_dualstack_endpoint)
25
+ if context.params.is_a?(Hash)
26
+ dualstack = context.params.delete(:use_dualstack_endpoint)
27
+ end
26
28
  dualstack = context.config.use_dualstack_endpoint if dualstack.nil?
27
29
  context[:use_dualstack_endpoint] = dualstack
28
30
  @handler.call(context)
@@ -20,7 +20,7 @@ This should only be disabled for local testing.
20
20
  class Handler < Seahorse::Client::Handler
21
21
 
22
22
  def call(context)
23
- compute_key_md5(context)
23
+ compute_key_md5(context) if context.params.is_a?(Hash)
24
24
  @handler.call(context)
25
25
  end
26
26
 
@@ -41,7 +41,7 @@ module Aws
41
41
  # signer = Aws::S3::Presigner.new
42
42
  # url = signer.presigned_url(:get_object, bucket: "bucket", key: "key")
43
43
  #
44
- # @param [Symbol] :method Symbolized method name of the operation you want
44
+ # @param [Symbol] method Symbolized method name of the operation you want
45
45
  # to presign.
46
46
  #
47
47
  # @option params [Integer] :expires_in (900) The number of seconds
@@ -89,7 +89,7 @@ module Aws
89
89
  # :get_object, bucket: "bucket", key: "key"
90
90
  # )
91
91
  #
92
- # @param [Symbol] :method Symbolized method name of the operation you want
92
+ # @param [Symbol] method Symbolized method name of the operation you want
93
93
  # to presign.
94
94
  #
95
95
  # @option params [Integer] :expires_in (900) The number of seconds
@@ -41,7 +41,7 @@ module Aws::S3
41
41
  # acl: "private", # accepts private, public-read, public-read-write, authenticated-read
42
42
  # bucket: "BucketName", # required
43
43
  # create_bucket_configuration: {
44
- # location_constraint: "EU", # accepts EU, eu-west-1, us-west-1, us-west-2, ap-south-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, sa-east-1, cn-north-1, eu-central-1
44
+ # location_constraint: "af-south-1", # accepts af-south-1, ap-east-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-southeast-1, ap-southeast-2, ca-central-1, cn-north-1, cn-northwest-1, EU, eu-central-1, eu-north-1, eu-south-1, eu-west-1, eu-west-2, eu-west-3, me-south-1, sa-east-1, us-east-2, us-gov-east-1, us-gov-west-1, us-west-1, us-west-2
45
45
  # },
46
46
  # grant_full_control: "GrantFullControl",
47
47
  # grant_read: "GrantRead",
@@ -1517,7 +1517,7 @@ module Aws::S3
1517
1517
  # data as a hash:
1518
1518
  #
1519
1519
  # {
1520
- # location_constraint: "EU", # accepts EU, eu-west-1, us-west-1, us-west-2, ap-south-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, sa-east-1, cn-north-1, eu-central-1
1520
+ # location_constraint: "af-south-1", # accepts af-south-1, ap-east-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-southeast-1, ap-southeast-2, ca-central-1, cn-north-1, cn-northwest-1, EU, eu-central-1, eu-north-1, eu-south-1, eu-west-1, eu-west-2, eu-west-3, me-south-1, sa-east-1, us-east-2, us-gov-east-1, us-gov-west-1, us-west-1, us-west-2
1521
1521
  # }
1522
1522
  #
1523
1523
  # @!attribute [rw] location_constraint
@@ -1555,7 +1555,7 @@ module Aws::S3
1555
1555
  # acl: "private", # accepts private, public-read, public-read-write, authenticated-read
1556
1556
  # bucket: "BucketName", # required
1557
1557
  # create_bucket_configuration: {
1558
- # location_constraint: "EU", # accepts EU, eu-west-1, us-west-1, us-west-2, ap-south-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, sa-east-1, cn-north-1, eu-central-1
1558
+ # location_constraint: "af-south-1", # accepts af-south-1, ap-east-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-southeast-1, ap-southeast-2, ca-central-1, cn-north-1, cn-northwest-1, EU, eu-central-1, eu-north-1, eu-south-1, eu-west-1, eu-west-2, eu-west-3, me-south-1, sa-east-1, us-east-2, us-gov-east-1, us-gov-west-1, us-west-1, us-west-2
1559
1559
  # },
1560
1560
  # grant_full_control: "GrantFullControl",
1561
1561
  # grant_read: "GrantRead",
@@ -2457,7 +2457,7 @@ module Aws::S3
2457
2457
  # @return [String]
2458
2458
  #
2459
2459
  # @!attribute [rw] key
2460
- # Name of the tag.
2460
+ # Name of the object key.
2461
2461
  # @return [String]
2462
2462
  #
2463
2463
  # @!attribute [rw] version_id
@@ -7042,7 +7042,7 @@ module Aws::S3
7042
7042
  # in the subsequent request to get next set of objects. Amazon S3
7043
7043
  # lists objects in alphabetical order Note: This element is returned
7044
7044
  # only if you have delimiter request parameter specified. If response
7045
- # does not include the NextMaker and it is truncated, you can use the
7045
+ # does not include the NextMarker and it is truncated, you can use the
7046
7046
  # value of the last Key in the response as the marker in the
7047
7047
  # subsequent request to get the next set of object keys.
7048
7048
  # @return [String]
@@ -8140,8 +8140,25 @@ module Aws::S3
8140
8140
  # @return [Time]
8141
8141
  #
8142
8142
  # @!attribute [rw] etag
8143
- # The entity tag is an MD5 hash of the object. ETag reflects only
8144
- # changes to the contents of an object, not its metadata.
8143
+ # The entity tag is a hash of the object. The ETag reflects changes
8144
+ # only to the contents of an object, not its metadata. The ETag may or
8145
+ # may not be an MD5 digest of the object data. Whether or not it is
8146
+ # depends on how the object was created and how it is encrypted as
8147
+ # described below:
8148
+ #
8149
+ # * Objects created by the PUT Object, POST Object, or Copy operation,
8150
+ # or through the AWS Management Console, and are encrypted by SSE-S3
8151
+ # or plaintext, have ETags that are an MD5 digest of their object
8152
+ # data.
8153
+ #
8154
+ # * Objects created by the PUT Object, POST Object, or Copy operation,
8155
+ # or through the AWS Management Console, and are encrypted by SSE-C
8156
+ # or SSE-KMS, have ETags that are not an MD5 digest of their object
8157
+ # data.
8158
+ #
8159
+ # * If an object is created by either the Multipart Upload or Part
8160
+ # Copy operation, the ETag is not an MD5 digest, regardless of the
8161
+ # method of encryption.
8145
8162
  # @return [String]
8146
8163
  #
8147
8164
  # @!attribute [rw] size
@@ -10553,7 +10570,7 @@ module Aws::S3
10553
10570
  # @return [String]
10554
10571
  #
10555
10572
  # @!attribute [rw] key
10556
- # Name of the tag.
10573
+ # Name of the object key.
10557
10574
  # @return [String]
10558
10575
  #
10559
10576
  # @!attribute [rw] version_id
@@ -12453,7 +12470,7 @@ module Aws::S3
12453
12470
  # }
12454
12471
  #
12455
12472
  # @!attribute [rw] key
12456
- # Name of the tag.
12473
+ # Name of the object key.
12457
12474
  # @return [String]
12458
12475
  #
12459
12476
  # @!attribute [rw] value
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.74.0
4
+ version: 1.79.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-08 00:00:00.000000000 Z
11
+ date: 2020-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-kms
@@ -47,7 +47,7 @@ dependencies:
47
47
  version: '3'
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: 3.102.1
50
+ version: 3.104.3
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -57,7 +57,7 @@ dependencies:
57
57
  version: '3'
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: 3.102.1
60
+ version: 3.104.3
61
61
  description: Official AWS Ruby gem for Amazon Simple Storage Service (Amazon S3).
62
62
  This gem is part of the AWS SDK for Ruby.
63
63
  email: