Sha256: a5f05282a3241f5fbf0c9f153a17ac4e74f5a1601c336115672b9abbd5b19d94

Contents?: true

Size: 1.72 KB

Versions: 36

Compression:

Stored size: 1.72 KB

Contents

module Fog
  module Parsers
    module Storage
      module AWS
        class GetBucketLifecycle < Fog::Parsers::Base
          def reset
            @expiration = {}
            @transition = {}
            @rule = {}
            @response = { 'Rules' => [] }
          end

          def start_element(name, attrs=[])
            super
            case name
            when 'Expiration'
              @in_expiration = true
            when 'Transition'
              @in_transition = true
            end
          end

          def end_element(name)
            if @in_expiration
              case name
              when 'Days'
                @expiration[name] = value.to_i
              when 'Date'
                @expiration[name] = value
              when 'Expiration'
                @rule['Expiration'] = @expiration
                @in_expiration = false
                @expiration = {}
              end
            elsif @in_transition
              case name
              when 'StorageClass',
                @transition['StorageClass'] = value
              when 'Date'
                @transition[name] = value
              when 'Days'
                @transition[name] = value.to_i
              when 'Transition'
                @rule['Transition'] = @transition
                @in_transition = false
                @transition = {}
              end
            else
              case name
              when 'ID', 'Prefix'
                @rule[name] = value
              when 'Status'
                @rule['Enabled'] = value == 'Enabled'
              when 'Rule'
                @response['Rules'] << @rule
                @rule = {}
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 5 rubygems

Version Path
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-aws-0.7.5/lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.7.6 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.7.5 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.7.4 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.7.3 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.7.2 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.6.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.5.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.4.1 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.4.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.3.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.2.2 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.2.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.1.2 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.1.1 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.1.0 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.0.8 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.0.7 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb
fog-aws-0.0.6 lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb