Sha256: be028f9412d7e46e48eabcd251fe325ff289f0a1425ab808757209e5db9f7e7c

Contents?: true

Size: 1.94 KB

Versions: 12

Compression:

Stored size: 1.94 KB

Contents

module Fog
  module Parsers
    module Vcloud
      module Terremark
        module Ecloud

          class GetVdc < Fog::Parsers::Vcloud::Base

            def reset
              @target = nil
              @response = Struct::TmrkEcloudVdc.new([],[],[],Struct::TmrkEcloudXCapacity.new,Struct::TmrkEcloudXCapacity.new,
                                                             Struct::TmrkEcloudXCapacity.new,Struct::TmrkEcloudXCapacity.new,
                                                             Struct::TmrkEcloudXCapacity.new)
            end

            def start_element(name, attributes)
              @value = ''
              case name
              when 'Cpu'
                @target = :cpu_capacity
              when 'DeployedVmsQuota'
                @target = :deployed_vm_quota
              when 'InstantiatedVmsQuota'
                @target = :instantiated_vm_quota
              when 'Memory'
                @target = :memory_capacity
              when 'StorageCapacity'
                @target = :storage_capacity
              when 'Link'
                @response.links << generate_link(attributes)
              when 'Network'
                @response.networks << generate_link(attributes)
              when 'ResourceEntity'
                @response.resource_entities << generate_link(attributes)
              when 'Vdc'
                handle_root(attributes)
              end
            end

            def end_element(name)
              case name
              when 'Allocated', 'Limit', 'Used'
                @response[@target][name.downcase] = @value.to_i
              when 'Units'
                @response[@target][name.downcase] = @value
              when 'Cpu', 'DeployedVmsQuota', 'InstantiatedVmsQuota', 'Memory', 'StorageCapacity'
                @target = nil
              when 'Description'
                @response.description = @value
              end
            end

          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
fog-0.1.4 lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb
fog-0.1.3 lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb
fog-0.1.2 lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb
fog-0.1.1 lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb
fog-0.1.0 lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb
fog-0.0.100 lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb
fog-0.0.99 lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb
fog-0.0.98 lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb
fog-0.0.97 lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb
fog-0.0.96 lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb
fog-0.0.95 lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb
fog-0.0.94 lib/fog/vcloud/terremark/ecloud/parsers/get_vdc.rb