Class: Fog::Parsers::Vcloud::GetVdc
- Defined in:
- lib/fog/vcloud/parsers/get_vdc.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #end_element(name) ⇒ Object
-
#reset ⇒ Object
WARNING: Incomplete Based off of: vCloud API Guide v0.9 - Page 27.
- #start_element(name, attributes) ⇒ Object
Methods inherited from Base
Constructor Details
This class inherits a constructor from Fog::Parsers::Base
Instance Method Details
#end_element(name) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/fog/vcloud/parsers/get_vdc.rb', line 41 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 "AllocationModel" @response.allocation_model = @value when "Description" @response.description = @value when "NicQuota", "VmQuota", "NetworkQuota" @response[@target] = @value.to_i when 'IsEnabled' @response.enabled = (@value == 'true' ? true : false) end end |
#reset ⇒ Object
WARNING: Incomplete Based off of: vCloud API Guide v0.9 - Page 27
10 11 12 13 |
# File 'lib/fog/vcloud/parsers/get_vdc.rb', line 10 def reset @target = nil @response = Struct::VcloudVdc.new([],[],[],Struct::VcloudXCapacity.new,Struct::VcloudXCapacity.new,Struct::VcloudXCapacity.new) end |
#start_element(name, attributes) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fog/vcloud/parsers/get_vdc.rb', line 15 def start_element(name, attributes) @value = '' case name when 'Cpu' @target = :cpu_capacity when 'Memory' @target = :memory_capacity when 'StorageCapacity' @target = :storage_capacity when 'NetworkQuota' @target = :network_quota when 'VmQuota' @target = :vm_quota when 'NicQuota' @target = :nic_quota when 'Link' @response.links << generate_link(attributes) when 'ResourceEntity' @response.resource_entities << generate_link(attributes) when 'Network' @response.networks << generate_link(attributes) when 'Vdc' handle_root(attributes) end end |