Class: RbVmomi::VIM
- Inherits:
-
Connection
- Object
- Connection
- RbVmomi::VIM
- Defined in:
- lib/rbvmomi/vim.rb
Overview
A connection to one vSphere SDK endpoint.
Defined Under Namespace
Classes: ComputeResource, Datacenter, Datastore, Folder, ManagedEntity, ManagedObject, ObjectContent, ObjectUpdate, OvfManager, ResourcePool, ServiceInstance, Task, VirtualMachine
Class Method Summary collapse
-
.connect(opts) ⇒ Object
Connect to a vSphere SDK endpoint.
Instance Method Summary collapse
-
#propertyCollector ⇒ Object
Alias to serviceContent.propertyCollector.
-
#rootFolder ⇒ Object
(also: #root)
Alias to serviceContent.rootFolder.
-
#searchIndex ⇒ Object
Alias to serviceContent.searchIndex.
-
#serviceContent ⇒ Object
Alias to serviceInstance.RetrieveServiceContent.
-
#serviceInstance ⇒ Object
Return the ServiceInstance.
Class Method Details
.connect(opts) ⇒ Object
Connect to a vSphere SDK endpoint
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rbvmomi/vim.rb', line 20 def self.connect opts fail unless opts.is_a? Hash fail "host option required" unless opts[:host] opts[:user] ||= 'root' opts[:password] ||= '' opts[:ssl] = true unless opts.member? :ssl opts[:insecure] ||= false opts[:port] ||= (opts[:ssl] ? 443 : 80) opts[:path] ||= '/sdk' opts[:ns] ||= 'urn:vim25' opts[:rev] = '4.1' opts[:debug] = (!ENV['RBVMOMI_DEBUG'].empty? rescue false) unless opts.member? :debug new(opts).tap do |vim| vim.serviceContent.sessionManager.Login :userName => opts[:user], :password => opts[:password] end end |
Instance Method Details
#propertyCollector ⇒ Object
Alias to serviceContent.propertyCollector
59 60 61 |
# File 'lib/rbvmomi/vim.rb', line 59 def propertyCollector serviceContent.propertyCollector end |
#rootFolder ⇒ Object Also known as: root
Alias to serviceContent.rootFolder
52 53 54 |
# File 'lib/rbvmomi/vim.rb', line 52 def rootFolder serviceContent.rootFolder end |
#searchIndex ⇒ Object
Alias to serviceContent.searchIndex
64 65 66 |
# File 'lib/rbvmomi/vim.rb', line 64 def searchIndex serviceContent.searchIndex end |
#serviceContent ⇒ Object
Alias to serviceInstance.RetrieveServiceContent
47 48 49 |
# File 'lib/rbvmomi/vim.rb', line 47 def serviceContent @serviceContent ||= serviceInstance.RetrieveServiceContent end |
#serviceInstance ⇒ Object
Return the ServiceInstance
The ServiceInstance is the root of the vSphere inventory.
42 43 44 |
# File 'lib/rbvmomi/vim.rb', line 42 def serviceInstance VIM::ServiceInstance self, 'ServiceInstance' end |