mirror of
https://github.com/fog/fog-aws.git
synced 2022-11-09 13:50:52 -05:00
Update lifecycle parser for version policies.
This commit is contained in:
parent
356d1828e8
commit
2a49f0ce8b
1 changed files with 31 additions and 1 deletions
|
@ -5,7 +5,9 @@ module Fog
|
|||
class GetBucketLifecycle < Fog::Parsers::Base
|
||||
def reset
|
||||
@expiration = {}
|
||||
@version_expiration = {}
|
||||
@transition = {}
|
||||
@version_transition = {}
|
||||
@rule = {}
|
||||
@response = { 'Rules' => [] }
|
||||
end
|
||||
|
@ -17,6 +19,10 @@ module Fog
|
|||
@in_expiration = true
|
||||
when 'Transition'
|
||||
@in_transition = true
|
||||
when 'NoncurrentVersionExpiration'
|
||||
@in_version_expiration = true
|
||||
when 'NoncurrentVersionTransition'
|
||||
@in_version_transition = true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -32,19 +38,43 @@ module Fog
|
|||
@in_expiration = false
|
||||
@expiration = {}
|
||||
end
|
||||
elsif @in_version_expiration
|
||||
case name
|
||||
when 'NoncurrentDays'
|
||||
@version_expiration[name] = value.to_i
|
||||
when 'Date'
|
||||
@version_expiration[name] = value
|
||||
when 'NoncurrentVersionExpiration'
|
||||
@rule['NoncurrentVersionExpiration'] = @version_expiration
|
||||
@in_version_expiration = false
|
||||
@version_expiration = {}
|
||||
end
|
||||
elsif @in_transition
|
||||
case name
|
||||
when 'StorageClass',
|
||||
@transition['StorageClass'] = value
|
||||
when 'Date'
|
||||
@transition[name] = value
|
||||
when 'Days'
|
||||
when 'NoncurrentDays'
|
||||
@transition[name] = value.to_i
|
||||
when 'Transition'
|
||||
@rule['Transition'] = @transition
|
||||
@in_transition = false
|
||||
@transition = {}
|
||||
end
|
||||
elsif @in_version_transition
|
||||
case name
|
||||
when 'StorageClass',
|
||||
@version_transition['StorageClass'] = value
|
||||
when 'Date'
|
||||
@version_transition[name] = value
|
||||
when 'Days'
|
||||
@version_transition[name] = value.to_i
|
||||
when 'NoncurrentVersionTransition'
|
||||
@rule['NoncurrentVersionTransition'] = @transition
|
||||
@in_version_transition = false
|
||||
@version_transition = {}
|
||||
end
|
||||
else
|
||||
case name
|
||||
when 'ID', 'Prefix'
|
||||
|
|
Loading…
Reference in a new issue