aws-sdk-s3 1.36.0 → 1.95.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +768 -0
  3. data/LICENSE.txt +202 -0
  4. data/VERSION +1 -0
  5. data/lib/aws-sdk-s3/arn/access_point_arn.rb +69 -0
  6. data/lib/aws-sdk-s3/arn/object_lambda_arn.rb +69 -0
  7. data/lib/aws-sdk-s3/arn/outpost_access_point_arn.rb +73 -0
  8. data/lib/aws-sdk-s3/bucket.rb +277 -76
  9. data/lib/aws-sdk-s3/bucket_acl.rb +40 -15
  10. data/lib/aws-sdk-s3/bucket_cors.rb +50 -14
  11. data/lib/aws-sdk-s3/bucket_lifecycle.rb +33 -14
  12. data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +32 -14
  13. data/lib/aws-sdk-s3/bucket_logging.rb +35 -15
  14. data/lib/aws-sdk-s3/bucket_notification.rb +32 -18
  15. data/lib/aws-sdk-s3/bucket_policy.rb +34 -13
  16. data/lib/aws-sdk-s3/bucket_region_cache.rb +2 -0
  17. data/lib/aws-sdk-s3/bucket_request_payment.rb +34 -12
  18. data/lib/aws-sdk-s3/bucket_tagging.rb +42 -14
  19. data/lib/aws-sdk-s3/bucket_versioning.rb +67 -12
  20. data/lib/aws-sdk-s3/bucket_website.rb +49 -17
  21. data/lib/aws-sdk-s3/client.rb +7494 -618
  22. data/lib/aws-sdk-s3/client_api.rb +417 -2
  23. data/lib/aws-sdk-s3/customizations/bucket.rb +59 -16
  24. data/lib/aws-sdk-s3/customizations/multipart_upload.rb +2 -0
  25. data/lib/aws-sdk-s3/customizations/object.rb +125 -60
  26. data/lib/aws-sdk-s3/customizations/object_summary.rb +5 -0
  27. data/lib/aws-sdk-s3/customizations/types/list_object_versions_output.rb +2 -0
  28. data/lib/aws-sdk-s3/customizations.rb +4 -1
  29. data/lib/aws-sdk-s3/encryption/client.rb +22 -5
  30. data/lib/aws-sdk-s3/encryption/decrypt_handler.rb +72 -26
  31. data/lib/aws-sdk-s3/encryption/default_cipher_provider.rb +43 -5
  32. data/lib/aws-sdk-s3/encryption/default_key_provider.rb +2 -0
  33. data/lib/aws-sdk-s3/encryption/encrypt_handler.rb +13 -2
  34. data/lib/aws-sdk-s3/encryption/errors.rb +2 -0
  35. data/lib/aws-sdk-s3/encryption/io_auth_decrypter.rb +2 -0
  36. data/lib/aws-sdk-s3/encryption/io_decrypter.rb +11 -3
  37. data/lib/aws-sdk-s3/encryption/io_encrypter.rb +2 -0
  38. data/lib/aws-sdk-s3/encryption/key_provider.rb +2 -0
  39. data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +34 -3
  40. data/lib/aws-sdk-s3/encryption/materials.rb +8 -6
  41. data/lib/aws-sdk-s3/encryption/utils.rb +25 -0
  42. data/lib/aws-sdk-s3/encryption.rb +4 -0
  43. data/lib/aws-sdk-s3/encryptionV2/client.rb +566 -0
  44. data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +226 -0
  45. data/lib/aws-sdk-s3/encryptionV2/default_cipher_provider.rb +170 -0
  46. data/lib/aws-sdk-s3/encryptionV2/default_key_provider.rb +40 -0
  47. data/lib/aws-sdk-s3/encryptionV2/encrypt_handler.rb +69 -0
  48. data/lib/aws-sdk-s3/encryptionV2/errors.rb +37 -0
  49. data/lib/aws-sdk-s3/encryptionV2/io_auth_decrypter.rb +58 -0
  50. data/lib/aws-sdk-s3/encryptionV2/io_decrypter.rb +37 -0
  51. data/lib/aws-sdk-s3/encryptionV2/io_encrypter.rb +73 -0
  52. data/lib/aws-sdk-s3/encryptionV2/key_provider.rb +31 -0
  53. data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +169 -0
  54. data/lib/aws-sdk-s3/encryptionV2/materials.rb +60 -0
  55. data/lib/aws-sdk-s3/encryptionV2/utils.rb +103 -0
  56. data/lib/aws-sdk-s3/encryption_v2.rb +23 -0
  57. data/lib/aws-sdk-s3/errors.rb +123 -1
  58. data/lib/aws-sdk-s3/event_streams.rb +15 -8
  59. data/lib/aws-sdk-s3/file_downloader.rb +10 -8
  60. data/lib/aws-sdk-s3/file_part.rb +11 -6
  61. data/lib/aws-sdk-s3/file_uploader.rb +28 -14
  62. data/lib/aws-sdk-s3/legacy_signer.rb +17 -25
  63. data/lib/aws-sdk-s3/multipart_file_uploader.rb +53 -13
  64. data/lib/aws-sdk-s3/multipart_stream_uploader.rb +20 -7
  65. data/lib/aws-sdk-s3/multipart_upload.rb +64 -29
  66. data/lib/aws-sdk-s3/multipart_upload_error.rb +2 -0
  67. data/lib/aws-sdk-s3/multipart_upload_part.rb +115 -42
  68. data/lib/aws-sdk-s3/object.rb +656 -151
  69. data/lib/aws-sdk-s3/object_acl.rb +64 -21
  70. data/lib/aws-sdk-s3/object_copier.rb +2 -0
  71. data/lib/aws-sdk-s3/object_multipart_copier.rb +2 -0
  72. data/lib/aws-sdk-s3/object_summary.rb +474 -138
  73. data/lib/aws-sdk-s3/object_version.rb +122 -58
  74. data/lib/aws-sdk-s3/plugins/accelerate.rb +32 -38
  75. data/lib/aws-sdk-s3/plugins/arn.rb +228 -0
  76. data/lib/aws-sdk-s3/plugins/bucket_dns.rb +7 -7
  77. data/lib/aws-sdk-s3/plugins/bucket_name_restrictions.rb +25 -3
  78. data/lib/aws-sdk-s3/plugins/dualstack.rb +15 -4
  79. data/lib/aws-sdk-s3/plugins/expect_100_continue.rb +4 -4
  80. data/lib/aws-sdk-s3/plugins/get_bucket_location_fix.rb +2 -0
  81. data/lib/aws-sdk-s3/plugins/http_200_errors.rb +11 -3
  82. data/lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb +67 -0
  83. data/lib/aws-sdk-s3/plugins/location_constraint.rb +2 -0
  84. data/lib/aws-sdk-s3/plugins/md5s.rb +30 -28
  85. data/lib/aws-sdk-s3/plugins/object_lambda_endpoint.rb +25 -0
  86. data/lib/aws-sdk-s3/plugins/redirects.rb +2 -0
  87. data/lib/aws-sdk-s3/plugins/s3_host_id.rb +2 -0
  88. data/lib/aws-sdk-s3/plugins/s3_signer.rb +64 -35
  89. data/lib/aws-sdk-s3/plugins/sse_cpk.rb +3 -1
  90. data/lib/aws-sdk-s3/plugins/streaming_retry.rb +118 -0
  91. data/lib/aws-sdk-s3/plugins/url_encoded_keys.rb +2 -0
  92. data/lib/aws-sdk-s3/presigned_post.rb +72 -32
  93. data/lib/aws-sdk-s3/presigner.rb +162 -66
  94. data/lib/aws-sdk-s3/resource.rb +23 -5
  95. data/lib/aws-sdk-s3/types.rb +6441 -952
  96. data/lib/aws-sdk-s3/waiters.rb +67 -1
  97. data/lib/aws-sdk-s3.rb +12 -6
  98. metadata +35 -12
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
4
  require 'thread'
3
5
  require 'set'
@@ -21,7 +23,7 @@ module Aws
21
23
 
22
24
  def download(destination, options = {})
23
25
  @path = destination
24
- @mode = options[:mode] || "auto"
26
+ @mode = options[:mode] || 'auto'
25
27
  @thread_count = options[:thread_count] || THREAD_COUNT
26
28
  @chunk_size = options[:chunk_size]
27
29
  @params = {
@@ -31,19 +33,19 @@ module Aws
31
33
  @params[:version_id] = options[:version_id] if options[:version_id]
32
34
 
33
35
  case @mode
34
- when "auto" then multipart_download
35
- when "single_request" then single_request
36
- when "get_range"
36
+ when 'auto' then multipart_download
37
+ when 'single_request' then single_request
38
+ when 'get_range'
37
39
  if @chunk_size
38
40
  resp = @client.head_object(@params)
39
41
  multithreaded_get_by_ranges(construct_chunks(resp.content_length))
40
42
  else
41
- msg = "In :get_range mode, :chunk_size must be provided"
43
+ msg = 'In :get_range mode, :chunk_size must be provided'
42
44
  raise ArgumentError, msg
43
45
  end
44
46
  else
45
47
  msg = "Invalid mode #{@mode} provided, "\
46
- "mode should be :single_request, :get_range or :auto"
48
+ 'mode should be :single_request, :get_range or :auto'
47
49
  raise ArgumentError, msg
48
50
  end
49
51
  end
@@ -125,8 +127,8 @@ module Aws
125
127
  end
126
128
 
127
129
  def write(resp)
128
- range, _ = resp.content_range.split(" ").last.split("/")
129
- head, _ = range.split("-").map {|s| s.to_i}
130
+ range, _ = resp.content_range.split(' ').last.split('/')
131
+ head, _ = range.split('-').map {|s| s.to_i}
130
132
  IO.write(@path, resp.body.read, head)
131
133
  end
132
134
 
@@ -1,15 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Aws
2
4
  module S3
3
5
 
4
- # A utility class that provides an IO-like interface to a portion of
5
- # a file on disk.
6
+ # A utility class that provides an IO-like interface to a portion of a file
7
+ # on disk.
6
8
  # @api private
7
9
  class FilePart
8
10
 
9
- # @option options [required,String,Pathname,File,Tempfile] :source
10
- # @option options [required,Integer] :offset The file part will read
11
+ # @option options [required, String, Pathname, File, Tempfile] :source
12
+ # The file to upload.
13
+ #
14
+ # @option options [required, Integer] :offset The file part will read
11
15
  # starting at this byte offset.
12
- # @option options [required,Integer] :size The maximum number of bytes to
16
+ #
17
+ # @option options [required, Integer] :size The maximum number of bytes to
13
18
  # read from the `:offset`.
14
19
  def initialize(options = {})
15
20
  @source = options[:source]
@@ -19,7 +24,7 @@ module Aws
19
24
  @file = nil
20
25
  end
21
26
 
22
- # @return [String,Pathname,File,Tempfile]
27
+ # @return [String, Pathname, File, Tempfile]
23
28
  attr_reader :source
24
29
 
25
30
  # @return [Integer]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
4
 
3
5
  module Aws
@@ -5,27 +7,31 @@ module Aws
5
7
  # @api private
6
8
  class FileUploader
7
9
 
8
- FIFTEEN_MEGABYTES = 15 * 1024 * 1024
10
+ ONE_HUNDRED_MEGABYTES = 100 * 1024 * 1024
9
11
 
12
+ # @param [Hash] options
10
13
  # @option options [Client] :client
11
- # @option options [Integer] :multipart_threshold Files greater than
12
- # `:multipart_threshold` bytes are uploaded using S3 multipart APIs.
14
+ # @option options [Integer] :multipart_threshold (15728640)
13
15
  def initialize(options = {})
14
16
  @options = options
15
17
  @client = options[:client] || Client.new
16
- @multipart_threshold = options[:multipart_threshold] || FIFTEEN_MEGABYTES
18
+ @multipart_threshold = options[:multipart_threshold] ||
19
+ ONE_HUNDRED_MEGABYTES
17
20
  end
18
21
 
19
22
  # @return [Client]
20
23
  attr_reader :client
21
24
 
22
- # @return [Integer] Files larger than this in bytes are uploaded
25
+ # @return [Integer] Files larger than or equal to this in bytes are uploaded
23
26
  # using a {MultipartFileUploader}.
24
27
  attr_reader :multipart_threshold
25
28
 
26
- # @param [String,Pathname,File,Tempfile] source
27
- # @option options [required,String] :bucket
28
- # @option options [required,String] :key
29
+ # @param [String, Pathname, File, Tempfile] source The file to upload.
30
+ # @option options [required, String] :bucket The bucket to upload to.
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]
29
35
  # @return [void]
30
36
  def upload(source, options = {})
31
37
  if File.size(source) >= multipart_threshold
@@ -37,12 +43,6 @@ module Aws
37
43
 
38
44
  private
39
45
 
40
- def put_object(source, options)
41
- open_file(source) do |file|
42
- @client.put_object(options.merge(body: file))
43
- end
44
- end
45
-
46
46
  def open_file(source)
47
47
  if String === source || Pathname === source
48
48
  File.open(source, 'rb') { |file| yield(file) }
@@ -51,6 +51,20 @@ module Aws
51
51
  end
52
52
  end
53
53
 
54
+ def put_object(source, options)
55
+ if (callback = options.delete(:progress_callback))
56
+ options[:on_chunk_sent] = single_part_progress(callback)
57
+ end
58
+ open_file(source) do |file|
59
+ @client.put_object(options.merge(body: file))
60
+ end
61
+ end
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
54
68
  end
55
69
  end
56
70
  end
@@ -1,8 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'set'
2
4
  require 'time'
3
5
  require 'openssl'
4
6
  require 'cgi'
5
- require 'webrick/httputils'
6
7
  require 'aws-sdk-core/query'
7
8
 
8
9
  module Aws
@@ -155,33 +156,24 @@ module Aws
155
156
  end
156
157
 
157
158
  def uri_escape(s)
158
-
159
159
  #URI.escape(s)
160
160
 
161
- # URI.escape is deprecated, replacing it with escape from webrick
162
- # to squelch the massive number of warnings generated from Ruby.
163
- # The following script was used to determine the differences
164
- # between the various escape methods available. The webrick
165
- # escape only had two differences and it is available in the
166
- # standard lib.
167
- #
168
- # (0..255).each {|c|
169
- # s = [c].pack("C")
170
- # e = [
171
- # CGI.escape(s),
172
- # ERB::Util.url_encode(s),
173
- # URI.encode_www_form_component(s),
174
- # WEBrick::HTTPUtils.escape_form(s),
175
- # WEBrick::HTTPUtils.escape(s),
176
- # URI.escape(s),
177
- # ]
178
- # next if e.uniq.length == 1
179
- # puts("%5s %5s %5s %5s %5s %5s %5s" % ([s.inspect] + e))
180
- # }
181
- #
182
- WEBrick::HTTPUtils.escape(s).gsub('%5B', '[').gsub('%5D', ']')
161
+ # (0..255).each {|c|
162
+ # s = [c].pack("C")
163
+ # e = [
164
+ # CGI.escape(s),
165
+ # ERB::Util.url_encode(s),
166
+ # URI.encode_www_form_component(s),
167
+ # WEBrick::HTTPUtils.escape_form(s),
168
+ # WEBrick::HTTPUtils.escape(s),
169
+ # URI.escape(s),
170
+ # URI::DEFAULT_PARSER.escape(s)
171
+ # ]
172
+ # next if e.uniq.length == 1
173
+ # puts("%5s %5s %5s %5s %5s %5s %5s %5s" % ([s.inspect] + e))
174
+ # }
175
+ URI::DEFAULT_PARSER.escape(s)
183
176
  end
184
-
185
177
  end
186
178
  end
187
179
  end
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
- require 'thread'
3
4
  require 'set'
4
5
 
5
6
  module Aws
@@ -16,14 +17,17 @@ module Aws
16
17
  THREAD_COUNT = 10
17
18
 
18
19
  # @api private
19
- CREATE_OPTIONS =
20
- Set.new(Client.api.operation(:create_multipart_upload).input.shape.member_names)
20
+ CREATE_OPTIONS = Set.new(
21
+ Client.api.operation(:create_multipart_upload).input.shape.member_names
22
+ )
21
23
 
22
24
  # @api private
23
- UPLOAD_PART_OPTIONS =
24
- Set.new(Client.api.operation(:upload_part).input.shape.member_names)
25
+ UPLOAD_PART_OPTIONS = Set.new(
26
+ Client.api.operation(:upload_part).input.shape.member_names
27
+ )
25
28
 
26
29
  # @option options [Client] :client
30
+ # @option options [Integer] :thread_count (THREAD_COUNT)
27
31
  def initialize(options = {})
28
32
  @client = options[:client] || Client.new
29
33
  @thread_count = options[:thread_count] || THREAD_COUNT
@@ -32,9 +36,12 @@ module Aws
32
36
  # @return [Client]
33
37
  attr_reader :client
34
38
 
35
- # @param [String,Pathname,File,Tempfile] source
36
- # @option options [required,String] :bucket
37
- # @option options [required,String] :key
39
+ # @param [String, Pathname, File, Tempfile] source The file to upload.
40
+ # @option options [required, String] :bucket The bucket to upload to.
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]
38
45
  # @return [void]
39
46
  def upload(source, options = {})
40
47
  if File.size(source) < MIN_PART_SIZE
@@ -57,13 +64,14 @@ module Aws
57
64
  bucket: options[:bucket],
58
65
  key: options[:key],
59
66
  upload_id: upload_id,
60
- multipart_upload: { parts: parts })
67
+ multipart_upload: { parts: parts }
68
+ )
61
69
  end
62
70
 
63
71
  def upload_parts(upload_id, source, options)
64
72
  pending = PartList.new(compute_parts(upload_id, source, options))
65
73
  completed = PartList.new
66
- errors = upload_in_threads(pending, completed)
74
+ errors = upload_in_threads(pending, completed, options)
67
75
  if errors.empty?
68
76
  completed.to_a.sort_by { |part| part[:part_number] }
69
77
  else
@@ -93,7 +101,7 @@ module Aws
93
101
  part_number = 1
94
102
  parts = []
95
103
  while offset < size
96
- parts << upload_part_opts(options).merge({
104
+ parts << upload_part_opts(options).merge(
97
105
  upload_id: upload_id,
98
106
  part_number: part_number,
99
107
  body: FilePart.new(
@@ -101,7 +109,7 @@ module Aws
101
109
  offset: offset,
102
110
  size: part_size(size, default_part_size, offset)
103
111
  )
104
- })
112
+ )
105
113
  part_number += 1
106
114
  offset += default_part_size
107
115
  end
@@ -122,12 +130,21 @@ module Aws
122
130
  end
123
131
  end
124
132
 
125
- def upload_in_threads(pending, completed)
133
+ def upload_in_threads(pending, completed, options)
126
134
  threads = []
135
+ if (callback = options[:progress_callback])
136
+ progress = MultipartProgress.new(pending, callback)
137
+ end
127
138
  @thread_count.times do
128
139
  thread = Thread.new do
129
140
  begin
130
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
131
148
  resp = @client.upload_part(part)
132
149
  part[:body].close
133
150
  completed.push(etag: resp.etag, part_number: part[:part_number])
@@ -177,11 +194,34 @@ module Aws
177
194
  @mutex.synchronize { @parts.clear }
178
195
  end
179
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
+
180
205
  def to_a
181
206
  @mutex.synchronize { @parts.dup }
182
207
  end
183
208
 
184
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
185
225
  end
186
226
  end
187
227
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'thread'
2
4
  require 'set'
3
5
  require 'tempfile'
@@ -60,12 +62,21 @@ module Aws
60
62
 
61
63
  def upload_parts(upload_id, options, &block)
62
64
  completed = Queue.new
63
- errors = IO.pipe do |read_pipe, write_pipe|
64
- threads = upload_in_threads(read_pipe, completed, upload_part_opts(options).merge(upload_id: upload_id))
65
- block.call(write_pipe)
66
- write_pipe.close
67
- threads.map(&:value).compact
65
+ errors = begin
66
+ IO.pipe do |read_pipe, write_pipe|
67
+ threads = upload_in_threads(read_pipe, completed, upload_part_opts(options).merge(upload_id: upload_id))
68
+ begin
69
+ block.call(write_pipe)
70
+ ensure
71
+ # Ensure the pipe is closed to avoid https://github.com/jruby/jruby/issues/6111
72
+ write_pipe.close
73
+ end
74
+ threads.map(&:value).compact
75
+ end
76
+ rescue => e
77
+ [e]
68
78
  end
79
+
69
80
  if errors.empty?
70
81
  Array.new(completed.size) { completed.pop }.sort_by { |part| part[:part_number] }
71
82
  else
@@ -104,7 +115,7 @@ module Aws
104
115
 
105
116
  def read_to_part_body(read_pipe)
106
117
  return if read_pipe.closed?
107
- temp_io = @tempfile ? Tempfile.new(TEMPFILE_PREIX) : StringIO.new
118
+ temp_io = @tempfile ? Tempfile.new(TEMPFILE_PREIX) : StringIO.new(String.new)
108
119
  temp_io.binmode
109
120
  bytes_copied = IO.copy_stream(read_pipe, temp_io, @part_size)
110
121
  temp_io.rewind
@@ -141,13 +152,15 @@ module Aws
141
152
  if Tempfile === body
142
153
  body.close
143
154
  body.unlink
155
+ elsif StringIO === body
156
+ body.string.clear
144
157
  end
145
158
  end
146
159
  end
147
160
  nil
148
161
  rescue => error
149
162
  # keep other threads from uploading other parts
150
- mutex.synchronize { read_pipe.close_read }
163
+ mutex.synchronize { read_pipe.close_read unless read_pipe.closed? }
151
164
  error
152
165
  end
153
166
  end
@@ -1,11 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # WARNING ABOUT GENERATED CODE
2
4
  #
3
5
  # This file is generated. See the contributing guide for more information:
4
- # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
5
7
  #
6
8
  # WARNING ABOUT GENERATED CODE
7
9
 
8
10
  module Aws::S3
11
+
9
12
  class MultipartUpload
10
13
 
11
14
  extend Aws::Deprecations
@@ -27,6 +30,7 @@ module Aws::S3
27
30
  @id = extract_id(args, options)
28
31
  @data = options.delete(:data)
29
32
  @client = options.delete(:client) || Client.new(options)
33
+ @waiter_block_warned = false
30
34
  end
31
35
 
32
36
  # @!group Read-Only Attributes
@@ -70,7 +74,8 @@ module Aws::S3
70
74
  data[:storage_class]
71
75
  end
72
76
 
73
-
77
+ # Specifies the owner of the object that is part of the multipart
78
+ # upload.
74
79
  # @return [Types::Owner]
75
80
  def owner
76
81
  data[:owner]
@@ -117,7 +122,8 @@ module Aws::S3
117
122
  # Waiter polls an API operation until a resource enters a desired
118
123
  # state.
119
124
  #
120
- # @note The waiting operation is performed on a copy. The original resource remains unchanged
125
+ # @note The waiting operation is performed on a copy. The original resource
126
+ # remains unchanged.
121
127
  #
122
128
  # ## Basic Usage
123
129
  #
@@ -130,13 +136,15 @@ module Aws::S3
130
136
  #
131
137
  # ## Example
132
138
  #
133
- # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
139
+ # instance.wait_until(max_attempts:10, delay:5) do |instance|
140
+ # instance.state.name == 'running'
141
+ # end
134
142
  #
135
143
  # ## Configuration
136
144
  #
137
145
  # You can configure the maximum number of polling attempts, and the
138
- # delay (in seconds) between each polling attempt. The waiting condition is set
139
- # by passing a block to {#wait_until}:
146
+ # delay (in seconds) between each polling attempt. The waiting condition is
147
+ # set by passing a block to {#wait_until}:
140
148
  #
141
149
  # # poll for ~25 seconds
142
150
  # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
@@ -167,17 +175,16 @@ module Aws::S3
167
175
  # # resource did not enter the desired state in time
168
176
  # end
169
177
  #
178
+ # @yieldparam [Resource] resource to be used in the waiting condition.
170
179
  #
171
- # @yield param [Resource] resource to be used in the waiting condition
172
- #
173
- # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
174
- # because the waiter has entered a state that it will not transition
175
- # out of, preventing success.
180
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter
181
+ # terminates because the waiter has entered a state that it will not
182
+ # transition out of, preventing success.
176
183
  #
177
184
  # yet successful.
178
185
  #
179
- # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encountered
180
- # while polling for a resource that is not expected.
186
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is
187
+ # encountered while polling for a resource that is not expected.
181
188
  #
182
189
  # @raise [NotImplementedError] Raised when the resource does not
183
190
  #
@@ -213,14 +220,23 @@ module Aws::S3
213
220
  #
214
221
  # multipart_upload.abort({
215
222
  # request_payer: "requester", # accepts requester
223
+ # expected_bucket_owner: "AccountId",
216
224
  # })
217
225
  # @param [Hash] options ({})
218
226
  # @option options [String] :request_payer
219
- # Confirms that the requester knows that she or he will be charged for
220
- # the request. Bucket owners need not specify this parameter in their
221
- # requests. Documentation on downloading objects from requester pays
222
- # buckets can be found at
223
- # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
227
+ # Confirms that the requester knows that they will be charged for the
228
+ # request. Bucket owners need not specify this parameter in their
229
+ # requests. For information about downloading objects from requester
230
+ # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
231
+ # in the *Amazon S3 User Guide*.
232
+ #
233
+ #
234
+ #
235
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
236
+ # @option options [String] :expected_bucket_owner
237
+ # The account ID of the expected bucket owner. If the bucket is owned by
238
+ # a different account, the request will fail with an HTTP `403 (Access
239
+ # Denied)` error.
224
240
  # @return [Types::AbortMultipartUploadOutput]
225
241
  def abort(options = {})
226
242
  options = options.merge(
@@ -244,15 +260,25 @@ module Aws::S3
244
260
  # ],
245
261
  # },
246
262
  # request_payer: "requester", # accepts requester
263
+ # expected_bucket_owner: "AccountId",
247
264
  # })
248
265
  # @param [Hash] options ({})
249
266
  # @option options [Types::CompletedMultipartUpload] :multipart_upload
267
+ # The container for the multipart upload request information.
250
268
  # @option options [String] :request_payer
251
- # Confirms that the requester knows that she or he will be charged for
252
- # the request. Bucket owners need not specify this parameter in their
253
- # requests. Documentation on downloading objects from requester pays
254
- # buckets can be found at
255
- # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
269
+ # Confirms that the requester knows that they will be charged for the
270
+ # request. Bucket owners need not specify this parameter in their
271
+ # requests. For information about downloading objects from requester
272
+ # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
273
+ # in the *Amazon S3 User Guide*.
274
+ #
275
+ #
276
+ #
277
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
278
+ # @option options [String] :expected_bucket_owner
279
+ # The account ID of the expected bucket owner. If the bucket is owned by
280
+ # a different account, the request will fail with an HTTP `403 (Access
281
+ # Denied)` error.
256
282
  # @return [Object]
257
283
  def complete(options = {})
258
284
  options = options.merge(
@@ -260,7 +286,7 @@ module Aws::S3
260
286
  key: @object_key,
261
287
  upload_id: @id
262
288
  )
263
- resp = @client.complete_multipart_upload(options)
289
+ @client.complete_multipart_upload(options)
264
290
  Object.new(
265
291
  bucket_name: @bucket_name,
266
292
  key: @object_key,
@@ -295,14 +321,23 @@ module Aws::S3
295
321
  #
296
322
  # parts = multipart_upload.parts({
297
323
  # request_payer: "requester", # accepts requester
324
+ # expected_bucket_owner: "AccountId",
298
325
  # })
299
326
  # @param [Hash] options ({})
300
327
  # @option options [String] :request_payer
301
- # Confirms that the requester knows that she or he will be charged for
302
- # the request. Bucket owners need not specify this parameter in their
303
- # requests. Documentation on downloading objects from requester pays
304
- # buckets can be found at
305
- # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
328
+ # Confirms that the requester knows that they will be charged for the
329
+ # request. Bucket owners need not specify this parameter in their
330
+ # requests. For information about downloading objects from requester
331
+ # pays buckets, see [Downloading Objects in Requestor Pays Buckets][1]
332
+ # in the *Amazon S3 User Guide*.
333
+ #
334
+ #
335
+ #
336
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
337
+ # @option options [String] :expected_bucket_owner
338
+ # The account ID of the expected bucket owner. If the bucket is owned by
339
+ # a different account, the request will fail with an HTTP `403 (Access
340
+ # Denied)` error.
306
341
  # @return [MultipartUploadPart::Collection]
307
342
  def parts(options = {})
308
343
  batches = Enumerator.new do |y|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Aws
2
4
  module S3
3
5
  class MultipartUploadError < StandardError