class Vcloud::Core::Fog::ModelInterface

Private interface to the fog model layer. You should not use this directly. Expose required functionality in {Vcloud::Core::ApiInterface}

@api private

Public Class Methods

new() click to toggle source
# File lib/vcloud/core/fog/model_interface.rb, line 11
def initialize
  @vcloud = ::Fog::Compute::VcloudDirector.new
end

Public Instance Methods

current_organization() click to toggle source
# File lib/vcloud/core/fog/model_interface.rb, line 19
def current_organization
  @vcloud.organizations.get_by_name org_name
end
current_vdc(vdc_id) click to toggle source
# File lib/vcloud/core/fog/model_interface.rb, line 23
def current_vdc vdc_id
  current_organization.vdcs.detect { |v| v.id == vdc_id }
end
get_vm_by_href(href) click to toggle source
# File lib/vcloud/core/fog/model_interface.rb, line 27
def get_vm_by_href href
  vm = @vcloud.get_vms_in_lease_from_query(
      {
          :filter => "href==#{href}"
      }).body[:VMRecord].first
  return nil unless vm
  vdc = current_vdc(vm[:vdc].split('/').last)
  vapp = vdc.vapps.get_by_name(vm[:containerName])
  vapp.vms.first
end
org_name() click to toggle source
# File lib/vcloud/core/fog/model_interface.rb, line 15
def org_name
  @vcloud.org_name
end