Sha256: 8ed437fba11f55afe0d374b5b2591e368a19e91396742dd9c0b9a03f7042f5cf

Contents?: true

Size: 1.64 KB

Versions: 54

Compression:

Stored size: 1.64 KB

Contents

module Fog
  module Parsers
    module AWS
      module IAM
        class ListPolicyVersions < Fog::Parsers::Base
          def reset
            super
            @stack = []
            @response = { 'Versions' => [], 'Marker' => '', 'IsTruncated' => false }
          end

          def start_element(name,attrs = [])
            case name
            when 'Versions'
              @stack << name
            when 'member'
              if @stack.last == 'Versions'
                @version = {}
              end
            end
            super
          end

          def end_element(name)
            case name
            when 'member'
              @response['Versions'] << @version
              @version = {}
            when 'IsTruncated'
              response[name] = (value == 'true')
            when 'Marker', 'RequestId'
              @response[name] = value
            end
            super
          end
          
          def end_element(name)
            case name
            when 'VersionId'
              @version[name] = value
            when 'CreateDate'
              @version[name] = Time.parse(value)
            when 'IsDefaultVersion'
              @version[name] = (value == 'true')
            when 'Versions'
              if @stack.last == 'Versions'
                @stack.pop
              end
            when 'member'
              if @stack.last == 'Versions'
                finished_version(@version)
                @version = nil
              end
            end
          end
          
          def finished_version(version)
            @response['Versions'] << version
          end
        end
      end
    end
  end
end

Version data entries

54 entries across 52 versions & 2 rubygems

Version Path
fog-aws-3.29.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.28.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.27.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.26.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.25.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.24.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.23.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.22.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.21.1 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.21.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.20.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.19.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.18.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.17.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.16.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.15.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.14.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.13.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.12.0 lib/fog/aws/parsers/iam/list_policy_versions.rb
fog-aws-3.11.0 lib/fog/aws/parsers/iam/list_policy_versions.rb