You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.

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)



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

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.



374
375
376
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 374

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.



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

def glacier_transition_time
  @glacier_transition_time
end

#idString (readonly)

Returns:

  • (String)


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

def id
  @id
end

#noncurrent_version_expiration_daysInteger

Returns:

  • (Integer)


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

def noncurrent_version_expiration_days
  @noncurrent_version_expiration_days
end

#noncurrent_version_transition_daysInteger

Returns:

  • (Integer)


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

def noncurrent_version_transition_days
  @noncurrent_version_transition_days
end

#prefixString

Returns:

  • (String)


369
370
371
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 369

def prefix
  @prefix
end

#statusString

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

Returns:

  • (String)

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



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

def status
  @status
end

Instance Method Details

#disabled!Object



417
418
419
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 417

def disabled!
  self.status = 'Disabled'
end

#disabled?Boolean

Returns:

  • (Boolean)


413
414
415
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 413

def disabled?
  status == 'Disabled'
end

#enable!Object



409
410
411
# File 'lib/aws/s3/bucket_lifecycle_configuration.rb', line 409

def enable!
  self.status = 'Enabled'
end

#enabled?Boolean

Returns:

  • (Boolean)


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

def enabled?
  status == 'Enabled'
end