2011-09-26 04:54:36 -04:00
|
|
|
require 'fog/vcloud/models/compute/organization'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Vcloud
|
|
|
|
class Compute
|
|
|
|
class Organizations < Collection
|
|
|
|
model Fog::Vcloud::Compute::Organization
|
|
|
|
|
|
|
|
undef_method :create
|
|
|
|
|
|
|
|
def all
|
2012-12-22 18:22:50 -05:00
|
|
|
raw_orgs = if service.version == '1.0'
|
|
|
|
service.login
|
2012-01-30 12:35:42 -05:00
|
|
|
else
|
2012-12-22 18:22:50 -05:00
|
|
|
service.request(service.basic_request_params("#{service.base_path_url}/org/"))
|
2012-01-30 12:35:42 -05:00
|
|
|
end
|
2012-08-05 10:51:59 -04:00
|
|
|
data = raw_orgs.body[:Org]
|
2011-09-26 04:54:36 -04:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(uri)
|
2012-12-22 18:22:50 -05:00
|
|
|
service.get_organization(uri)
|
2011-09-26 04:54:36 -04:00
|
|
|
rescue Fog::Errors::NotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|