aws-sdk-s3 1.0.0.rc2 → 1.0.0.rc3

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