A connection to one vSphere SDK endpoint. @see serviceInstance
Connect to a vSphere SDK endpoint
@param [Hash] opts The options hash. @option opts [String] :host Host to connect to. @option opts [Numeric] :port (443) Port to connect to. @option opts [Boolean] :ssl (true) Whether to use SSL. @option opts [Boolean] :insecure (false) If true, ignore SSL certificate errors. @option opts [String] :user (root) Username. @option opts [String] :password Password. @option opts [String] :path (/sdk) SDK endpoint path. @option opts [Boolean] :debug (false) If true, print SOAP traffic to stderr.
# 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 or opts[:"no-ssl"] opts[:insecure] ||= false opts[:port] ||= (opts[:ssl] ? 443 : 80) opts[:path] ||= '/sdk' opts[:ns] ||= 'urn:vim25' rev_given = opts[:rev] != nil opts[:rev] = '4.0' unless rev_given 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] unless rev_given rev = vim.serviceContent.about.apiVersion vim.rev = [rev, '4.1'].min end end end
Directories to search for extensions
# File lib/rbvmomi/vim.rb, line 81 def self.extension_dirs @extension_dirs end
@private
# File lib/rbvmomi/vim.rb, line 74 def pretty_print pp pp.text "VIM(#{@opts[:host]})" end
Alias to serviceContent.propertyCollector
# File lib/rbvmomi/vim.rb, line 64 def propertyCollector serviceContent.propertyCollector end
Alias to serviceContent.rootFolder
# File lib/rbvmomi/vim.rb, line 57 def rootFolder serviceContent.rootFolder end
Alias to serviceContent.searchIndex
# File lib/rbvmomi/vim.rb, line 69 def searchIndex serviceContent.searchIndex end
Alias to serviceInstance.RetrieveServiceContent
# File lib/rbvmomi/vim.rb, line 52 def serviceContent @serviceContent ||= serviceInstance.RetrieveServiceContent end
Return the ServiceInstance
The ServiceInstance is the root of the vSphere inventory. @see www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.ServiceInstance.html
# File lib/rbvmomi/vim.rb, line 47 def serviceInstance VIM::ServiceInstance self, 'ServiceInstance' end