Sha256: 139894af37dd794d224b431f48a359400d7b7d4e5c16932cddb7fc66e7e54343

Contents?: true

Size: 1.52 KB

Versions: 40

Compression:

Stored size: 1.52 KB

Contents

module Fog
  module Parsers
    module Compute
      module VcloudDirector

        class Disks < VcloudDirectorParser

          def reset
            @disk = {}
            @response = { :disks => [] }
            @host_resource = nil
          end

          def start_element(name, attributes)
            super
            case name
            when 'HostResource'
              @host_resource = extract_attributes(attributes)
            end
          end

          def end_element(name)
            case name
            when 'Address'
              @disk[:address] = value.to_i
            when 'AddressOnParent'
              @disk[:address_on_parent] = value.to_i
            when 'Description'
              @disk[:description] = value
            when 'ElementName'
              @disk[:name] = value
            when 'InstanceID'
              @disk[:id] = value.to_i
            when 'ResourceSubType'
              @disk[:resource_sub_type] = value
            when 'Parent'
              @disk[:parent] = value.to_i
            when 'ResourceType'
              @disk[:resource_type] = value.to_i
            when 'Item'
              if @host_resource
                @disk[:capacity] = @host_resource[:capacity].to_i
                @disk[:bus_sub_type] = @host_resource[:busSubType]
                @disk[:bus_type] = @host_resource[:busType].to_i
              end
              @response[:disks] << @disk
              @host_resource = nil
              @disk = {}
            end
          end

        end

      end
    end
  end
end

Version data entries

40 entries across 40 versions & 2 rubygems

Version Path
fog-1.22.0 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-1.21.0 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-1.20.0 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-1.19.0 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/vcloud_director/parsers/compute/disks.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/vcloud_director/parsers/compute/disks.rb