2011-08-24 21:11:42 -04:00
|
|
|
require 'fog/vcloud/models/compute/vdc'
|
2011-05-23 21:17:16 -04:00
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Vcloud
|
|
|
|
class Compute
|
|
|
|
|
|
|
|
class Vdcs < Collection
|
|
|
|
|
|
|
|
model Fog::Vcloud::Compute::Vdc
|
|
|
|
|
|
|
|
undef_method :create
|
|
|
|
|
2011-09-27 05:38:09 -04:00
|
|
|
attribute :href
|
|
|
|
|
2011-05-23 21:17:16 -04:00
|
|
|
def all
|
2012-01-30 09:24:14 -05:00
|
|
|
data = connection.get_organization(org_uri).links.select { |link| link[:type] == "application/vnd.vmware.vcloud.vdc+xml" }
|
2011-05-23 21:17:16 -04:00
|
|
|
data.each { |link| link.delete_if { |key, value| [:rel].include?(key) } }
|
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(uri)
|
2012-01-30 09:24:14 -05:00
|
|
|
connection.get_vdc(uri)
|
2011-05-23 21:17:16 -04:00
|
|
|
rescue Fog::Errors::NotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2011-09-27 05:38:09 -04:00
|
|
|
def org_uri
|
|
|
|
self.href ||= connection.default_organization_uri
|
2011-05-23 21:17:16 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|