Sha256: 37934aae2dd568114dafb10c5da086bf641d70ba3bbe59a846499f19111d01a6

Contents?: true

Size: 1.84 KB

Versions: 53

Compression:

Stored size: 1.84 KB

Contents

module Fog
  module Parsers
    module AWS
      module CloudFormation
        class GetTemplateSummary < Fog::Parsers::Base
          def reset
            reset_parameter
            @response = {'Capabilities' => [],'ResourceTypes' => '','Parameters' => []  }
          end

          def reset_parameter
            @parameter = {'AllowedValues' => []}
          end

          def start_element(name, attrs=[])
            super
            case name
            when 'Capabilities'
              @in_capabilities = true
            when 'Parameters'
              @in_parameters = true
            when 'ResourceTypes'
              @in_resource_types = true
            end
          end

          def end_element(name)
            case name
            when 'member'
              if @in_capabilities
                @response['Capabilities'] << value
              elsif @in_resource_types
                @response['ResourceTypes'] << value
              elsif @in_parameters
                @response['Parameters'] << @parameter
                reset_parameter
              end
            when 'DefaultValue', 'NoEcho', 'ParameterKey', 'ParameterType', 'ParameterType'
              @parameter[name] = value if @in_parameters
            when 'Description'
              if @in_parameters
                @parameter[name] = value
              else
                @response[name] = value
              end
            when 'ParameterConstraints'
              @parameter['AllowedValues'] << value  if @in_parameters
            when 'RequestId'
              @response[name] = value
            when 'Parameters'
              @in_parameters = false
            when 'ResourceTypes'
              @in_resource_types = false
            when 'Capabilities'
              @in_capabilities = false
            end
          end
        end
      end
    end
  end
end

Version data entries

53 entries across 51 versions & 2 rubygems

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