aws-sdk-s3 1.0.0.rc1

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 (69) hide show
  1. checksums.yaml +7 -0
  2. data/lib/aws-sdk-s3.rb +66 -0
  3. data/lib/aws-sdk-s3/bucket.rb +595 -0
  4. data/lib/aws-sdk-s3/bucket_acl.rb +168 -0
  5. data/lib/aws-sdk-s3/bucket_cors.rb +146 -0
  6. data/lib/aws-sdk-s3/bucket_lifecycle.rb +164 -0
  7. data/lib/aws-sdk-s3/bucket_logging.rb +142 -0
  8. data/lib/aws-sdk-s3/bucket_notification.rb +187 -0
  9. data/lib/aws-sdk-s3/bucket_policy.rb +138 -0
  10. data/lib/aws-sdk-s3/bucket_region_cache.rb +79 -0
  11. data/lib/aws-sdk-s3/bucket_request_payment.rb +128 -0
  12. data/lib/aws-sdk-s3/bucket_tagging.rb +143 -0
  13. data/lib/aws-sdk-s3/bucket_versioning.rb +188 -0
  14. data/lib/aws-sdk-s3/bucket_website.rb +177 -0
  15. data/lib/aws-sdk-s3/client.rb +3171 -0
  16. data/lib/aws-sdk-s3/client_api.rb +1991 -0
  17. data/lib/aws-sdk-s3/customizations.rb +29 -0
  18. data/lib/aws-sdk-s3/customizations/bucket.rb +127 -0
  19. data/lib/aws-sdk-s3/customizations/multipart_upload.rb +42 -0
  20. data/lib/aws-sdk-s3/customizations/object.rb +257 -0
  21. data/lib/aws-sdk-s3/customizations/object_summary.rb +65 -0
  22. data/lib/aws-sdk-s3/customizations/types/list_object_versions_output.rb +11 -0
  23. data/lib/aws-sdk-s3/encryption.rb +19 -0
  24. data/lib/aws-sdk-s3/encryption/client.rb +369 -0
  25. data/lib/aws-sdk-s3/encryption/decrypt_handler.rb +178 -0
  26. data/lib/aws-sdk-s3/encryption/default_cipher_provider.rb +63 -0
  27. data/lib/aws-sdk-s3/encryption/default_key_provider.rb +38 -0
  28. data/lib/aws-sdk-s3/encryption/encrypt_handler.rb +50 -0
  29. data/lib/aws-sdk-s3/encryption/errors.rb +13 -0
  30. data/lib/aws-sdk-s3/encryption/io_auth_decrypter.rb +50 -0
  31. data/lib/aws-sdk-s3/encryption/io_decrypter.rb +29 -0
  32. data/lib/aws-sdk-s3/encryption/io_encrypter.rb +69 -0
  33. data/lib/aws-sdk-s3/encryption/key_provider.rb +29 -0
  34. data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +71 -0
  35. data/lib/aws-sdk-s3/encryption/materials.rb +58 -0
  36. data/lib/aws-sdk-s3/encryption/utils.rb +79 -0
  37. data/lib/aws-sdk-s3/errors.rb +23 -0
  38. data/lib/aws-sdk-s3/file_part.rb +75 -0
  39. data/lib/aws-sdk-s3/file_uploader.rb +58 -0
  40. data/lib/aws-sdk-s3/legacy_signer.rb +186 -0
  41. data/lib/aws-sdk-s3/multipart_file_uploader.rb +187 -0
  42. data/lib/aws-sdk-s3/multipart_upload.rb +287 -0
  43. data/lib/aws-sdk-s3/multipart_upload_error.rb +16 -0
  44. data/lib/aws-sdk-s3/multipart_upload_part.rb +314 -0
  45. data/lib/aws-sdk-s3/object.rb +942 -0
  46. data/lib/aws-sdk-s3/object_acl.rb +214 -0
  47. data/lib/aws-sdk-s3/object_copier.rb +99 -0
  48. data/lib/aws-sdk-s3/object_multipart_copier.rb +179 -0
  49. data/lib/aws-sdk-s3/object_summary.rb +794 -0
  50. data/lib/aws-sdk-s3/object_version.rb +406 -0
  51. data/lib/aws-sdk-s3/plugins/accelerate.rb +92 -0
  52. data/lib/aws-sdk-s3/plugins/bucket_dns.rb +89 -0
  53. data/lib/aws-sdk-s3/plugins/bucket_name_restrictions.rb +23 -0
  54. data/lib/aws-sdk-s3/plugins/dualstack.rb +70 -0
  55. data/lib/aws-sdk-s3/plugins/expect_100_continue.rb +29 -0
  56. data/lib/aws-sdk-s3/plugins/get_bucket_location_fix.rb +23 -0
  57. data/lib/aws-sdk-s3/plugins/http_200_errors.rb +47 -0
  58. data/lib/aws-sdk-s3/plugins/location_constraint.rb +33 -0
  59. data/lib/aws-sdk-s3/plugins/md5s.rb +79 -0
  60. data/lib/aws-sdk-s3/plugins/redirects.rb +41 -0
  61. data/lib/aws-sdk-s3/plugins/s3_signer.rb +208 -0
  62. data/lib/aws-sdk-s3/plugins/sse_cpk.rb +68 -0
  63. data/lib/aws-sdk-s3/plugins/url_encoded_keys.rb +94 -0
  64. data/lib/aws-sdk-s3/presigned_post.rb +647 -0
  65. data/lib/aws-sdk-s3/presigner.rb +160 -0
  66. data/lib/aws-sdk-s3/resource.rb +96 -0
  67. data/lib/aws-sdk-s3/types.rb +5750 -0
  68. data/lib/aws-sdk-s3/waiters.rb +178 -0
  69. metadata +154 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 985a0a613949dc79ec819aa15c5b736abe964de9
4
+ data.tar.gz: 8cdcdd8a36a08c742088700471b92ebf74373d87
5
+ SHA512:
6
+ metadata.gz: d4cd193c076af2e7e878149ca1809058e2bd8309339c6d33cf35097ee509177f18c1a8e780281c8ca021afa72d66fc24935e21e8d59085940e0601d73c8be381
7
+ data.tar.gz: 4d85c28c3131be7d98b74bd4d50df966c0451ae43a5258830cb4a459d17d6b4c687b62538718e9ea8c0f652c595395344d110cde18e5925daaf6fd0624715e06
@@ -0,0 +1,66 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing for info on making contributions:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ require 'aws-sdk-core'
9
+ require 'aws-sdk-kms'
10
+ require 'aws-sigv4'
11
+
12
+ require_relative 'aws-sdk-s3/types'
13
+ require_relative 'aws-sdk-s3/client_api'
14
+ require_relative 'aws-sdk-s3/client'
15
+ require_relative 'aws-sdk-s3/errors'
16
+ require_relative 'aws-sdk-s3/waiters'
17
+ require_relative 'aws-sdk-s3/resource'
18
+ require_relative 'aws-sdk-s3/bucket'
19
+ require_relative 'aws-sdk-s3/bucket_acl'
20
+ require_relative 'aws-sdk-s3/bucket_cors'
21
+ require_relative 'aws-sdk-s3/bucket_lifecycle'
22
+ require_relative 'aws-sdk-s3/bucket_logging'
23
+ require_relative 'aws-sdk-s3/bucket_notification'
24
+ require_relative 'aws-sdk-s3/bucket_policy'
25
+ require_relative 'aws-sdk-s3/bucket_request_payment'
26
+ require_relative 'aws-sdk-s3/bucket_tagging'
27
+ require_relative 'aws-sdk-s3/bucket_versioning'
28
+ require_relative 'aws-sdk-s3/bucket_website'
29
+ require_relative 'aws-sdk-s3/multipart_upload'
30
+ require_relative 'aws-sdk-s3/multipart_upload_part'
31
+ require_relative 'aws-sdk-s3/object'
32
+ require_relative 'aws-sdk-s3/object_acl'
33
+ require_relative 'aws-sdk-s3/object_summary'
34
+ require_relative 'aws-sdk-s3/object_version'
35
+ require_relative 'aws-sdk-s3/customizations'
36
+
37
+ # This module provides support for Amazon Simple Storage Service. This module is available in the
38
+ # `aws-sdk-s3` gem.
39
+ #
40
+ # # Client
41
+ #
42
+ # The {Client} class provides one method for each API operation. Operation
43
+ # methods each accept a hash of request parameters and return a response
44
+ # structure.
45
+ #
46
+ # See {Client} for more information.
47
+ #
48
+ # # Errors
49
+ #
50
+ # Errors returned from Amazon Simple Storage Service all
51
+ # extend {Errors::ServiceError}.
52
+ #
53
+ # begin
54
+ # # do stuff
55
+ # rescue Aws::S3::Errors::ServiceError
56
+ # # rescues all service API errors
57
+ # end
58
+ #
59
+ # See {Errors} for more information.
60
+ #
61
+ # @service
62
+ module Aws::S3
63
+
64
+ GEM_VERSION = '1.0.0.rc1'
65
+
66
+ end
@@ -0,0 +1,595 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing for info on making contributions:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ module Aws
9
+ module S3
10
+ class Bucket
11
+
12
+ extend Aws::Deprecations
13
+
14
+ # @overload def initialize(name, options = {})
15
+ # @param [String] name
16
+ # @option options [Client] :client
17
+ # @overload def initialize(options = {})
18
+ # @option options [required, String] :name
19
+ # @option options [Client] :client
20
+ def initialize(*args)
21
+ options = Hash === args.last ? args.pop.dup : {}
22
+ @name = extract_name(args, options)
23
+ @data = options.delete(:data)
24
+ @client = options.delete(:client) || Client.new(options)
25
+ end
26
+
27
+ # @!group Read-Only Attributes
28
+
29
+ # @return [String]
30
+ def name
31
+ @name
32
+ end
33
+
34
+ # Date the bucket was created.
35
+ # @return [Time]
36
+ def creation_date
37
+ data.creation_date
38
+ end
39
+
40
+ # @!endgroup
41
+
42
+ # @return [Client]
43
+ def client
44
+ @client
45
+ end
46
+
47
+ # @raise [Errors::ResourceNotLoadable]
48
+ # @api private
49
+ def load
50
+ msg = "#load is not implemented, data only available via enumeration"
51
+ raise Errors::ResourceNotLoadable, msg
52
+ end
53
+ alias :reload :load
54
+
55
+ # @raise [Errors::ResourceNotLoadableError] Raises when {#data_loaded?} is `false`.
56
+ # @return [Types::Bucket]
57
+ # Returns the data for this {Bucket}.
58
+ def data
59
+ load unless @data
60
+ @data
61
+ end
62
+
63
+ # @return [Boolean]
64
+ # Returns `true` if this resource is loaded. Accessing attributes or
65
+ # {#data} on an unloaded resource will trigger a call to {#load}.
66
+ def data_loaded?
67
+ !!@data
68
+ end
69
+
70
+ # @param [Hash] options ({})
71
+ # @return [Boolean]
72
+ # Returns `true` if the Bucket exists.
73
+ def exists?(options = {})
74
+ begin
75
+ wait_until_exists(options.merge(max_attempts: 1))
76
+ true
77
+ rescue Aws::Waiters::Errors::UnexpectedError => e
78
+ raise e.error
79
+ rescue Aws::Waiters::Errors::WaiterFailed
80
+ false
81
+ end
82
+ end
83
+
84
+ # @param [Hash] options ({})
85
+ # @option options [Integer] :max_attempts (20)
86
+ # @option options [Float] :delay (5)
87
+ # @option options [Proc] :before_attempt
88
+ # @option options [Proc] :before_wait
89
+ # @return [Bucket]
90
+ def wait_until_exists(options = {})
91
+ options, params = separate_params_and_options(options)
92
+ waiter = Waiters::BucketExists.new(options)
93
+ yield_waiter_and_warn(waiter, &Proc.new) if block_given?
94
+ waiter.wait(params.merge(bucket: @name))
95
+ Bucket.new({
96
+ name: @name,
97
+ client: @client
98
+ })
99
+ end
100
+
101
+ # @param [Hash] options ({})
102
+ # @option options [Integer] :max_attempts (20)
103
+ # @option options [Float] :delay (5)
104
+ # @option options [Proc] :before_attempt
105
+ # @option options [Proc] :before_wait
106
+ # @return [Bucket]
107
+ def wait_until_not_exists(options = {})
108
+ options, params = separate_params_and_options(options)
109
+ waiter = Waiters::BucketNotExists.new(options)
110
+ yield_waiter_and_warn(waiter, &Proc.new) if block_given?
111
+ waiter.wait(params.merge(bucket: @name))
112
+ Bucket.new({
113
+ name: @name,
114
+ client: @client
115
+ })
116
+ end
117
+
118
+ # @!group Actions
119
+
120
+ # @example Request syntax with placeholder values
121
+ #
122
+ # bucket.create({
123
+ # acl: "private", # accepts private, public-read, public-read-write, authenticated-read
124
+ # create_bucket_configuration: {
125
+ # 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
126
+ # },
127
+ # grant_full_control: "GrantFullControl",
128
+ # grant_read: "GrantRead",
129
+ # grant_read_acp: "GrantReadACP",
130
+ # grant_write: "GrantWrite",
131
+ # grant_write_acp: "GrantWriteACP",
132
+ # })
133
+ # @param [Hash] options ({})
134
+ # @option options [String] :acl
135
+ # The canned ACL to apply to the bucket.
136
+ # @option options [Types::CreateBucketConfiguration] :create_bucket_configuration
137
+ # @option options [String] :grant_full_control
138
+ # Allows grantee the read, write, read ACP, and write ACP permissions on
139
+ # the bucket.
140
+ # @option options [String] :grant_read
141
+ # Allows grantee to list the objects in the bucket.
142
+ # @option options [String] :grant_read_acp
143
+ # Allows grantee to read the bucket ACL.
144
+ # @option options [String] :grant_write
145
+ # Allows grantee to create, overwrite, and delete any object in the
146
+ # bucket.
147
+ # @option options [String] :grant_write_acp
148
+ # Allows grantee to write the ACL for the applicable bucket.
149
+ # @return [Types::CreateBucketOutput]
150
+ def create(options = {})
151
+ options = options.merge(bucket: @name)
152
+ resp = @client.create_bucket(options)
153
+ resp.data
154
+ end
155
+
156
+ # @example Request syntax with placeholder values
157
+ #
158
+ # bucket.delete()
159
+ # @param [Hash] options ({})
160
+ # @return [EmptyStructure]
161
+ def delete(options = {})
162
+ options = options.merge(bucket: @name)
163
+ resp = @client.delete_bucket(options)
164
+ resp.data
165
+ end
166
+
167
+ # @example Request syntax with placeholder values
168
+ #
169
+ # bucket.delete_objects({
170
+ # delete: { # required
171
+ # objects: [ # required
172
+ # {
173
+ # key: "ObjectKey", # required
174
+ # version_id: "ObjectVersionId",
175
+ # },
176
+ # ],
177
+ # quiet: false,
178
+ # },
179
+ # mfa: "MFA",
180
+ # request_payer: "requester", # accepts requester
181
+ # })
182
+ # @param [Hash] options ({})
183
+ # @option options [required, Types::Delete] :delete
184
+ # @option options [String] :mfa
185
+ # The concatenation of the authentication device's serial number, a
186
+ # space, and the value that is displayed on your authentication device.
187
+ # @option options [String] :request_payer
188
+ # Confirms that the requester knows that she or he will be charged for
189
+ # the request. Bucket owners need not specify this parameter in their
190
+ # requests. Documentation on downloading objects from requester pays
191
+ # buckets can be found at
192
+ # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
193
+ # @return [Types::DeleteObjectsOutput]
194
+ def delete_objects(options = {})
195
+ options = options.merge(bucket: @name)
196
+ resp = @client.delete_objects(options)
197
+ resp.data
198
+ end
199
+
200
+ # @example Request syntax with placeholder values
201
+ #
202
+ # object = bucket.put_object({
203
+ # acl: "private", # accepts private, public-read, public-read-write, authenticated-read, aws-exec-read, bucket-owner-read, bucket-owner-full-control
204
+ # body: source_file,
205
+ # cache_control: "CacheControl",
206
+ # content_disposition: "ContentDisposition",
207
+ # content_encoding: "ContentEncoding",
208
+ # content_language: "ContentLanguage",
209
+ # content_length: 1,
210
+ # content_md5: "ContentMD5",
211
+ # content_type: "ContentType",
212
+ # expires: Time.now,
213
+ # grant_full_control: "GrantFullControl",
214
+ # grant_read: "GrantRead",
215
+ # grant_read_acp: "GrantReadACP",
216
+ # grant_write_acp: "GrantWriteACP",
217
+ # key: "ObjectKey", # required
218
+ # metadata: {
219
+ # "MetadataKey" => "MetadataValue",
220
+ # },
221
+ # server_side_encryption: "AES256", # accepts AES256, aws:kms
222
+ # storage_class: "STANDARD", # accepts STANDARD, REDUCED_REDUNDANCY, STANDARD_IA
223
+ # website_redirect_location: "WebsiteRedirectLocation",
224
+ # sse_customer_algorithm: "SSECustomerAlgorithm",
225
+ # sse_customer_key: "SSECustomerKey",
226
+ # sse_customer_key_md5: "SSECustomerKeyMD5",
227
+ # ssekms_key_id: "SSEKMSKeyId",
228
+ # request_payer: "requester", # accepts requester
229
+ # })
230
+ # @param [Hash] options ({})
231
+ # @option options [String] :acl
232
+ # The canned ACL to apply to the object.
233
+ # @option options [String, IO] :body
234
+ # Object data.
235
+ # @option options [String] :cache_control
236
+ # Specifies caching behavior along the request/reply chain.
237
+ # @option options [String] :content_disposition
238
+ # Specifies presentational information for the object.
239
+ # @option options [String] :content_encoding
240
+ # Specifies what content encodings have been applied to the object and
241
+ # thus what decoding mechanisms must be applied to obtain the media-type
242
+ # referenced by the Content-Type header field.
243
+ # @option options [String] :content_language
244
+ # The language the content is in.
245
+ # @option options [Integer] :content_length
246
+ # Size of the body in bytes. This parameter is useful when the size of
247
+ # the body cannot be determined automatically.
248
+ # @option options [String] :content_md5
249
+ # The base64-encoded 128-bit MD5 digest of the part data.
250
+ # @option options [String] :content_type
251
+ # A standard MIME type describing the format of the object data.
252
+ # @option options [Time,DateTime,Date,Integer,String] :expires
253
+ # The date and time at which the object is no longer cacheable.
254
+ # @option options [String] :grant_full_control
255
+ # Gives the grantee READ, READ\_ACP, and WRITE\_ACP permissions on the
256
+ # object.
257
+ # @option options [String] :grant_read
258
+ # Allows grantee to read the object data and its metadata.
259
+ # @option options [String] :grant_read_acp
260
+ # Allows grantee to read the object ACL.
261
+ # @option options [String] :grant_write_acp
262
+ # Allows grantee to write the ACL for the applicable object.
263
+ # @option options [required, String] :key
264
+ # Object key for which the PUT operation was initiated.
265
+ # @option options [Hash<String,String>] :metadata
266
+ # A map of metadata to store with the object in S3.
267
+ # @option options [String] :server_side_encryption
268
+ # The Server-side encryption algorithm used when storing this object in
269
+ # S3 (e.g., AES256, aws:kms).
270
+ # @option options [String] :storage_class
271
+ # The type of storage to use for the object. Defaults to 'STANDARD'.
272
+ # @option options [String] :website_redirect_location
273
+ # If the bucket is configured as a website, redirects requests for this
274
+ # object to another object in the same bucket or to an external URL.
275
+ # Amazon S3 stores the value of this header in the object metadata.
276
+ # @option options [String] :sse_customer_algorithm
277
+ # Specifies the algorithm to use to when encrypting the object (e.g.,
278
+ # AES256).
279
+ # @option options [String] :sse_customer_key
280
+ # Specifies the customer-provided encryption key for Amazon S3 to use in
281
+ # encrypting data. This value is used to store the object and then it is
282
+ # discarded; Amazon does not store the encryption key. The key must be
283
+ # appropriate for use with the algorithm specified in the
284
+ # x-amz-server-side​-encryption​-customer-algorithm header.
285
+ # @option options [String] :sse_customer_key_md5
286
+ # Specifies the 128-bit MD5 digest of the encryption key according to
287
+ # RFC 1321. Amazon S3 uses this header for a message integrity check to
288
+ # ensure the encryption key was transmitted without error.
289
+ # @option options [String] :ssekms_key_id
290
+ # Specifies the AWS KMS key ID to use for object encryption. All GET and
291
+ # PUT requests for an object protected by AWS KMS will fail if not made
292
+ # via SSL or using SigV4. Documentation on configuring any of the
293
+ # officially supported AWS SDKs and CLI can be found at
294
+ # http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version
295
+ # @option options [String] :request_payer
296
+ # Confirms that the requester knows that she or he will be charged for
297
+ # the request. Bucket owners need not specify this parameter in their
298
+ # requests. Documentation on downloading objects from requester pays
299
+ # buckets can be found at
300
+ # http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
301
+ # @return [Object]
302
+ def put_object(options = {})
303
+ options = options.merge(bucket: @name)
304
+ resp = @client.put_object(options)
305
+ Object.new(
306
+ bucket_name: @name,
307
+ key: options[:key],
308
+ client: @client
309
+ )
310
+ end
311
+
312
+ # @!group Associations
313
+
314
+ # @return [BucketAcl]
315
+ def acl
316
+ BucketAcl.new(
317
+ bucket_name: @name,
318
+ client: @client
319
+ )
320
+ end
321
+
322
+ # @return [BucketCors]
323
+ def cors
324
+ BucketCors.new(
325
+ bucket_name: @name,
326
+ client: @client
327
+ )
328
+ end
329
+
330
+ # @return [BucketLifecycle]
331
+ def lifecycle
332
+ BucketLifecycle.new(
333
+ bucket_name: @name,
334
+ client: @client
335
+ )
336
+ end
337
+
338
+ # @return [BucketLogging]
339
+ def logging
340
+ BucketLogging.new(
341
+ bucket_name: @name,
342
+ client: @client
343
+ )
344
+ end
345
+
346
+ # @example Request syntax with placeholder values
347
+ #
348
+ # multipartuploads = bucket.multipart_uploads({
349
+ # delimiter: "Delimiter",
350
+ # encoding_type: "url", # accepts url
351
+ # key_marker: "KeyMarker",
352
+ # prefix: "Prefix",
353
+ # upload_id_marker: "UploadIdMarker",
354
+ # })
355
+ # @param [Hash] options ({})
356
+ # @option options [String] :delimiter
357
+ # Character you use to group keys.
358
+ # @option options [String] :encoding_type
359
+ # Requests Amazon S3 to encode the object keys in the response and
360
+ # specifies the encoding method to use. An object key may contain any
361
+ # Unicode character; however, XML 1.0 parser cannot parse some
362
+ # characters, such as characters with an ASCII value from 0 to 10. For
363
+ # characters that are not supported in XML 1.0, you can add this
364
+ # parameter to request that Amazon S3 encode the keys in the response.
365
+ # @option options [String] :key_marker
366
+ # Together with upload-id-marker, this parameter specifies the multipart
367
+ # upload after which listing should begin.
368
+ # @option options [String] :prefix
369
+ # Lists in-progress uploads only for those keys that begin with the
370
+ # specified prefix.
371
+ # @option options [String] :upload_id_marker
372
+ # Together with key-marker, specifies the multipart upload after which
373
+ # listing should begin. If key-marker is not specified, the
374
+ # upload-id-marker parameter is ignored.
375
+ # @return [MultipartUpload::Collection]
376
+ def multipart_uploads(options = {})
377
+ batches = Enumerator.new do |y|
378
+ options = options.merge(bucket: @name)
379
+ resp = @client.list_multipart_uploads(options)
380
+ resp.each_page do |page|
381
+ batch = []
382
+ page.data.uploads.each do |u|
383
+ batch << MultipartUpload.new(
384
+ bucket_name: @name,
385
+ object_key: u.key,
386
+ id: u.upload_id,
387
+ data: u,
388
+ client: @client
389
+ )
390
+ end
391
+ y.yield(batch)
392
+ end
393
+ end
394
+ MultipartUpload::Collection.new(batches)
395
+ end
396
+
397
+ # @return [BucketNotification]
398
+ def notification
399
+ BucketNotification.new(
400
+ bucket_name: @name,
401
+ client: @client
402
+ )
403
+ end
404
+
405
+ # @param [String] key
406
+ # @return [Object]
407
+ def object(key)
408
+ Object.new(
409
+ bucket_name: @name,
410
+ key: key,
411
+ client: @client
412
+ )
413
+ end
414
+
415
+ # @example Request syntax with placeholder values
416
+ #
417
+ # objectversions = bucket.object_versions({
418
+ # delimiter: "Delimiter",
419
+ # encoding_type: "url", # accepts url
420
+ # key_marker: "KeyMarker",
421
+ # prefix: "Prefix",
422
+ # version_id_marker: "VersionIdMarker",
423
+ # })
424
+ # @param [Hash] options ({})
425
+ # @option options [String] :delimiter
426
+ # A delimiter is a character you use to group keys.
427
+ # @option options [String] :encoding_type
428
+ # Requests Amazon S3 to encode the object keys in the response and
429
+ # specifies the encoding method to use. An object key may contain any
430
+ # Unicode character; however, XML 1.0 parser cannot parse some
431
+ # characters, such as characters with an ASCII value from 0 to 10. For
432
+ # characters that are not supported in XML 1.0, you can add this
433
+ # parameter to request that Amazon S3 encode the keys in the response.
434
+ # @option options [String] :key_marker
435
+ # Specifies the key to start with when listing objects in a bucket.
436
+ # @option options [String] :prefix
437
+ # Limits the response to keys that begin with the specified prefix.
438
+ # @option options [String] :version_id_marker
439
+ # Specifies the object version you want to start listing from.
440
+ # @return [ObjectVersion::Collection]
441
+ def object_versions(options = {})
442
+ batches = Enumerator.new do |y|
443
+ options = options.merge(bucket: @name)
444
+ resp = @client.list_object_versions(options)
445
+ resp.each_page do |page|
446
+ batch = []
447
+ page.data.versions_delete_markers.each do |v|
448
+ batch << ObjectVersion.new(
449
+ bucket_name: @name,
450
+ object_key: v.key,
451
+ id: v.version_id,
452
+ data: v,
453
+ client: @client
454
+ )
455
+ end
456
+ y.yield(batch)
457
+ end
458
+ end
459
+ ObjectVersion::Collection.new(batches)
460
+ end
461
+
462
+ # @example Request syntax with placeholder values
463
+ #
464
+ # objects = bucket.objects({
465
+ # delimiter: "Delimiter",
466
+ # encoding_type: "url", # accepts url
467
+ # prefix: "Prefix",
468
+ # request_payer: "requester", # accepts requester
469
+ # })
470
+ # @param [Hash] options ({})
471
+ # @option options [String] :delimiter
472
+ # A delimiter is a character you use to group keys.
473
+ # @option options [String] :encoding_type
474
+ # Requests Amazon S3 to encode the object keys in the response and
475
+ # specifies the encoding method to use. An object key may contain any
476
+ # Unicode character; however, XML 1.0 parser cannot parse some
477
+ # characters, such as characters with an ASCII value from 0 to 10. For
478
+ # characters that are not supported in XML 1.0, you can add this
479
+ # parameter to request that Amazon S3 encode the keys in the response.
480
+ # @option options [String] :prefix
481
+ # Limits the response to keys that begin with the specified prefix.
482
+ # @option options [String] :request_payer
483
+ # Confirms that the requester knows that she or he will be charged for
484
+ # the list objects request. Bucket owners need not specify this
485
+ # parameter in their requests.
486
+ # @return [ObjectSummary::Collection]
487
+ def objects(options = {})
488
+ batches = Enumerator.new do |y|
489
+ options = options.merge(bucket: @name)
490
+ resp = @client.list_objects(options)
491
+ resp.each_page do |page|
492
+ batch = []
493
+ page.data.contents.each do |c|
494
+ batch << ObjectSummary.new(
495
+ bucket_name: @name,
496
+ key: c.key,
497
+ data: c,
498
+ client: @client
499
+ )
500
+ end
501
+ y.yield(batch)
502
+ end
503
+ end
504
+ ObjectSummary::Collection.new(batches)
505
+ end
506
+
507
+ # @return [BucketPolicy]
508
+ def policy
509
+ BucketPolicy.new(
510
+ bucket_name: @name,
511
+ client: @client
512
+ )
513
+ end
514
+
515
+ # @return [BucketRequestPayment]
516
+ def request_payment
517
+ BucketRequestPayment.new(
518
+ bucket_name: @name,
519
+ client: @client
520
+ )
521
+ end
522
+
523
+ # @return [BucketTagging]
524
+ def tagging
525
+ BucketTagging.new(
526
+ bucket_name: @name,
527
+ client: @client
528
+ )
529
+ end
530
+
531
+ # @return [BucketVersioning]
532
+ def versioning
533
+ BucketVersioning.new(
534
+ bucket_name: @name,
535
+ client: @client
536
+ )
537
+ end
538
+
539
+ # @return [BucketWebsite]
540
+ def website
541
+ BucketWebsite.new(
542
+ bucket_name: @name,
543
+ client: @client
544
+ )
545
+ end
546
+
547
+ # @deprecated
548
+ # @api private
549
+ def identifiers
550
+ { name: @name }
551
+ end
552
+ deprecated(:identifiers)
553
+
554
+ private
555
+
556
+ def extract_name(args, options)
557
+ value = args[0] || options.delete(:name)
558
+ case value
559
+ when String then value
560
+ when nil then raise ArgumentError, "missing required option :name"
561
+ else
562
+ msg = "expected :name to be a String, got #{value.class}"
563
+ raise ArgumentError, msg
564
+ end
565
+ end
566
+
567
+ def yield_waiter_and_warn(waiter, &block)
568
+ if !@waiter_block_warned
569
+ msg = "pass options to configure the waiter; "
570
+ msg << "yielding the waiter is deprecated"
571
+ warn(msg)
572
+ @waiter_block_warned = true
573
+ end
574
+ yield(waiter.waiter)
575
+ end
576
+
577
+ def separate_params_and_options(options)
578
+ opts = Set.new([:client, :max_attempts, :delay, :before_attempt, :before_wait])
579
+ waiter_opts = {}
580
+ waiter_params = {}
581
+ options.each_pair do |key, value|
582
+ if opts.include?(key)
583
+ waiter_opts[key] = value
584
+ else
585
+ waiter_params[key] = value
586
+ end
587
+ end
588
+ waiter_opts[:client] ||= @client
589
+ [waiter_opts, waiter_params]
590
+ end
591
+
592
+ class Collection < Aws::Resources::Collection; end
593
+ end
594
+ end
595
+ end