Class List Method List File List

# Class: Com::Vmware::Appliance::Vmon::Service

Inherits:
  VAPI::Bindings::VapiService
  - Object
  - VAPI::Bindings::VapiService
  - Com::Vmware::Appliance::Vmon::Service
  show all
Defined in:
  /build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/appliance/vmon.rb

## Overview

The ``Com::Vmware::Appliance::Vmon::Service`` class provides methods to manage a single/set of services that are managed by vMon.

## Defined Under Namespace

Classes: Health, Info, StartupType, State, UpdateSpec

## Instance Method Summary (collapse)

- - (Com::Vmware::Appliance::Vmon::Service::Info) get(service)

  Returns the state of a service.

- - (Service) initialize(config) constructor

  Constructs a new instance.

- - (Hash<String, Com::Vmware::Appliance::Vmon::Service::Info>) list_details

  Lists details of services managed by vMon.

- - (Void) restart(service)

  Restarts a service.

- - (Void) start(service)

  Starts a service.

- - (Void) stop(service)

  Stops a service.

- - (Void) update(service, spec)

  Updates the properties of a service.

## Constructor Details

### - (`Service`) initialize(config)

Constructs a new instance.

Parameters:

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

  A hash with the api provider details.

    127
    128
    129
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/appliance/vmon.rb', line 127

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

## Instance Method Details

### - (`Com::Vmware::Appliance::Vmon::Service::Info`) get(service)

Returns the state of a service.

Parameters:

- service (`String`) —

  identifier of the service whose state is being queried.

Returns:

- (`Com::Vmware::Appliance::Vmon::Service::Info`) —

  Service Info structure.

Raises:

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

  if the service associated with ``service`` does not exist.

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

  if any other error occurs during the execution of the operation.

    204
    205
    206
    207
    208
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/appliance/vmon.rb', line 204

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

### - (`Hash<String, Com::Vmware::Appliance::Vmon::Service::Info>`) list_details

Lists details of services managed by vMon.

Returns:

- (`Hash<String, Com::Vmware::Appliance::Vmon::Service::Info>`) —

  Map of service identifiers to service Info structures.

Raises:

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

  if any error occurs during the execution of the operation.

    240
    241
    242
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/appliance/vmon.rb', line 240

    def list_details()
        invoke_with_info(@@list_details_info)
    end

### - (`Void`) restart(service)

Restarts a service

Parameters:

- service (`String`) —

  identifier of the service to restart

Returns:

- (`Void`)

Raises:

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

  if the service associated with ``service`` does not exist.

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

  if any timeout occurs during the execution of the restart operation.

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

  if the operation is denied in the current state of the service. If a stop or start operation is in progress, issuing a restart operation will lead to this error.

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

  if a restart operation is issued on a service which has startup type :attr:`Com::Vmware::Appliance::Vmon::Service::StartupType.DISABLED`

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

  if any other error occurs during the execution of the operation.

    187
    188
    189
    190
    191
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/appliance/vmon.rb', line 187

    def restart(service)
        invoke_with_info(@@restart_info, {
            'service' => service,
        })
    end

### - (`Void`) start(service)

Starts a service

Parameters:

- service (`String`) —

  identifier of the service to start

Returns:

- (`Void`)

Raises:

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

  if the service associated with ``service`` does not exist.

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

  if the operation is denied in the current state of the service. If a stop or restart operation is in progress, the start operation will not be allowed.

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

  if start operation is issued on a service which has startup type :attr:`Com::Vmware::Appliance::Vmon::Service::StartupType.DISABLED` .

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

  if any timeout occurs during the execution of the start operation. Timeout occurs when the service takes longer than StartTimeout to start.

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

  if any other error occurs during the execution of the operation.

    147
    148
    149
    150
    151
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/appliance/vmon.rb', line 147

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

### - (`Void`) stop(service)

Stops a service

Parameters:

- service (`String`) —

  identifier of the service to stop

Returns:

- (`Void`)

Raises:

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

  if the service associated with ``service`` does not exist.

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

  if any other error occurs during the execution of the operation.

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

  if the operation is denied in the current state of the service. If a stop operation is in progress, issuing another stop operation will lead to this error.

    165
    166
    167
    168
    169
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/appliance/vmon.rb', line 165

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

### - (`Void`) update(service, spec)

Updates the properties of a service.

Parameters:

- service (`String`) —

  identifier of the service whose properties are being updated.

- spec (`Com::Vmware::Appliance::Vmon::Service::UpdateSpec`) —

  Service Update specification.

Returns:

- (`Void`)

Raises:

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

  if the service associated with ``service`` does not exist.

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

  if any other error occurs during the execution of the operation.

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

  if the operation is denied in the current state of the service. If a start, stop or restart operation is in progress, update operation will fail with this error.

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

  if a request to set the :attr:`Com::Vmware::Appliance::Vmon::Service::UpdateSpec.startup_type` field of ``spec`` to :attr:`Com::Vmware::Appliance::Vmon::Service::StartupType.DISABLED` comes in for a service that is not in :attr:`Com::Vmware::Appliance::Vmon::Service::State.STOPPED` state.

    226
    227
    228
    229
    230
    231
    # File '/build/mts/release/bora-4571906/build/sdk/aggregated-bindings/ruby/com/vmware/appliance/vmon.rb', line 226

    def update(service, spec)
        invoke_with_info(@@update_info, {
            'service' => service,
            'spec' => spec,
        })
    end