Class: AWS::S3::BucketLifecycleConfiguration::Rule
- Inherits:
-
Object
- Object
- AWS::S3::BucketLifecycleConfiguration::Rule
- Defined in:
- lib/aws/s3/bucket_lifecycle_configuration.rb
Overview
Represents a single rule from an Amazon S3 bucket lifecycle configuration.
# delete all objects with the prefix 'temporary/' after 10 days
bucket.lifecycle_configuration.add_rule 'temporary/', 10
# remove the rule created above
bucket.lifecycle_configuration.remove_rule 'temporary/'
Instance Attribute Summary collapse
- #configuration ⇒ BucketLifecycleConfiguration readonly
- #expiration_days ⇒ Integer
- #id ⇒ String readonly
- #prefix ⇒ String
-
#status ⇒ String
Returns the rule status, ‘Enabled’ or ‘Disabled’.
Instance Method Summary collapse
- #disabled! ⇒ Object
- #disabled? ⇒ Boolean
- #enable! ⇒ Object
- #enabled? ⇒ Boolean
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(configuration, id, prefix, expiration_days, status) ⇒ Rule
constructor
A new instance of Rule.
Constructor Details
#initialize(configuration, id, prefix, expiration_days, status) ⇒ Rule
Returns a new instance of Rule.
305 306 307 308 309 310 311 |
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 305 def initialize configuration, id, prefix, expiration_days, status @configuration = configuration @id = id @prefix = prefix @expiration_days = expiration_days @status = status end |
Instance Attribute Details
#configuration ⇒ BucketLifecycleConfiguration (readonly)
314 315 316 |
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 314 def configuration @configuration end |
#expiration_days ⇒ Integer
323 324 325 |
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 323 def expiration_days @expiration_days end |
#id ⇒ String (readonly)
317 318 319 |
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 317 def id @id end |
#prefix ⇒ String
320 321 322 |
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 320 def prefix @prefix end |
#status ⇒ String
Returns the rule status, ‘Enabled’ or ‘Disabled’
326 327 328 |
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 326 def status @status end |
Instance Method Details
#disabled! ⇒ Object
340 341 342 |
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 340 def disabled! self.status = 'Disabled' end |
#disabled? ⇒ Boolean
336 337 338 |
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 336 def disabled? status == 'Disabled' end |
#enable! ⇒ Object
332 333 334 |
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 332 def enable! self.status = 'Enabled' end |
#enabled? ⇒ Boolean
328 329 330 |
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 328 def enabled? status == 'Enabled' end |
#eql?(other) ⇒ Boolean Also known as: ==
345 346 347 348 349 350 351 352 |
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 345 def eql? other other.is_a?(Rule) and other.configuration.bucket == configuration.bucket and other.id == id and other.prefix == prefix and other.expiration_days == expiration_days and other.status == status end |