Class: AWS::S3::BucketLifecycleConfiguration::Rule

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#configurationBucketLifecycleConfiguration (readonly)



355
356
357
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 355

def configuration
  @configuration
end

#expiration_timeDate, Integer Also known as: expiration_days

Returns:

  • (Date)

    the date the objects will expire

  • (Integer)

    if the value is an integer, returns the number of days before the object will expire.



366
367
368
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 366

def expiration_time
  @expiration_time
end

#glacier_transition_timeDate, Integer

Returns:

  • (Date)

    the date the objects will be transitioned into the Amazon Glacier storage tier.

  • (Integer)

    if the value is an integer, returns the number of days before the object is transitioned into the Amazon Glacier storage tier.



381
382
383
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 381

def glacier_transition_time
  @glacier_transition_time
end

#idString (readonly)

Returns:

  • (String)


358
359
360
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 358

def id
  @id
end

#prefixString

Returns:

  • (String)


361
362
363
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 361

def prefix
  @prefix
end

#statusString

Returns the rule status, 'Enabled' or 'Disabled'

Returns:

  • (String)

    Returns the rule status, 'Enabled' or 'Disabled'



389
390
391
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 389

def status
  @status
end

Instance Method Details

#disabled!Object



403
404
405
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 403

def disabled!
  self.status = 'Disabled'
end

#disabled?Boolean

Returns:

  • (Boolean)


399
400
401
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 399

def disabled?
  status == 'Disabled'
end

#enable!Object



395
396
397
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 395

def enable!
  self.status = 'Enabled'
end

#enabled?Boolean

Returns:

  • (Boolean)


391
392
393
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 391

def enabled?
  status == 'Enabled'
end