2013-10-08 13:46:06 -04:00
|
|
|
class VcloudDirector
|
|
|
|
module Compute
|
|
|
|
module Helper
|
|
|
|
|
2013-10-13 01:30:38 -04:00
|
|
|
def self.test_name
|
|
|
|
@test_name ||= 'fog-test-%x' % Time.now.to_i
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.fixture(filename)
|
|
|
|
File.join(File.expand_path('../../../fixtures', __FILE__), filename)
|
|
|
|
end
|
|
|
|
|
2013-10-08 13:46:06 -04:00
|
|
|
def self.current_org(service)
|
2013-10-20 14:52:14 -04:00
|
|
|
service.get_organization(current_org_id(service)).body
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.current_org_id(service)
|
2013-10-08 13:46:06 -04:00
|
|
|
session = service.get_current_session.body
|
|
|
|
link = session[:Link].detect do |l|
|
|
|
|
l[:type] == 'application/vnd.vmware.vcloud.org+xml'
|
|
|
|
end
|
2013-10-20 14:52:14 -04:00
|
|
|
link[:href].split('/').last
|
2013-10-08 13:46:06 -04:00
|
|
|
end
|
|
|
|
|
2013-10-13 01:30:38 -04:00
|
|
|
def self.first_vdc_id(org)
|
|
|
|
link = org[:Link].detect do |l|
|
|
|
|
l[:type] == 'application/vnd.vmware.vcloud.vdc+xml'
|
|
|
|
end
|
|
|
|
link[:href].split('/').last
|
|
|
|
end
|
|
|
|
|
2013-10-08 13:46:06 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|