Class: Aliyun::Oss::Rule::LifeCycle

Inherits:
Object
  • Object
show all
Defined in:
lib/aliyun/oss/rule/lifecycle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ LifeCycle

Returns a new instance of LifeCycle.



20
21
22
23
24
25
26
# File 'lib/aliyun/oss/rule/lifecycle.rb', line 20

def initialize(options = {})
  @id = options[:id]
  @prefix = options[:prefix]
  @enable = options[:enable]
  @days = options[:days]
  @date = options[:date]
end

Instance Attribute Details

#dateObject

Time

Set auto auto delete object at given time, at least exist one with days



18
19
20
# File 'lib/aliyun/oss/rule/lifecycle.rb', line 18

def date
  @date
end

#daysObject

Integer

Set auto delete objects after days since last modified, at least exist one with date



15
16
17
# File 'lib/aliyun/oss/rule/lifecycle.rb', line 15

def days
  @days
end

#enableObject

Boolean

Used for set rule status



12
13
14
# File 'lib/aliyun/oss/rule/lifecycle.rb', line 12

def enable
  @enable
end

#idObject

Integer

optional, Rule ID, auto set when not set



6
7
8
# File 'lib/aliyun/oss/rule/lifecycle.rb', line 6

def id
  @id
end

#prefixObject

String

Used for filter objects



9
10
11
# File 'lib/aliyun/oss/rule/lifecycle.rb', line 9

def prefix
  @prefix
end

Instance Method Details

#to_hashObject



28
29
30
31
32
33
34
# File 'lib/aliyun/oss/rule/lifecycle.rb', line 28

def to_hash
  if valid?
    { 'ID' => id || '', 'Prefix' => prefix, 'Status' => status, 'Expiration' => expiration }
  else
    {}
  end
end