Class List Method List File List

# Class: Com::Vmware::Vcenter::Vm::Power

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

## Overview

The ``Com::Vmware::Vcenter::Vm::Power`` class provides methods for managing the power state of a virtual machine.

## Defined Under Namespace

Classes: Info, State

## Instance Method Summary (collapse)

- - (Com::Vmware::Vcenter::Vm::Power::Info) get(vm)

  Returns the power state information of a virtual machine.

- - (Power) initialize(config) constructor

  Constructs a new instance.

- - (Void) reset(vm)

  Resets a powered-on virtual machine.

- - (Void) start(vm)

  Powers on a powered-off or suspended virtual machine.

- - (Void) stop(vm)

  Powers off a powered-on or suspended virtual machine.

- - (Void) suspend(vm)

  Suspends a powered-on virtual machine.

## Constructor Details

### - (`Power`) initialize(config)

Constructs a new instance.

Parameters:

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

  A hash with the api provider details.

    686
    687
    688
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter/vm.rb', line 686

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

## Instance Method Details

### - (`Com::Vmware::Vcenter::Vm::Power::Info`) get(vm)

Returns the power state information of a virtual machine.

Parameters:

- vm (`String`) —

  Virtual machine identifier.

Returns:

- (`Com::Vmware::Vcenter::Vm::Power::Info`) —

  Power state information for the specified virtual machine.

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 the virtual machine is not found.

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

  if the virtual machine’s configuration or execution state cannot be accessed.

- (`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.

    709
    710
    711
    712
    713
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter/vm.rb', line 709

    def get(vm)
        invoke_with_info(@@get_info, {
            'vm' => vm,
        })
    end

### - (`Void`) reset(vm)

Resets a powered-on virtual machine.

Parameters:

- vm (`String`) —

  Virtual machine identifier.

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 the virtual machine is not found.

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

  if the virtual machine is powered off or suspended.

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

  if the virtual machine is performing another operation

- (`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.

    823
    824
    825
    826
    827
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter/vm.rb', line 823

    def reset(vm)
        invoke_with_info(@@reset_info, {
            'vm' => vm,
        })
    end

### - (`Void`) start(vm)

Powers on a powered-off or suspended virtual machine.

Parameters:

- vm (`String`) —

  Virtual machine identifier.

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 the virtual machine is not found.

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

  if the virtual machine is already powered on.

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

  if the virtual machine does not support being powered on (e.g. marked as a template, serving as a fault-tolerance secondary virtual machine).

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

  if resources cannot be allocated for the virtual machine (e.g. physical resource allocation policy cannot be satisfied, insufficient licenses are available to run the virtual machine).

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

  if resources required by the virtual machine are not accessible (e.g. virtual machine configuration files or virtual disks are on inaccessible storage, no hosts are available to run the virtual machine).

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

  if resources required by the virtual machine are in use (e.g. virtual machine configuration files or virtual disks are locked, host containing the virtual machine is an HA failover host).

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

  if the virtual machine is performing another operation.

- (`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.

    743
    744
    745
    746
    747
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter/vm.rb', line 743

    def start(vm)
        invoke_with_info(@@start_info, {
            'vm' => vm,
        })
    end

### - (`Void`) stop(vm)

Powers off a powered-on or suspended virtual machine.

Parameters:

- vm (`String`) —

  Virtual machine identifier.

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 the virtual machine is not found.

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

  if the virtual machine is already powered off.

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

  if the virtual machine is performing another operation.

- (`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.

    769
    770
    771
    772
    773
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter/vm.rb', line 769

    def stop(vm)
        invoke_with_info(@@stop_info, {
            'vm' => vm,
        })
    end

### - (`Void`) suspend(vm)

Suspends a powered-on virtual machine.

Parameters:

- vm (`String`) —

  Virtual machine identifier.

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 the virtual machine is not found.

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

  if the virtual machine is already suspended.

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

  if the virtual machine is powered off.

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

  if the virtual machine is performing another operation.

- (`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.

    797
    798
    799
    800
    801
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter/vm.rb', line 797

    def suspend(vm)
        invoke_with_info(@@suspend_info, {
            'vm' => vm,
        })
    end