Sha256: 8351730c14daaaedd6be3b83e023746d7cb8f239bcdecbf5775915535ce84a48

Contents?: true

Size: 1.24 KB

Versions: 11

Compression:

Stored size: 1.24 KB

Contents

module Fog
  module Parsers
    module Compute
      module AWS
        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 'item'
                @response['subnetSet'] << @subnet
                @subnet = { 'tagSet' => {} }
              when 'requestId'
                @response[name] = value
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/aws/parsers/compute/describe_subnets.rb
ns-fog-1.22.11 lib/fog/aws/parsers/compute/describe_subnets.rb
ns-fog-1.22.10 lib/fog/aws/parsers/compute/describe_subnets.rb
ns-fog-1.22.9 lib/fog/aws/parsers/compute/describe_subnets.rb
ns-fog-1.22.8 lib/fog/aws/parsers/compute/describe_subnets.rb
ns-fog-1.22.7 lib/fog/aws/parsers/compute/describe_subnets.rb
ns-fog-1.22.6 lib/fog/aws/parsers/compute/describe_subnets.rb
ns-fog-1.22.4 lib/fog/aws/parsers/compute/describe_subnets.rb
ns-fog-1.22.3 lib/fog/aws/parsers/compute/describe_subnets.rb
ns-fog-1.22.2 lib/fog/aws/parsers/compute/describe_subnets.rb
fog-1.22.1 lib/fog/aws/parsers/compute/describe_subnets.rb