aws-sdk-s3 1.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. checksums.yaml +7 -0
  2. data/lib/aws-sdk-s3.rb +73 -0
  3. data/lib/aws-sdk-s3/bucket.rb +861 -0
  4. data/lib/aws-sdk-s3/bucket_acl.rb +277 -0
  5. data/lib/aws-sdk-s3/bucket_cors.rb +262 -0
  6. data/lib/aws-sdk-s3/bucket_lifecycle.rb +264 -0
  7. data/lib/aws-sdk-s3/bucket_lifecycle_configuration.rb +283 -0
  8. data/lib/aws-sdk-s3/bucket_logging.rb +251 -0
  9. data/lib/aws-sdk-s3/bucket_notification.rb +293 -0
  10. data/lib/aws-sdk-s3/bucket_policy.rb +242 -0
  11. data/lib/aws-sdk-s3/bucket_region_cache.rb +81 -0
  12. data/lib/aws-sdk-s3/bucket_request_payment.rb +236 -0
  13. data/lib/aws-sdk-s3/bucket_tagging.rb +251 -0
  14. data/lib/aws-sdk-s3/bucket_versioning.rb +312 -0
  15. data/lib/aws-sdk-s3/bucket_website.rb +292 -0
  16. data/lib/aws-sdk-s3/client.rb +11818 -0
  17. data/lib/aws-sdk-s3/client_api.rb +3014 -0
  18. data/lib/aws-sdk-s3/customizations.rb +34 -0
  19. data/lib/aws-sdk-s3/customizations/bucket.rb +162 -0
  20. data/lib/aws-sdk-s3/customizations/multipart_upload.rb +44 -0
  21. data/lib/aws-sdk-s3/customizations/object.rb +389 -0
  22. data/lib/aws-sdk-s3/customizations/object_summary.rb +85 -0
  23. data/lib/aws-sdk-s3/customizations/types/list_object_versions_output.rb +13 -0
  24. data/lib/aws-sdk-s3/encryption.rb +21 -0
  25. data/lib/aws-sdk-s3/encryption/client.rb +375 -0
  26. data/lib/aws-sdk-s3/encryption/decrypt_handler.rb +190 -0
  27. data/lib/aws-sdk-s3/encryption/default_cipher_provider.rb +65 -0
  28. data/lib/aws-sdk-s3/encryption/default_key_provider.rb +40 -0
  29. data/lib/aws-sdk-s3/encryption/encrypt_handler.rb +61 -0
  30. data/lib/aws-sdk-s3/encryption/errors.rb +15 -0
  31. data/lib/aws-sdk-s3/encryption/io_auth_decrypter.rb +58 -0
  32. data/lib/aws-sdk-s3/encryption/io_decrypter.rb +36 -0
  33. data/lib/aws-sdk-s3/encryption/io_encrypter.rb +71 -0
  34. data/lib/aws-sdk-s3/encryption/key_provider.rb +31 -0
  35. data/lib/aws-sdk-s3/encryption/kms_cipher_provider.rb +75 -0
  36. data/lib/aws-sdk-s3/encryption/materials.rb +60 -0
  37. data/lib/aws-sdk-s3/encryption/utils.rb +81 -0
  38. data/lib/aws-sdk-s3/encryptionV2/client.rb +388 -0
  39. data/lib/aws-sdk-s3/encryptionV2/decrypt_handler.rb +198 -0
  40. data/lib/aws-sdk-s3/encryptionV2/default_cipher_provider.rb +103 -0
  41. data/lib/aws-sdk-s3/encryptionV2/default_key_provider.rb +38 -0
  42. data/lib/aws-sdk-s3/encryptionV2/encrypt_handler.rb +66 -0
  43. data/lib/aws-sdk-s3/encryptionV2/errors.rb +13 -0
  44. data/lib/aws-sdk-s3/encryptionV2/io_auth_decrypter.rb +56 -0
  45. data/lib/aws-sdk-s3/encryptionV2/io_decrypter.rb +35 -0
  46. data/lib/aws-sdk-s3/encryptionV2/io_encrypter.rb +71 -0
  47. data/lib/aws-sdk-s3/encryptionV2/key_provider.rb +29 -0
  48. data/lib/aws-sdk-s3/encryptionV2/kms_cipher_provider.rb +99 -0
  49. data/lib/aws-sdk-s3/encryptionV2/materials.rb +58 -0
  50. data/lib/aws-sdk-s3/encryptionV2/utils.rb +116 -0
  51. data/lib/aws-sdk-s3/encryption_v2.rb +20 -0
  52. data/lib/aws-sdk-s3/errors.rb +115 -0
  53. data/lib/aws-sdk-s3/event_streams.rb +69 -0
  54. data/lib/aws-sdk-s3/file_downloader.rb +142 -0
  55. data/lib/aws-sdk-s3/file_part.rb +78 -0
  56. data/lib/aws-sdk-s3/file_uploader.rb +70 -0
  57. data/lib/aws-sdk-s3/legacy_signer.rb +189 -0
  58. data/lib/aws-sdk-s3/multipart_file_uploader.rb +227 -0
  59. data/lib/aws-sdk-s3/multipart_stream_uploader.rb +173 -0
  60. data/lib/aws-sdk-s3/multipart_upload.rb +401 -0
  61. data/lib/aws-sdk-s3/multipart_upload_error.rb +18 -0
  62. data/lib/aws-sdk-s3/multipart_upload_part.rb +423 -0
  63. data/lib/aws-sdk-s3/object.rb +1422 -0
  64. data/lib/aws-sdk-s3/object_acl.rb +333 -0
  65. data/lib/aws-sdk-s3/object_copier.rb +101 -0
  66. data/lib/aws-sdk-s3/object_multipart_copier.rb +182 -0
  67. data/lib/aws-sdk-s3/object_summary.rb +1181 -0
  68. data/lib/aws-sdk-s3/object_version.rb +550 -0
  69. data/lib/aws-sdk-s3/plugins/accelerate.rb +87 -0
  70. data/lib/aws-sdk-s3/plugins/bucket_arn.rb +212 -0
  71. data/lib/aws-sdk-s3/plugins/bucket_dns.rb +91 -0
  72. data/lib/aws-sdk-s3/plugins/bucket_name_restrictions.rb +45 -0
  73. data/lib/aws-sdk-s3/plugins/dualstack.rb +74 -0
  74. data/lib/aws-sdk-s3/plugins/expect_100_continue.rb +28 -0
  75. data/lib/aws-sdk-s3/plugins/get_bucket_location_fix.rb +25 -0
  76. data/lib/aws-sdk-s3/plugins/http_200_errors.rb +55 -0
  77. data/lib/aws-sdk-s3/plugins/iad_regional_endpoint.rb +62 -0
  78. data/lib/aws-sdk-s3/plugins/location_constraint.rb +35 -0
  79. data/lib/aws-sdk-s3/plugins/md5s.rb +84 -0
  80. data/lib/aws-sdk-s3/plugins/redirects.rb +45 -0
  81. data/lib/aws-sdk-s3/plugins/s3_host_id.rb +30 -0
  82. data/lib/aws-sdk-s3/plugins/s3_signer.rb +222 -0
  83. data/lib/aws-sdk-s3/plugins/sse_cpk.rb +70 -0
  84. data/lib/aws-sdk-s3/plugins/streaming_retry.rb +118 -0
  85. data/lib/aws-sdk-s3/plugins/url_encoded_keys.rb +97 -0
  86. data/lib/aws-sdk-s3/presigned_post.rb +686 -0
  87. data/lib/aws-sdk-s3/presigner.rb +253 -0
  88. data/lib/aws-sdk-s3/resource.rb +117 -0
  89. data/lib/aws-sdk-s3/types.rb +13154 -0
  90. data/lib/aws-sdk-s3/waiters.rb +243 -0
  91. metadata +184 -0
@@ -0,0 +1,277 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::S3
11
+
12
+ class BucketAcl
13
+
14
+ extend Aws::Deprecations
15
+
16
+ # @overload def initialize(bucket_name, options = {})
17
+ # @param [String] bucket_name
18
+ # @option options [Client] :client
19
+ # @overload def initialize(options = {})
20
+ # @option options [required, String] :bucket_name
21
+ # @option options [Client] :client
22
+ def initialize(*args)
23
+ options = Hash === args.last ? args.pop.dup : {}
24
+ @bucket_name = extract_bucket_name(args, options)
25
+ @data = options.delete(:data)
26
+ @client = options.delete(:client) || Client.new(options)
27
+ @waiter_block_warned = false
28
+ end
29
+
30
+ # @!group Read-Only Attributes
31
+
32
+ # @return [String]
33
+ def bucket_name
34
+ @bucket_name
35
+ end
36
+
37
+ # Container for the bucket owner's display name and ID.
38
+ # @return [Types::Owner]
39
+ def owner
40
+ data[:owner]
41
+ end
42
+
43
+ # A list of grants.
44
+ # @return [Array<Types::Grant>]
45
+ def grants
46
+ data[:grants]
47
+ end
48
+
49
+ # @!endgroup
50
+
51
+ # @return [Client]
52
+ def client
53
+ @client
54
+ end
55
+
56
+ # Loads, or reloads {#data} for the current {BucketAcl}.
57
+ # Returns `self` making it possible to chain methods.
58
+ #
59
+ # bucket_acl.reload.data
60
+ #
61
+ # @return [self]
62
+ def load
63
+ resp = @client.get_bucket_acl(bucket: @bucket_name)
64
+ @data = resp.data
65
+ self
66
+ end
67
+ alias :reload :load
68
+
69
+ # @return [Types::GetBucketAclOutput]
70
+ # Returns the data for this {BucketAcl}. Calls
71
+ # {Client#get_bucket_acl} if {#data_loaded?} is `false`.
72
+ def data
73
+ load unless @data
74
+ @data
75
+ end
76
+
77
+ # @return [Boolean]
78
+ # Returns `true` if this resource is loaded. Accessing attributes or
79
+ # {#data} on an unloaded resource will trigger a call to {#load}.
80
+ def data_loaded?
81
+ !!@data
82
+ end
83
+
84
+ # @deprecated Use [Aws::S3::Client] #wait_until instead
85
+ #
86
+ # Waiter polls an API operation until a resource enters a desired
87
+ # state.
88
+ #
89
+ # @note The waiting operation is performed on a copy. The original resource
90
+ # remains unchanged.
91
+ #
92
+ # ## Basic Usage
93
+ #
94
+ # Waiter will polls until it is successful, it fails by
95
+ # entering a terminal state, or until a maximum number of attempts
96
+ # are made.
97
+ #
98
+ # # polls in a loop until condition is true
99
+ # resource.wait_until(options) {|resource| condition}
100
+ #
101
+ # ## Example
102
+ #
103
+ # instance.wait_until(max_attempts:10, delay:5) do |instance|
104
+ # instance.state.name == 'running'
105
+ # end
106
+ #
107
+ # ## Configuration
108
+ #
109
+ # You can configure the maximum number of polling attempts, and the
110
+ # delay (in seconds) between each polling attempt. The waiting condition is
111
+ # set by passing a block to {#wait_until}:
112
+ #
113
+ # # poll for ~25 seconds
114
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
115
+ #
116
+ # ## Callbacks
117
+ #
118
+ # You can be notified before each polling attempt and before each
119
+ # delay. If you throw `:success` or `:failure` from these callbacks,
120
+ # it will terminate the waiter.
121
+ #
122
+ # started_at = Time.now
123
+ # # poll for 1 hour, instead of a number of attempts
124
+ # proc = Proc.new do |attempts, response|
125
+ # throw :failure if Time.now - started_at > 3600
126
+ # end
127
+ #
128
+ # # disable max attempts
129
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
130
+ #
131
+ # ## Handling Errors
132
+ #
133
+ # When a waiter is successful, it returns the Resource. When a waiter
134
+ # fails, it raises an error.
135
+ #
136
+ # begin
137
+ # resource.wait_until(...)
138
+ # rescue Aws::Waiters::Errors::WaiterFailed
139
+ # # resource did not enter the desired state in time
140
+ # end
141
+ #
142
+ # @yieldparam [Resource] resource to be used in the waiting condition.
143
+ #
144
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter
145
+ # terminates because the waiter has entered a state that it will not
146
+ # transition out of, preventing success.
147
+ #
148
+ # yet successful.
149
+ #
150
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is
151
+ # encountered while polling for a resource that is not expected.
152
+ #
153
+ # @raise [NotImplementedError] Raised when the resource does not
154
+ #
155
+ # @option options [Integer] :max_attempts (10) Maximum number of
156
+ # attempts
157
+ # @option options [Integer] :delay (10) Delay between each
158
+ # attempt in seconds
159
+ # @option options [Proc] :before_attempt (nil) Callback
160
+ # invoked before each attempt
161
+ # @option options [Proc] :before_wait (nil) Callback
162
+ # invoked before each wait
163
+ # @return [Resource] if the waiter was successful
164
+ def wait_until(options = {}, &block)
165
+ self_copy = self.dup
166
+ attempts = 0
167
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
168
+ options[:delay] ||= 10
169
+ options[:poller] = Proc.new do
170
+ attempts += 1
171
+ if block.call(self_copy)
172
+ [:success, self_copy]
173
+ else
174
+ self_copy.reload unless attempts == options[:max_attempts]
175
+ :retry
176
+ end
177
+ end
178
+ Aws::Waiters::Waiter.new(options).wait({})
179
+ end
180
+
181
+ # @!group Actions
182
+
183
+ # @example Request syntax with placeholder values
184
+ #
185
+ # bucket_acl.put({
186
+ # acl: "private", # accepts private, public-read, public-read-write, authenticated-read
187
+ # access_control_policy: {
188
+ # grants: [
189
+ # {
190
+ # grantee: {
191
+ # display_name: "DisplayName",
192
+ # email_address: "EmailAddress",
193
+ # id: "ID",
194
+ # type: "CanonicalUser", # required, accepts CanonicalUser, AmazonCustomerByEmail, Group
195
+ # uri: "URI",
196
+ # },
197
+ # permission: "FULL_CONTROL", # accepts FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP
198
+ # },
199
+ # ],
200
+ # owner: {
201
+ # display_name: "DisplayName",
202
+ # id: "ID",
203
+ # },
204
+ # },
205
+ # content_md5: "ContentMD5",
206
+ # grant_full_control: "GrantFullControl",
207
+ # grant_read: "GrantRead",
208
+ # grant_read_acp: "GrantReadACP",
209
+ # grant_write: "GrantWrite",
210
+ # grant_write_acp: "GrantWriteACP",
211
+ # })
212
+ # @param [Hash] options ({})
213
+ # @option options [String] :acl
214
+ # The canned ACL to apply to the bucket.
215
+ # @option options [Types::AccessControlPolicy] :access_control_policy
216
+ # Contains the elements that set the ACL permissions for an object per
217
+ # grantee.
218
+ # @option options [String] :content_md5
219
+ # The base64-encoded 128-bit MD5 digest of the data. This header must be
220
+ # used as a message integrity check to verify that the request body was
221
+ # not corrupted in transit. For more information, go to [RFC 1864.][1]
222
+ #
223
+ #
224
+ #
225
+ # [1]: http://www.ietf.org/rfc/rfc1864.txt
226
+ # @option options [String] :grant_full_control
227
+ # Allows grantee the read, write, read ACP, and write ACP permissions on
228
+ # the bucket.
229
+ # @option options [String] :grant_read
230
+ # Allows grantee to list the objects in the bucket.
231
+ # @option options [String] :grant_read_acp
232
+ # Allows grantee to read the bucket ACL.
233
+ # @option options [String] :grant_write
234
+ # Allows grantee to create, overwrite, and delete any object in the
235
+ # bucket.
236
+ # @option options [String] :grant_write_acp
237
+ # Allows grantee to write the ACL for the applicable bucket.
238
+ # @return [EmptyStructure]
239
+ def put(options = {})
240
+ options = options.merge(bucket: @bucket_name)
241
+ resp = @client.put_bucket_acl(options)
242
+ resp.data
243
+ end
244
+
245
+ # @!group Associations
246
+
247
+ # @return [Bucket]
248
+ def bucket
249
+ Bucket.new(
250
+ name: @bucket_name,
251
+ client: @client
252
+ )
253
+ end
254
+
255
+ # @deprecated
256
+ # @api private
257
+ def identifiers
258
+ { bucket_name: @bucket_name }
259
+ end
260
+ deprecated(:identifiers)
261
+
262
+ private
263
+
264
+ def extract_bucket_name(args, options)
265
+ value = args[0] || options.delete(:bucket_name)
266
+ case value
267
+ when String then value
268
+ when nil then raise ArgumentError, "missing required option :bucket_name"
269
+ else
270
+ msg = "expected :bucket_name to be a String, got #{value.class}"
271
+ raise ArgumentError, msg
272
+ end
273
+ end
274
+
275
+ class Collection < Aws::Resources::Collection; end
276
+ end
277
+ end
@@ -0,0 +1,262 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::S3
11
+
12
+ class BucketCors
13
+
14
+ extend Aws::Deprecations
15
+
16
+ # @overload def initialize(bucket_name, options = {})
17
+ # @param [String] bucket_name
18
+ # @option options [Client] :client
19
+ # @overload def initialize(options = {})
20
+ # @option options [required, String] :bucket_name
21
+ # @option options [Client] :client
22
+ def initialize(*args)
23
+ options = Hash === args.last ? args.pop.dup : {}
24
+ @bucket_name = extract_bucket_name(args, options)
25
+ @data = options.delete(:data)
26
+ @client = options.delete(:client) || Client.new(options)
27
+ @waiter_block_warned = false
28
+ end
29
+
30
+ # @!group Read-Only Attributes
31
+
32
+ # @return [String]
33
+ def bucket_name
34
+ @bucket_name
35
+ end
36
+
37
+ # A set of origins and methods (cross-origin access that you want to
38
+ # allow). You can add up to 100 rules to the configuration.
39
+ # @return [Array<Types::CORSRule>]
40
+ def cors_rules
41
+ data[:cors_rules]
42
+ end
43
+
44
+ # @!endgroup
45
+
46
+ # @return [Client]
47
+ def client
48
+ @client
49
+ end
50
+
51
+ # Loads, or reloads {#data} for the current {BucketCors}.
52
+ # Returns `self` making it possible to chain methods.
53
+ #
54
+ # bucket_cors.reload.data
55
+ #
56
+ # @return [self]
57
+ def load
58
+ resp = @client.get_bucket_cors(bucket: @bucket_name)
59
+ @data = resp.data
60
+ self
61
+ end
62
+ alias :reload :load
63
+
64
+ # @return [Types::GetBucketCorsOutput]
65
+ # Returns the data for this {BucketCors}. Calls
66
+ # {Client#get_bucket_cors} if {#data_loaded?} is `false`.
67
+ def data
68
+ load unless @data
69
+ @data
70
+ end
71
+
72
+ # @return [Boolean]
73
+ # Returns `true` if this resource is loaded. Accessing attributes or
74
+ # {#data} on an unloaded resource will trigger a call to {#load}.
75
+ def data_loaded?
76
+ !!@data
77
+ end
78
+
79
+ # @deprecated Use [Aws::S3::Client] #wait_until instead
80
+ #
81
+ # Waiter polls an API operation until a resource enters a desired
82
+ # state.
83
+ #
84
+ # @note The waiting operation is performed on a copy. The original resource
85
+ # remains unchanged.
86
+ #
87
+ # ## Basic Usage
88
+ #
89
+ # Waiter will polls until it is successful, it fails by
90
+ # entering a terminal state, or until a maximum number of attempts
91
+ # are made.
92
+ #
93
+ # # polls in a loop until condition is true
94
+ # resource.wait_until(options) {|resource| condition}
95
+ #
96
+ # ## Example
97
+ #
98
+ # instance.wait_until(max_attempts:10, delay:5) do |instance|
99
+ # instance.state.name == 'running'
100
+ # end
101
+ #
102
+ # ## Configuration
103
+ #
104
+ # You can configure the maximum number of polling attempts, and the
105
+ # delay (in seconds) between each polling attempt. The waiting condition is
106
+ # set by passing a block to {#wait_until}:
107
+ #
108
+ # # poll for ~25 seconds
109
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
110
+ #
111
+ # ## Callbacks
112
+ #
113
+ # You can be notified before each polling attempt and before each
114
+ # delay. If you throw `:success` or `:failure` from these callbacks,
115
+ # it will terminate the waiter.
116
+ #
117
+ # started_at = Time.now
118
+ # # poll for 1 hour, instead of a number of attempts
119
+ # proc = Proc.new do |attempts, response|
120
+ # throw :failure if Time.now - started_at > 3600
121
+ # end
122
+ #
123
+ # # disable max attempts
124
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
125
+ #
126
+ # ## Handling Errors
127
+ #
128
+ # When a waiter is successful, it returns the Resource. When a waiter
129
+ # fails, it raises an error.
130
+ #
131
+ # begin
132
+ # resource.wait_until(...)
133
+ # rescue Aws::Waiters::Errors::WaiterFailed
134
+ # # resource did not enter the desired state in time
135
+ # end
136
+ #
137
+ # @yieldparam [Resource] resource to be used in the waiting condition.
138
+ #
139
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter
140
+ # terminates because the waiter has entered a state that it will not
141
+ # transition out of, preventing success.
142
+ #
143
+ # yet successful.
144
+ #
145
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is
146
+ # encountered while polling for a resource that is not expected.
147
+ #
148
+ # @raise [NotImplementedError] Raised when the resource does not
149
+ #
150
+ # @option options [Integer] :max_attempts (10) Maximum number of
151
+ # attempts
152
+ # @option options [Integer] :delay (10) Delay between each
153
+ # attempt in seconds
154
+ # @option options [Proc] :before_attempt (nil) Callback
155
+ # invoked before each attempt
156
+ # @option options [Proc] :before_wait (nil) Callback
157
+ # invoked before each wait
158
+ # @return [Resource] if the waiter was successful
159
+ def wait_until(options = {}, &block)
160
+ self_copy = self.dup
161
+ attempts = 0
162
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
163
+ options[:delay] ||= 10
164
+ options[:poller] = Proc.new do
165
+ attempts += 1
166
+ if block.call(self_copy)
167
+ [:success, self_copy]
168
+ else
169
+ self_copy.reload unless attempts == options[:max_attempts]
170
+ :retry
171
+ end
172
+ end
173
+ Aws::Waiters::Waiter.new(options).wait({})
174
+ end
175
+
176
+ # @!group Actions
177
+
178
+ # @example Request syntax with placeholder values
179
+ #
180
+ # bucket_cors.delete()
181
+ # @param [Hash] options ({})
182
+ # @return [EmptyStructure]
183
+ def delete(options = {})
184
+ options = options.merge(bucket: @bucket_name)
185
+ resp = @client.delete_bucket_cors(options)
186
+ resp.data
187
+ end
188
+
189
+ # @example Request syntax with placeholder values
190
+ #
191
+ # bucket_cors.put({
192
+ # cors_configuration: { # required
193
+ # cors_rules: [ # required
194
+ # {
195
+ # allowed_headers: ["AllowedHeader"],
196
+ # allowed_methods: ["AllowedMethod"], # required
197
+ # allowed_origins: ["AllowedOrigin"], # required
198
+ # expose_headers: ["ExposeHeader"],
199
+ # max_age_seconds: 1,
200
+ # },
201
+ # ],
202
+ # },
203
+ # content_md5: "ContentMD5",
204
+ # })
205
+ # @param [Hash] options ({})
206
+ # @option options [required, Types::CORSConfiguration] :cors_configuration
207
+ # Describes the cross-origin access configuration for objects in an
208
+ # Amazon S3 bucket. For more information, see [Enabling Cross-Origin
209
+ # Resource Sharing][1] in the *Amazon Simple Storage Service Developer
210
+ # Guide*.
211
+ #
212
+ #
213
+ #
214
+ # [1]: https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html
215
+ # @option options [String] :content_md5
216
+ # The base64-encoded 128-bit MD5 digest of the data. This header must be
217
+ # used as a message integrity check to verify that the request body was
218
+ # not corrupted in transit. For more information, go to [RFC 1864.][1]
219
+ #
220
+ #
221
+ #
222
+ # [1]: http://www.ietf.org/rfc/rfc1864.txt
223
+ # @return [EmptyStructure]
224
+ def put(options = {})
225
+ options = options.merge(bucket: @bucket_name)
226
+ resp = @client.put_bucket_cors(options)
227
+ resp.data
228
+ end
229
+
230
+ # @!group Associations
231
+
232
+ # @return [Bucket]
233
+ def bucket
234
+ Bucket.new(
235
+ name: @bucket_name,
236
+ client: @client
237
+ )
238
+ end
239
+
240
+ # @deprecated
241
+ # @api private
242
+ def identifiers
243
+ { bucket_name: @bucket_name }
244
+ end
245
+ deprecated(:identifiers)
246
+
247
+ private
248
+
249
+ def extract_bucket_name(args, options)
250
+ value = args[0] || options.delete(:bucket_name)
251
+ case value
252
+ when String then value
253
+ when nil then raise ArgumentError, "missing required option :bucket_name"
254
+ else
255
+ msg = "expected :bucket_name to be a String, got #{value.class}"
256
+ raise ArgumentError, msg
257
+ end
258
+ end
259
+
260
+ class Collection < Aws::Resources::Collection; end
261
+ end
262
+ end