Sha256: a28e2e7080bc80ff12812a3579e471385a15240a951cde3e2b9545cd760bae20

Contents?: true

Size: 1.44 KB

Versions: 70

Compression:

Stored size: 1.44 KB

Contents

require 'fog/aws/parsers/iam/policy_parser'

module Fog
  module Parsers
    module AWS
      module IAM
        class ListManagedPolicies < Fog::Parsers::AWS::IAM::PolicyParser
          def reset
            super
            @response = { 'Policies' => [] , 'Marker' => '', 'IsTruncated' => false}
          end

          def finished_policy(policy)
            @response['Policies'] << policy
          end

          def start_element(name,attrs = [])
            case name
            when 'AttachedPolicies'
              @stack << name
            when 'AttachedPolicy'
              @policy = fresh_policy
            when 'member'
              if @stack.last == 'AttachedPolicies'
                @policy = fresh_policy
              end
            end
            super
          end

          def end_element(name)
            case name
            when 'RequestId', 'Marker'
              @response[name] = value
            when 'IsTruncated'
              @response[name] = (value == 'true')
            when 'PolicyArn', 'PolicyName'
              @policy[name] = value
            when 'AttachedPolicies'
              if @stack.last == 'AttachedPolicies'
                @stack.pop
              end
            when 'member'
              if @stack.last == 'AttachedPolicies'
                finished_policy(@policy)
                @policy = nil
              end
            end
            super
          end
        end
      end
    end
  end
end

Version data entries

70 entries across 68 versions & 3 rubygems

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