Sha256: 4de990b1bd87249309413b498c544f7dda9f05c2b5178340cce2045d40c5d8d5

Contents?: true

Size: 1.95 KB

Versions: 34

Compression:

Stored size: 1.95 KB

Contents

module Fog
  module Parsers
    module AWS
      module CloudFormation

        class DescribeStacks < Fog::Parsers::Base

          def reset
            @stack = { 'Outputs' => [], 'Parameters' => [] }
            @output = {}
            @parameter = {}
            @response = { 'Stacks' => [] }
          end

          def start_element(name, attrs = [])
            super
            case name
            when 'Outputs'
              @in_outputs = true
            when 'Parameters'
              @in_parameters = true
            end
          end

          def end_element(name)
            if @in_outputs
              case name
              when 'OutputKey', 'OutputValue'
                @output[name] = value
              when 'member'
                @stack['Outputs'] << @output
                @output = {}
              when 'Outputs'
                @in_outputs = false
              end
            elsif @in_parameters
              case name
              when 'ParameterKey', 'ParameterValue'
                @parameter[name] = value
              when 'member'
                @stack['Parameters'] << @parameter
                @parameter = {}
              when 'Parameters'
                @in_parameters = false
              end
            else
              case name
              when 'member'
                @response['Stacks'] << @stack
                @stack = { 'Outputs' => [], 'Parameters' => [] }
              when 'RequestId'
                @response[name] = value
              when 'CreationTime'
                @stack[name] = Time.parse(value)
              when 'DisableRollback'
                case value
                when 'false'
                  @stack[name] = false
                when 'true'
                  @stack[name] = true
                end
              when 'StackName', 'StackId', 'StackStatus'
                @stack[name] = value
              end
            end
          end

        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 7 rubygems

Version Path
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
fog-1.3.1 lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
fog-1.3.0 lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
fog-1.2.0 lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
ktheory-fog-1.1.2 lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
fog-1.1.2 lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
fog_tractical-1.1.4 lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
fog_tractical-1.1.3 lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
brightbox-cli-0.16.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
fog-1.1.1 lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
fog-1.1.0 lib/fog/aws/parsers/cloud_formation/describe_stacks.rb
brightbox-cli-0.15.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb