aws-sdk-s3 1.75.0

Sign up to get free protection for your applications and to get access to all the features.
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,264 @@
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 BucketLifecycle
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 a lifecycle rule.
38
+ # @return [Array<Types::Rule>]
39
+ def rules
40
+ data[:rules]
41
+ end
42
+
43
+ # @!endgroup
44
+
45
+ # @return [Client]
46
+ def client
47
+ @client
48
+ end
49
+
50
+ # Loads, or reloads {#data} for the current {BucketLifecycle}.
51
+ # Returns `self` making it possible to chain methods.
52
+ #
53
+ # bucket_lifecycle.reload.data
54
+ #
55
+ # @return [self]
56
+ def load
57
+ resp = @client.get_bucket_lifecycle(bucket: @bucket_name)
58
+ @data = resp.data
59
+ self
60
+ end
61
+ alias :reload :load
62
+
63
+ # @return [Types::GetBucketLifecycleOutput]
64
+ # Returns the data for this {BucketLifecycle}. Calls
65
+ # {Client#get_bucket_lifecycle} if {#data_loaded?} is `false`.
66
+ def data
67
+ load unless @data
68
+ @data
69
+ end
70
+
71
+ # @return [Boolean]
72
+ # Returns `true` if this resource is loaded. Accessing attributes or
73
+ # {#data} on an unloaded resource will trigger a call to {#load}.
74
+ def data_loaded?
75
+ !!@data
76
+ end
77
+
78
+ # @deprecated Use [Aws::S3::Client] #wait_until instead
79
+ #
80
+ # Waiter polls an API operation until a resource enters a desired
81
+ # state.
82
+ #
83
+ # @note The waiting operation is performed on a copy. The original resource
84
+ # remains unchanged.
85
+ #
86
+ # ## Basic Usage
87
+ #
88
+ # Waiter will polls until it is successful, it fails by
89
+ # entering a terminal state, or until a maximum number of attempts
90
+ # are made.
91
+ #
92
+ # # polls in a loop until condition is true
93
+ # resource.wait_until(options) {|resource| condition}
94
+ #
95
+ # ## Example
96
+ #
97
+ # instance.wait_until(max_attempts:10, delay:5) do |instance|
98
+ # instance.state.name == 'running'
99
+ # end
100
+ #
101
+ # ## Configuration
102
+ #
103
+ # You can configure the maximum number of polling attempts, and the
104
+ # delay (in seconds) between each polling attempt. The waiting condition is
105
+ # set by passing a block to {#wait_until}:
106
+ #
107
+ # # poll for ~25 seconds
108
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
109
+ #
110
+ # ## Callbacks
111
+ #
112
+ # You can be notified before each polling attempt and before each
113
+ # delay. If you throw `:success` or `:failure` from these callbacks,
114
+ # it will terminate the waiter.
115
+ #
116
+ # started_at = Time.now
117
+ # # poll for 1 hour, instead of a number of attempts
118
+ # proc = Proc.new do |attempts, response|
119
+ # throw :failure if Time.now - started_at > 3600
120
+ # end
121
+ #
122
+ # # disable max attempts
123
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
124
+ #
125
+ # ## Handling Errors
126
+ #
127
+ # When a waiter is successful, it returns the Resource. When a waiter
128
+ # fails, it raises an error.
129
+ #
130
+ # begin
131
+ # resource.wait_until(...)
132
+ # rescue Aws::Waiters::Errors::WaiterFailed
133
+ # # resource did not enter the desired state in time
134
+ # end
135
+ #
136
+ # @yieldparam [Resource] resource to be used in the waiting condition.
137
+ #
138
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter
139
+ # terminates because the waiter has entered a state that it will not
140
+ # transition out of, preventing success.
141
+ #
142
+ # yet successful.
143
+ #
144
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is
145
+ # encountered while polling for a resource that is not expected.
146
+ #
147
+ # @raise [NotImplementedError] Raised when the resource does not
148
+ #
149
+ # @option options [Integer] :max_attempts (10) Maximum number of
150
+ # attempts
151
+ # @option options [Integer] :delay (10) Delay between each
152
+ # attempt in seconds
153
+ # @option options [Proc] :before_attempt (nil) Callback
154
+ # invoked before each attempt
155
+ # @option options [Proc] :before_wait (nil) Callback
156
+ # invoked before each wait
157
+ # @return [Resource] if the waiter was successful
158
+ def wait_until(options = {}, &block)
159
+ self_copy = self.dup
160
+ attempts = 0
161
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
162
+ options[:delay] ||= 10
163
+ options[:poller] = Proc.new do
164
+ attempts += 1
165
+ if block.call(self_copy)
166
+ [:success, self_copy]
167
+ else
168
+ self_copy.reload unless attempts == options[:max_attempts]
169
+ :retry
170
+ end
171
+ end
172
+ Aws::Waiters::Waiter.new(options).wait({})
173
+ end
174
+
175
+ # @!group Actions
176
+
177
+ # @example Request syntax with placeholder values
178
+ #
179
+ # bucket_lifecycle.delete()
180
+ # @param [Hash] options ({})
181
+ # @return [EmptyStructure]
182
+ def delete(options = {})
183
+ options = options.merge(bucket: @bucket_name)
184
+ resp = @client.delete_bucket_lifecycle(options)
185
+ resp.data
186
+ end
187
+
188
+ # @example Request syntax with placeholder values
189
+ #
190
+ # bucket_lifecycle.put({
191
+ # content_md5: "ContentMD5",
192
+ # lifecycle_configuration: {
193
+ # rules: [ # required
194
+ # {
195
+ # expiration: {
196
+ # date: Time.now,
197
+ # days: 1,
198
+ # expired_object_delete_marker: false,
199
+ # },
200
+ # id: "ID",
201
+ # prefix: "Prefix", # required
202
+ # status: "Enabled", # required, accepts Enabled, Disabled
203
+ # transition: {
204
+ # date: Time.now,
205
+ # days: 1,
206
+ # storage_class: "GLACIER", # accepts GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE
207
+ # },
208
+ # noncurrent_version_transition: {
209
+ # noncurrent_days: 1,
210
+ # storage_class: "GLACIER", # accepts GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE
211
+ # },
212
+ # noncurrent_version_expiration: {
213
+ # noncurrent_days: 1,
214
+ # },
215
+ # abort_incomplete_multipart_upload: {
216
+ # days_after_initiation: 1,
217
+ # },
218
+ # },
219
+ # ],
220
+ # },
221
+ # })
222
+ # @param [Hash] options ({})
223
+ # @option options [String] :content_md5
224
+ # @option options [Types::LifecycleConfiguration] :lifecycle_configuration
225
+ # @return [EmptyStructure]
226
+ def put(options = {})
227
+ options = options.merge(bucket: @bucket_name)
228
+ resp = @client.put_bucket_lifecycle(options)
229
+ resp.data
230
+ end
231
+
232
+ # @!group Associations
233
+
234
+ # @return [Bucket]
235
+ def bucket
236
+ Bucket.new(
237
+ name: @bucket_name,
238
+ client: @client
239
+ )
240
+ end
241
+
242
+ # @deprecated
243
+ # @api private
244
+ def identifiers
245
+ { bucket_name: @bucket_name }
246
+ end
247
+ deprecated(:identifiers)
248
+
249
+ private
250
+
251
+ def extract_bucket_name(args, options)
252
+ value = args[0] || options.delete(:bucket_name)
253
+ case value
254
+ when String then value
255
+ when nil then raise ArgumentError, "missing required option :bucket_name"
256
+ else
257
+ msg = "expected :bucket_name to be a String, got #{value.class}"
258
+ raise ArgumentError, msg
259
+ end
260
+ end
261
+
262
+ class Collection < Aws::Resources::Collection; end
263
+ end
264
+ end
@@ -0,0 +1,283 @@
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 BucketLifecycleConfiguration
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 a lifecycle rule.
38
+ # @return [Array<Types::LifecycleRule>]
39
+ def rules
40
+ data[:rules]
41
+ end
42
+
43
+ # @!endgroup
44
+
45
+ # @return [Client]
46
+ def client
47
+ @client
48
+ end
49
+
50
+ # Loads, or reloads {#data} for the current {BucketLifecycleConfiguration}.
51
+ # Returns `self` making it possible to chain methods.
52
+ #
53
+ # bucket_lifecycle_configuration.reload.data
54
+ #
55
+ # @return [self]
56
+ def load
57
+ resp = @client.get_bucket_lifecycle_configuration(bucket: @bucket_name)
58
+ @data = resp.data
59
+ self
60
+ end
61
+ alias :reload :load
62
+
63
+ # @return [Types::GetBucketLifecycleConfigurationOutput]
64
+ # Returns the data for this {BucketLifecycleConfiguration}. Calls
65
+ # {Client#get_bucket_lifecycle_configuration} if {#data_loaded?} is `false`.
66
+ def data
67
+ load unless @data
68
+ @data
69
+ end
70
+
71
+ # @return [Boolean]
72
+ # Returns `true` if this resource is loaded. Accessing attributes or
73
+ # {#data} on an unloaded resource will trigger a call to {#load}.
74
+ def data_loaded?
75
+ !!@data
76
+ end
77
+
78
+ # @deprecated Use [Aws::S3::Client] #wait_until instead
79
+ #
80
+ # Waiter polls an API operation until a resource enters a desired
81
+ # state.
82
+ #
83
+ # @note The waiting operation is performed on a copy. The original resource
84
+ # remains unchanged.
85
+ #
86
+ # ## Basic Usage
87
+ #
88
+ # Waiter will polls until it is successful, it fails by
89
+ # entering a terminal state, or until a maximum number of attempts
90
+ # are made.
91
+ #
92
+ # # polls in a loop until condition is true
93
+ # resource.wait_until(options) {|resource| condition}
94
+ #
95
+ # ## Example
96
+ #
97
+ # instance.wait_until(max_attempts:10, delay:5) do |instance|
98
+ # instance.state.name == 'running'
99
+ # end
100
+ #
101
+ # ## Configuration
102
+ #
103
+ # You can configure the maximum number of polling attempts, and the
104
+ # delay (in seconds) between each polling attempt. The waiting condition is
105
+ # set by passing a block to {#wait_until}:
106
+ #
107
+ # # poll for ~25 seconds
108
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
109
+ #
110
+ # ## Callbacks
111
+ #
112
+ # You can be notified before each polling attempt and before each
113
+ # delay. If you throw `:success` or `:failure` from these callbacks,
114
+ # it will terminate the waiter.
115
+ #
116
+ # started_at = Time.now
117
+ # # poll for 1 hour, instead of a number of attempts
118
+ # proc = Proc.new do |attempts, response|
119
+ # throw :failure if Time.now - started_at > 3600
120
+ # end
121
+ #
122
+ # # disable max attempts
123
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
124
+ #
125
+ # ## Handling Errors
126
+ #
127
+ # When a waiter is successful, it returns the Resource. When a waiter
128
+ # fails, it raises an error.
129
+ #
130
+ # begin
131
+ # resource.wait_until(...)
132
+ # rescue Aws::Waiters::Errors::WaiterFailed
133
+ # # resource did not enter the desired state in time
134
+ # end
135
+ #
136
+ # @yieldparam [Resource] resource to be used in the waiting condition.
137
+ #
138
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter
139
+ # terminates because the waiter has entered a state that it will not
140
+ # transition out of, preventing success.
141
+ #
142
+ # yet successful.
143
+ #
144
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is
145
+ # encountered while polling for a resource that is not expected.
146
+ #
147
+ # @raise [NotImplementedError] Raised when the resource does not
148
+ #
149
+ # @option options [Integer] :max_attempts (10) Maximum number of
150
+ # attempts
151
+ # @option options [Integer] :delay (10) Delay between each
152
+ # attempt in seconds
153
+ # @option options [Proc] :before_attempt (nil) Callback
154
+ # invoked before each attempt
155
+ # @option options [Proc] :before_wait (nil) Callback
156
+ # invoked before each wait
157
+ # @return [Resource] if the waiter was successful
158
+ def wait_until(options = {}, &block)
159
+ self_copy = self.dup
160
+ attempts = 0
161
+ options[:max_attempts] = 10 unless options.key?(:max_attempts)
162
+ options[:delay] ||= 10
163
+ options[:poller] = Proc.new do
164
+ attempts += 1
165
+ if block.call(self_copy)
166
+ [:success, self_copy]
167
+ else
168
+ self_copy.reload unless attempts == options[:max_attempts]
169
+ :retry
170
+ end
171
+ end
172
+ Aws::Waiters::Waiter.new(options).wait({})
173
+ end
174
+
175
+ # @!group Actions
176
+
177
+ # @example Request syntax with placeholder values
178
+ #
179
+ # bucket_lifecycle_configuration.delete()
180
+ # @param [Hash] options ({})
181
+ # @return [EmptyStructure]
182
+ def delete(options = {})
183
+ options = options.merge(bucket: @bucket_name)
184
+ resp = @client.delete_bucket_lifecycle(options)
185
+ resp.data
186
+ end
187
+
188
+ # @example Request syntax with placeholder values
189
+ #
190
+ # bucket_lifecycle_configuration.put({
191
+ # lifecycle_configuration: {
192
+ # rules: [ # required
193
+ # {
194
+ # expiration: {
195
+ # date: Time.now,
196
+ # days: 1,
197
+ # expired_object_delete_marker: false,
198
+ # },
199
+ # id: "ID",
200
+ # prefix: "Prefix",
201
+ # filter: {
202
+ # prefix: "Prefix",
203
+ # tag: {
204
+ # key: "ObjectKey", # required
205
+ # value: "Value", # required
206
+ # },
207
+ # and: {
208
+ # prefix: "Prefix",
209
+ # tags: [
210
+ # {
211
+ # key: "ObjectKey", # required
212
+ # value: "Value", # required
213
+ # },
214
+ # ],
215
+ # },
216
+ # },
217
+ # status: "Enabled", # required, accepts Enabled, Disabled
218
+ # transitions: [
219
+ # {
220
+ # date: Time.now,
221
+ # days: 1,
222
+ # storage_class: "GLACIER", # accepts GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE
223
+ # },
224
+ # ],
225
+ # noncurrent_version_transitions: [
226
+ # {
227
+ # noncurrent_days: 1,
228
+ # storage_class: "GLACIER", # accepts GLACIER, STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, DEEP_ARCHIVE
229
+ # },
230
+ # ],
231
+ # noncurrent_version_expiration: {
232
+ # noncurrent_days: 1,
233
+ # },
234
+ # abort_incomplete_multipart_upload: {
235
+ # days_after_initiation: 1,
236
+ # },
237
+ # },
238
+ # ],
239
+ # },
240
+ # })
241
+ # @param [Hash] options ({})
242
+ # @option options [Types::BucketLifecycleConfiguration] :lifecycle_configuration
243
+ # Container for lifecycle rules. You can add as many as 1,000 rules.
244
+ # @return [EmptyStructure]
245
+ def put(options = {})
246
+ options = options.merge(bucket: @bucket_name)
247
+ resp = @client.put_bucket_lifecycle_configuration(options)
248
+ resp.data
249
+ end
250
+
251
+ # @!group Associations
252
+
253
+ # @return [Bucket]
254
+ def bucket
255
+ Bucket.new(
256
+ name: @bucket_name,
257
+ client: @client
258
+ )
259
+ end
260
+
261
+ # @deprecated
262
+ # @api private
263
+ def identifiers
264
+ { bucket_name: @bucket_name }
265
+ end
266
+ deprecated(:identifiers)
267
+
268
+ private
269
+
270
+ def extract_bucket_name(args, options)
271
+ value = args[0] || options.delete(:bucket_name)
272
+ case value
273
+ when String then value
274
+ when nil then raise ArgumentError, "missing required option :bucket_name"
275
+ else
276
+ msg = "expected :bucket_name to be a String, got #{value.class}"
277
+ raise ArgumentError, msg
278
+ end
279
+ end
280
+
281
+ class Collection < Aws::Resources::Collection; end
282
+ end
283
+ end