Sha256: 5ed3333a4075d56542a4ae616aacaff014f1abc9c93881f5d385205ecbeb06f2

Contents?: true

Size: 1.82 KB

Versions: 26

Compression:

Stored size: 1.82 KB

Contents

# Copyright (c) 2013-2017 VMware, Inc.  All Rights Reserved.
# SPDX-License-Identifier: MIT

require 'rbvmomi'
module RbVmomi

# A connection to one vSphere SMS endpoint.
# @see #serviceInstance
class SMS < Connection
  # Connect to a vSphere SMS endpoint
  #
  # @param [VIM] Connection to main vSphere API 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]  :path (/sms/sdk) SDK endpoint path.
  # @option opts [Boolean] :debug (false) If true, print SOAP traffic to stderr.
  def self.connect vim, opts = {}
    fail unless opts.is_a? Hash
    opts[:host] = vim.host
    opts[:ssl] = true unless opts.member? :ssl or opts[:"no-ssl"]
    opts[:insecure] ||= true
    opts[:port] ||= (opts[:ssl] ? 443 : 80)
    opts[:path] ||= '/sms/sdk'
    opts[:ns] ||= 'urn:sms'
    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 |sms|
      sms.vcSessionCookie = vim.cookie.split('"')[1]
    end
  end

  def vcSessionCookie= cookie
    @vcSessionCookie = cookie
  end

  def rev= x
    super
    @serviceContent = nil
  end

  # Return the ServiceInstance
  #
  # The ServiceInstance is the root of the vSphere inventory.
  def serviceInstance
    @serviceInstance ||= VIM::SmsServiceInstance self, 'ServiceInstance'
  end

  # @private
  def pretty_print pp
    pp.text "SMS(#{@opts[:host]})"
  end

  add_extension_dir File.join(File.dirname(__FILE__), "sms")
  load_vmodl(ENV['VMODL'] || File.join(File.dirname(__FILE__), "../../vmodl.db"))
end

end

Version data entries

26 entries across 24 versions & 2 rubygems

Version Path
rbvmomi-2.4.1 lib/rbvmomi/sms.rb
rbvmomi-2.4.0 lib/rbvmomi/sms.rb
rbvmomi-2.3.1 lib/rbvmomi/sms.rb
rbvmomi-2.3.0 lib/rbvmomi/sms.rb
rbvmomi-2.3.0.beta1 lib/rbvmomi/sms.rb
rbvmomi-2.2.0 lib/rbvmomi/sms.rb
rbvmomi-2.1.2 lib/rbvmomi/sms.rb
rbvmomi-2.1.1 lib/rbvmomi/sms.rb
rbvmomi-2.1.0 lib/rbvmomi/sms.rb
rbvmomi-2.0.1 lib/rbvmomi/sms.rb
rbvmomi-2.0.0 lib/rbvmomi/sms.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/rbvmomi-1.13.0/lib/rbvmomi/sms.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/rbvmomi-1.13.0/lib/rbvmomi/sms.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/rbvmomi-1.13.0/lib/rbvmomi/sms.rb
rbvmomi-1.13.0 lib/rbvmomi/sms.rb
rbvmomi-1.12.0 lib/rbvmomi/sms.rb
rbvmomi-1.11.7 lib/rbvmomi/sms.rb
rbvmomi-1.11.6 lib/rbvmomi/sms.rb
rbvmomi-1.11.5 lib/rbvmomi/sms.rb
rbvmomi-1.11.4 lib/rbvmomi/sms.rb