1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/vcloudng/models/compute/vapps.rb

32 lines
841 B
Ruby
Raw Normal View History

2013-06-20 13:36:34 -04:00
require 'fog/core/collection'
require 'fog/vcloudng/models/compute/vapp'
module Fog
module Compute
class Vcloudng
class Vapps < Collection
2013-06-20 13:36:34 -04:00
model Fog::Compute::Vcloudng::Vapp
attribute :vdc
private
def get_by_id(item_id)
item = service.get_vapp(item_id).body
%w(:Link).each {|key_to_delete| item.delete(key_to_delete) }
service.add_id_from_href!(item)
item
2013-06-20 13:36:34 -04:00
end
def item_list
data = service.get_vdc(vdc.id).body
items = data[:ResourceEntities][:ResourceEntity].select { |link| link[:type] == "application/vnd.vmware.vcloud.vApp+xml" }
items.each{|item| service.add_id_from_href!(item) }
items
2013-06-24 07:46:30 -04:00
end
2013-06-20 13:36:34 -04:00
end
end
end
end