Class List Method List File List

# Class: Com::Vmware::Vcenter::Datacenter

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

## Overview

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

## Defined Under Namespace

Classes: CreateSpec, FilterSpec, Info, Summary

## Constant Summary

RESOURCE_TYPE =

      'Datacenter'

## Instance Method Summary (collapse)

- - (String) create(spec)

  Create a new datacenter in the vCenter inventory.

- - (Void) delete(datacenter, force = nil)

  Delete an empty datacenter from the vCenter Server.

- - (Com::Vmware::Vcenter::Datacenter::Info) get(datacenter)

  Retrieves information about the datacenter corresponding to ``datacenter`` .

- - (Datacenter) initialize(config) constructor

  Constructs a new instance.

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

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

## Constructor Details

### - (`Datacenter`) initialize(config)

Constructs a new instance.

Parameters:

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

  A hash with the api provider details.

    349
    350
    351
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 349

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

## Instance Method Details

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

Create a new datacenter in the vCenter inventory

Parameters:

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

  Specification for the new datacenter to be created.

Returns:

- (`String`) —

  The identifier of the newly created datacenter

Raises:

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

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

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

  if the datacenter with the same name is already present.

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

  if the datacenter name is empty or invalid as per the underlying implementation.

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

  if the folder is not specified and the system cannot choose a suitable one.

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

  if the datacenter folder cannot be found.

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

    378
    379
    380
    381
    382
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 378

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

### - (`Void`) delete(datacenter, force = nil)

Delete an empty datacenter from the vCenter Server

Parameters:

- datacenter (`String`) —

  Identifier of the datacenter to be deleted.

- force (`Boolean`, `nil`) (defaults to: `nil`) —

  If true, delete the datacenter even if it is not empty. If nil a :class:`Com::Vmware::Vapi::Std::Errors::ResourceInUse` error will be reported if the datacenter is not empty. This is the equivalent of passing the value false.

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 datacenter associated with ``datacenter`` in the system.

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

  if the datacenter associated with ``datacenter`` is not empty.

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

    405
    406
    407
    408
    409
    410
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 405

    def delete(datacenter, force=nil)
        invoke_with_info(@@delete_info, {
            'datacenter' => datacenter,
            'force' => force,
        })
    end

### - (`Com::Vmware::Vcenter::Datacenter::Info`) get(datacenter)

Retrieves information about the datacenter corresponding to ``datacenter`` .

Parameters:

- datacenter (`String`) —

  Identifier of the datacenter.

Returns:

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

  The :class:`Com::Vmware::Vcenter::Datacenter::Info` instances that corresponds to the ``datacenter`` .

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 datacenter associated with ``datacenter`` 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.

    451
    452
    453
    454
    455
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 451

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

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

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

Parameters:

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

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

Returns:

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

  Commonly used information about the datacenters matching the :class:`Com::Vmware::Vcenter::Datacenter::FilterSpec` .

Raises:

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

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

    428
    429
    430
    431
    432
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/vcenter.rb', line 428

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