Class: Vcloud::Core::Fog::ModelInterface Private
- Inherits:
-
Object
- Object
- Vcloud::Core::Fog::ModelInterface
- Defined in:
- lib/vcloud/core/fog/model_interface.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Private interface to the fog model layer. You should not use this directly. Expose required functionality in ApiInterface
Instance Method Summary collapse
- #current_organization ⇒ Object private
- #current_vdc(vdc_id) ⇒ Object private
- #get_vm_by_href(href) ⇒ Object private
-
#initialize ⇒ ModelInterface
constructor
private
A new instance of ModelInterface.
- #org_name ⇒ Object private
Constructor Details
#initialize ⇒ ModelInterface
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ModelInterface.
11 12 13 |
# File 'lib/vcloud/core/fog/model_interface.rb', line 11 def initialize @vcloud = ::Fog::Compute::VcloudDirector.new end |
Instance Method Details
#current_organization ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# 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) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# 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) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 30 31 32 33 34 35 36 |
# 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 ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/vcloud/core/fog/model_interface.rb', line 15 def org_name @vcloud.org_name end |