Class List Method List File List

# Class: Com::Vmware::Vcenter::Host

Inherits:
  VAPI::Bindings::VapiService
  - Object
  - VAPI::Bindings::VapiService
  - Com::Vmware::Vcenter::Host
  show all
Defined in:
  /build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb

## Overview

The ``Com::Vmware::Vcenter::Host`` class provides methods to manage hosts in the vCenter Server.

## Defined Under Namespace

Classes: ConnectionState, CreateSpec, FilterSpec, PowerState, Summary

## Constant Summary

RESOURCE_TYPE =

      'HostSystem'

## Instance Method Summary (collapse)

- - (Void) connect(host)

  Connect to the host corresponding to ``host`` previously added to the vCenter server.

- - (String) create(spec)

  Add a new standalone host in the vCenter inventory.

- - (Void) delete(host)

  Remove a standalone host from the vCenter Server.

- - (Void) disconnect(host)

  Disconnect the host corresponding to ``host`` from the vCenter server.

- - (Host) initialize(config) constructor

  Constructs a new instance.

- - (Array<Com::Vmware::Vcenter::Host::Summary>) list(filter = nil)

  Returns information about at most 1000 visible (subject to permission checks) hosts in vCenter matching the :class:`Com::Vmware::Vcenter::Host::FilterSpec` .

## Constructor Details

### - (`Host`) initialize(config)

Constructs a new instance.

Parameters:

- config (`VAPI::Bindings::StubConfig`) —

  A hash with the api provider details.

    1384
    1385
    1386
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 1384

    def initialize(config)
        super(config, @@service_info)
    end

## Instance Method Details

### - (`Void`) connect(host)

Connect to the host corresponding to ``host`` previously added to the vCenter server.

Parameters:

- host (`String`) —

  Identifier of the host to be reconnected.

Returns:

- (`Void`)

Raises:

- (`Com::Vmware::Vapi::Std::Errors::AlreadyInDesiredState`) —

  if the host associated with ``host`` is already connected.

- (`Com::Vmware::Vapi::Std::Errors::Error`) —

  if the system reports an error while responding to the request.

- (`Com::Vmware::Vapi::Std::Errors::NotFound`) —

  if there is no host associated with ``host`` in the system.

- (`Com::Vmware::Vapi::Std::Errors::ServiceUnavailable`) —

  if the system is unable to communicate with a service to complete the request.

- (`Com::Vmware::Vapi::Std::Errors::Unauthenticated`) —

  if the user can not be authenticated.

- (`Com::Vmware::Vapi::Std::Errors::Unauthorized`) —

  if the user doesn’t have the required privileges.

    1497
    1498
    1499
    1500
    1501
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 1497

    def connect(host)
        invoke_with_info(@@connect_info, {
            'host' => host,
        })
    end

### - (`String`) create(spec)

Add a new standalone host in the vCenter inventory. The newly connected host will be in connected state. The vCenter Server will verify the SSL certificate before adding the host to its inventory. In the case where the SSL certificate cannot be verified because the Certificate Authority is not recognized or the certificate is self signed, the vCenter Server will fall back to thumbprint verification mode as defined by :class:`Com::Vmware::Vcenter::Host::CreateSpec::ThumbprintVerification` .

Parameters:

- spec (`Com::Vmware::Vcenter::Host::CreateSpec`) —

  Specification for the new host to be created.

Returns:

- (`String`) —

  The newly created identifier of the host in vCenter.

Raises:

- (`Com::Vmware::Vapi::Std::Errors::AlreadyExists`) —

  if the host with the same name is already present.

- (`Com::Vmware::Vapi::Std::Errors::Error`) —

  if installation of VirtualCenter agent on a host fails.

- (`Com::Vmware::Vapi::Std::Errors::Error`) —

  if the system reports an error while responding to the request.

- (`Com::Vmware::Vapi::Std::Errors::InvalidArgument`) —

  if the host name is invalid.

- (`Com::Vmware::Vapi::Std::Errors::InvalidArgument`) —

  if the host folder is invalid.

- (`Com::Vmware::Vapi::Std::Errors::InvalidArgument`) —

  if the SSL thumbprint specified is invalid.

- (`Com::Vmware::Vapi::Std::Errors::InvalidElementType`) —

  if the host folder id does not support vSphere compute resource as its children type.

- (`Com::Vmware::Vapi::Std::Errors::ResourceInUse`) —

  if the host is already being managed by another vCenter Server

- (`Com::Vmware::Vapi::Std::Errors::UnableToAllocateResource`) —

  if there are not enough licenses to add the host.

- (`Com::Vmware::Vapi::Std::Errors::Unauthenticated`) —

  if the user name or password for the administration account on the host are invalid.

- (`Com::Vmware::Vapi::Std::Errors::Unauthenticated`) —

  if the user can not be authenticated.

- (`Com::Vmware::Vapi::Std::Errors::Unsupported`) —

  if the software version on the host is not supported.

- (`Com::Vmware::Vapi::Std::Errors::ServiceUnavailable`) —

  if the system is unable to communicate with a service to complete the request.

- (`Com::Vmware::Vapi::Std::Errors::Unauthorized`) —

  if the user doesn’t have the required privileges.

    1425
    1426
    1427
    1428
    1429
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 1425

    def create(spec)
        invoke_with_info(@@create_info, {
            'spec' => spec,
        })
    end

### - (`Void`) delete(host)

Remove a standalone host from the vCenter Server.

Parameters:

- host (`String`) —

  Identifier of the host to be deleted.

Returns:

- (`Void`)

Raises:

- (`Com::Vmware::Vapi::Std::Errors::Error`) —

  if the system reports an error while responding to the request.

- (`Com::Vmware::Vapi::Std::Errors::NotFound`) —

  if there is no host associated with ``host`` in the system.

- (`Com::Vmware::Vapi::Std::Errors::ResourceInUse`) —

  if the host associated with ``host`` is in a vCenter cluster

- (`Com::Vmware::Vapi::Std::Errors::ServiceUnavailable`) —

  if the system is unable to communicate with a service to complete the request.

- (`Com::Vmware::Vapi::Std::Errors::Unauthenticated`) —

  if the user can not be authenticated.

- (`Com::Vmware::Vapi::Std::Errors::Unauthorized`) —

  if the user doesn’t have the required privileges.

    1449
    1450
    1451
    1452
    1453
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 1449

    def delete(host)
        invoke_with_info(@@delete_info, {
            'host' => host,
        })
    end

### - (`Void`) disconnect(host)

Disconnect the host corresponding to ``host`` from the vCenter server

Parameters:

- host (`String`) —

  Identifier of the host to be disconnected.

Returns:

- (`Void`)

Raises:

- (`Com::Vmware::Vapi::Std::Errors::AlreadyInDesiredState`) —

  if the host associated with ``host`` is already disconnected.

- (`Com::Vmware::Vapi::Std::Errors::Error`) —

  if the system reports an error while responding to the request.

- (`Com::Vmware::Vapi::Std::Errors::NotFound`) —

  if there is no host associated with ``host`` in the system.

- (`Com::Vmware::Vapi::Std::Errors::ServiceUnavailable`) —

  if the system is unable to communicate with a service to complete the request.

- (`Com::Vmware::Vapi::Std::Errors::Unauthenticated`) —

  if the user can not be authenticated.

- (`Com::Vmware::Vapi::Std::Errors::Unauthorized`) —

  if the user doesn’t have the required privileges.

    1521
    1522
    1523
    1524
    1525
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 1521

    def disconnect(host)
        invoke_with_info(@@disconnect_info, {
            'host' => host,
        })
    end

### - (`Array<Com::Vmware::Vcenter::Host::Summary>`) list(filter = nil)

Returns information about at most 1000 visible (subject to permission checks) hosts in vCenter matching the :class:`Com::Vmware::Vcenter::Host::FilterSpec` .

Parameters:

- filter (`Com::Vmware::Vcenter::Host::FilterSpec`, `nil`) (defaults to: `nil`) —

  Specification of matching hosts for which information should be returned. If nil , the behavior is equivalent to a :class:`Com::Vmware::Vcenter::Host::FilterSpec` with all fields nil which means all hosts match the filter.

Returns:

- (`Array<Com::Vmware::Vcenter::Host::Summary>`) —

  Commonly used information about the hosts matching the :class:`Com::Vmware::Vcenter::Host::FilterSpec` .

Raises:

- (`Com::Vmware::Vapi::Std::Errors::InvalidArgument`) —

  if the :attr:`Com::Vmware::Vcenter::Host::FilterSpec.connection_states` field contains a value that is not supported by the server.

- (`Com::Vmware::Vapi::Std::Errors::UnableToAllocateResource`) —

  if more than 1000 hosts match the :class:`Com::Vmware::Vcenter::Host::FilterSpec` .

- (`Com::Vmware::Vapi::Std::Errors::ServiceUnavailable`) —

  if the system is unable to communicate with a service to complete the request.

- (`Com::Vmware::Vapi::Std::Errors::Unauthenticated`) —

  if the user can not be authenticated.

- (`Com::Vmware::Vapi::Std::Errors::Unauthorized`) —

  if the user doesn’t have the required privileges.

    1473
    1474
    1475
    1476
    1477
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 1473

    def list(filter=nil)
        invoke_with_info(@@list_info, {
            'filter' => filter,
        })
    end