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)



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

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.



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

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.



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

def glacier_transition_time
  @glacier_transition_time
end

#idString (readonly)

Returns:

  • (String)


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

def id
  @id
end

#prefixString

Returns:

  • (String)


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

def prefix
  @prefix
end

#statusString

Returns the rule status, ‘Enabled’ or ‘Disabled’

Returns:

  • (String)

    Returns the rule status, ‘Enabled’ or ‘Disabled’



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

def status
  @status
end

Instance Method Details

#disabled!Object



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

def disabled!
  self.status = 'Disabled'
end

#disabled?Boolean

Returns:

  • (Boolean)


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

def disabled?
  status == 'Disabled'
end

#enable!Object



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

def enable!
  self.status = 'Enabled'
end

#enabled?Boolean

Returns:

  • (Boolean)


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

def enabled?
  status == 'Enabled'
end