diff --git a/lib/fog/vcloudng/models/compute/vdc.rb b/lib/fog/vcloudng/models/compute/vdc.rb index 2b2d7d891..9eaf230ec 100644 --- a/lib/fog/vcloudng/models/compute/vdc.rb +++ b/lib/fog/vcloudng/models/compute/vdc.rb @@ -11,10 +11,21 @@ module Fog attribute :name attribute :type attribute :href - attribute :description, :aliases => 'Description' - attribute :available_networks, :aliases => 'AvailableNetworks' - attribute :compute_capacity , :aliases => 'ComputeCapacity' - attribute :storage_capacity , :aliases => 'StorageCapacity' + attribute :description, :aliases => :Description + attribute :available_networks, :aliases => :AvailableNetworks + attribute :compute_capacity , :aliases => :ComputeCapacity + attribute :storage_capacity , :aliases => :StorageCapacity + attribute :allocation_model, :aliases => :AllocationModel + attribute :capabilities, :aliases => :Capabilities + attribute :nic_quota, :aliases => :NicQuota, :type => :integer + attribute :network_quota ,:aliases => :NetworkQuota, :type => :integer + attribute :vm_quota ,:aliases => :VmQuota, :type => :integer + attribute :is_enabled ,:aliases => :IsEnabled, :type => :boolean + + def vapps + requires :id + service.vdcs(:vdc => self) + end end end diff --git a/lib/fog/vcloudng/models/compute/vdcs.rb b/lib/fog/vcloudng/models/compute/vdcs.rb index a92cc4340..c4386d464 100644 --- a/lib/fog/vcloudng/models/compute/vdcs.rb +++ b/lib/fog/vcloudng/models/compute/vdcs.rb @@ -12,14 +12,15 @@ module Fog def all(organization_id = organization.id) data = service.get_organization(organization_id).body - vdcs = data["Links"].select { |link| link["type"] == "application/vnd.vmware.vcloud.vdc+xml" } - vdc_ids = vdcs.map {|vdc| vdc['href'].split('/').last } + vdcs = data[:Link].select { |link| link[:type] == "application/vnd.vmware.vcloud.vdc+xml" } + vdc_ids = vdcs.map {|vdc| vdc[:href].split('/').last } vdc_ids.map{ |vdc_id| get(vdc_id)} end def get(vdc_id) data = service.get_vdc(vdc_id).body - %w(VdcItems Links).each {|key_to_delete| data.delete(key_to_delete) } + data[:id] = data[:href].split('/').last + %w(:VdcItems :Link :ResourceEntities).each {|key_to_delete| data.delete(key_to_delete) } new(data) end end diff --git a/lib/fog/vcloudng/requests/compute/get_vdc.rb b/lib/fog/vcloudng/requests/compute/get_vdc.rb index b0f5af86f..22058a403 100644 --- a/lib/fog/vcloudng/requests/compute/get_vdc.rb +++ b/lib/fog/vcloudng/requests/compute/get_vdc.rb @@ -35,7 +35,7 @@ module Fog :expects => 200, :headers => { 'Accept' => 'application/*+xml;version=1.5' }, :method => 'GET', - :parser => Fog::Parsers::Compute::Vcloudng::GetVdc.new, + :parser => Fog::ToHashDocument.new, :path => "vdc/#{vdc_id}" ) end