Sha256: 35c66998f4aaeb54009ec303522a3ec4b616d42f1bfc105f9ab6b0da8204f0c6

Contents?: true

Size: 1.35 KB

Versions: 6

Compression:

Stored size: 1.35 KB

Contents

module Fog
  module Parsers
    module AWS
      module Compute
        class DescribeSubnets < Fog::Parsers::Base
          def reset
            @subnet = { 'tagSet' => {} }
            @response = { 'subnetSet' => [] }
            @tag = {}
          end

          def start_element(name, attrs = [])
            super
            case name
            when 'tagSet'
              @in_tag_set = true
            end
          end

          def end_element(name)
            if @in_tag_set
              case name
                when 'item'
                  @subnet['tagSet'][@tag['key']] = @tag['value']
                  @tag = {}
                when 'key', 'value'
                  @tag[name] = value
                when 'tagSet'
                  @in_tag_set = false
              end
            else
              case name
              when 'subnetId', 'state', 'vpcId', 'cidrBlock', 'availableIpAddressCount', 'availabilityZone'
                @subnet[name] = value
              when 'mapPublicIpOnLaunch', 'defaultForAz'
                @subnet[name] = value == 'true' ? true : false
              when 'item'
                @response['subnetSet'] << @subnet
                @subnet = { 'tagSet' => {} }
              when 'requestId'
                @response[name] = value
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fog-aws-3.5.2 lib/fog/aws/parsers/compute/describe_subnets.rb
fog-aws-3.5.1 lib/fog/aws/parsers/compute/describe_subnets.rb
fog-aws-3.5.0 lib/fog/aws/parsers/compute/describe_subnets.rb
fog-aws-3.4.0 lib/fog/aws/parsers/compute/describe_subnets.rb
fog-aws-3.3.0 lib/fog/aws/parsers/compute/describe_subnets.rb
fog-aws-3.2.0 lib/fog/aws/parsers/compute/describe_subnets.rb