Class List Method List File List

# Class: Com::Vmware::Vcenter::VM

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

## Overview

The ``Com::Vmware::Vcenter::VM`` class provides methods for managing the lifecycle of a virtual machine.

## Defined Under Namespace

Classes: CreateSpec, FilterSpec, Info, PlacementSpec, Summary

## Instance Method Summary (collapse)

- - (String) create(spec)

  Creates a virtual machine.

- - (Void) delete(vm)

  Deletes a virtual machine.

- - (Com::Vmware::Vcenter::VM::Info) get(vm)

  Returns information about a virtual machine.

- - (VM) initialize(config) constructor

  Constructs a new instance.

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

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

## Constructor Details

### - (`VM`) initialize(config)

Constructs a new instance.

Parameters:

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

  A hash with the api provider details.

    2488
    2489
    2490
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 2488

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

## Instance Method Details

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

Creates a virtual machine.

Parameters:

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

  Virtual machine specification.

Returns:

- (`String`) —

  ID of newly-created virtual machine.

Raises:

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

  if a virtual machine with the specified name already exists.

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

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

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

  if any of the specified parameters are invalid.

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

  if any of the resources specified in spec could not be found

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

  if a specified resource (eg. host) is not accessible.

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

  if any of the specified storage addresses (eg. IDE, SATA, SCSI) result in a storage address conflict.

- (`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::UnableToAllocateResource`) —

  if any of the resources needed to create the virtual machine could not be allocated.

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

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

  if ``guestOS`` is not supported for the requested virtual hardware version and spec includes nil fields that default to guest-specific values.

    2521
    2522
    2523
    2524
    2525
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 2521

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

### - (`Void`) delete(vm)

Deletes a 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::ResourceBusy`) —

  if the virtual machine is busy performing another operation.

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

  if the virtual machine’s configuration 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.

    2572
    2573
    2574
    2575
    2576
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 2572

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

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

Returns information about a virtual machine.

Parameters:

- vm (`String`) —

  Virtual machine identifier.

Returns:

- (`Com::Vmware::Vcenter::VM::Info`) —

  Information about 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 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.

    2546
    2547
    2548
    2549
    2550
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 2546

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

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

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

Parameters:

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

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

Returns:

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

  Commonly used information about the virtual machines matching the :class:`Com::Vmware::Vcenter::VM::FilterSpec` .

Raises:

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

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

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

  if more than 1000 virtual machines match the :class:`Com::Vmware::Vcenter::VM::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.

    2596
    2597
    2598
    2599
    2600
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 2596

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