Class: Virtuozzo::SOAP::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/virtuozzo/soap.rb

Overview

The Connection class provides for establishing of a SOAP session with a Virtuozzo Agent using either an SSL-secured or unsecure HTTP connection. Session data is stored for each Connection instance allowing all messages sent to be properly authenticated according to the Virtuozzo SOAP API specifications.

Instance Method Summary collapse

Constructor Details

#initialize(host, username, password, opts = {}) ⇒ Connection

Establish a new session with the specified host using the supplied credentials and options.

The opts hash may define :debug to be either true, false or the ‘device’ to be used for wiredumps, defaults to false. If set to true STDERR will be used for wiredumps.

The opts hash may define :verify_ssl to be either true or false in regards to whether SSL certificates should be verified for the various SOAP::RPC::Driver connections. The default is false, causing no SSL certificate verification.

The opts hash may define a :realm for authentication. The default is the Virtuozzo system realm represented by the Virtuozzo::DEFAULT_REALM constant.

Parameters:

  • host (String)

    the host to connect to

  • username (String)

    the user to authenticate as

  • password (String)

    the password to use for authentication

  • opts (Hash) (defaults to: {})

    additional options for the connection



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/virtuozzo/soap.rb', line 46

def initialize(host, username, password, opts = {})
  options = {
    :debug => false,
    :verify_ssl => false,
    :realm => Virtuozzo::DEFAULT_REALM
  }.merge(opts)

  @endpoint = host
  @username = username
  @password = password
  @realm    = options[:realm]
  
  @session_id = nil

  disable_ssl_verification unless options[:verify_ssl]
  setup_debug_mode(options[:debug]) if options[:debug]
  establish_session
  setup_header_handler
end

Instance Method Details

#deviceSOAP::RPC::Driver

Handle for the vzadevm interface of the Virtuozzo API.

Returns:

  • (SOAP::RPC::Driver)

    vzadevm SOAP::RPC::Driver instance.



102
103
104
# File 'lib/virtuozzo/soap.rb', line 102

def device
  @device ||= Virtuozzo::SOAP::Drivers::Device.new(@endpoint)
end

#environmentSOAP::RPC::Driver

Handle for the vzaenvm interface of the Virtuozzo API.

Returns:

  • (SOAP::RPC::Driver)

    vzaenvmm SOAP::RPC::Driver instance.



78
79
80
# File 'lib/virtuozzo/soap.rb', line 78

def environment
  @environment ||= Virtuozzo::SOAP::Drivers::Environment.new(@endpoint)
end

#networkSOAP::RPC::Driver

Handle for the vzanetworkm interface of the Virtuozzo API.

Returns:

  • (SOAP::RPC::Driver)

    vzanetworkm SOAP::RPC::Driver instance.



110
111
112
# File 'lib/virtuozzo/soap.rb', line 110

def network
  @network ||= Virtuozzo::SOAP::Drivers::Network.new(@endpoint)
end

#processSOAP::RPC::Driver

Handle for the vzaprocessmm interface of the Virtuozzo API.

Returns:

  • (SOAP::RPC::Driver)

    vzaprocessm SOAP::RPC::Driver instance.



126
127
128
# File 'lib/virtuozzo/soap.rb', line 126

def process
  @process ||= Virtuozzo::SOAP::Drivers::Process.new(@endpoint)
end

#process_infoSOAP::RPC::Driver

Handle for the vzaproc_info interface of the Virtuozzo API.

Returns:

  • (SOAP::RPC::Driver)

    vzaproc_info SOAP::RPC::Driver instance.



118
119
120
# File 'lib/virtuozzo/soap.rb', line 118

def process_info
  @process_info ||= Virtuozzo::SOAP::Drivers::ProcessInfo.new(@endpoint)
end

#relocatorSOAP::RPC::Driver

Handle for the vzarelocator interface of the Virtuozzo API.

Returns:

  • (SOAP::RPC::Driver)

    vzarelocator SOAP::RPC::Driver instance.



94
95
96
# File 'lib/virtuozzo/soap.rb', line 94

def relocator
  @relocator ||= Virtuozzo::SOAP::Drivers::Relocator.new(@endpoint)
end

#sessionSOAP::RPC::Driver

Handle for the sessionm interface of the Virtuozzo API.

Returns:

  • (SOAP::RPC::Driver)

    sessionm SOAP::RPC::Driver instance.



70
71
72
# File 'lib/virtuozzo/soap.rb', line 70

def session
  @session ||= Virtuozzo::SOAP::Drivers::Session.new(@endpoint)
end

#supportSOAP::RPC::Driver

Handle for the vzasupport interface of the Virtuozzo API.

Returns:

  • (SOAP::RPC::Driver)

    vzasupport SOAP::RPC::Driver instance.



142
143
144
# File 'lib/virtuozzo/soap.rb', line 142

def support
  @support ||= Virtuozzo::SOAP::Drivers::Support.new(@endpoint)
end

#templateSOAP::RPC::Driver

Handle for the vzapackagem interface of the Virtuozzo API.

Returns:

  • (SOAP::RPC::Driver)

    vzapackagem SOAP::RPC::Driver instance.



86
87
88
# File 'lib/virtuozzo/soap.rb', line 86

def template
  @template ||= Virtuozzo::SOAP::Drivers::Template.new(@endpoint)
end

#up2dateSOAP::RPC::Driver

Handle for the vzaup2date interface of the Virtuozzo API.

Returns:

  • (SOAP::RPC::Driver)

    vzaup2date SOAP::RPC::Driver instance.



134
135
136
# File 'lib/virtuozzo/soap.rb', line 134

def up2date
  @up2date ||= Virtuozzo::SOAP::Drivers::Up2date.new(@endpoint)
end