VSphereAutomation::Appliance::ServicesApi

All URIs are relative to https://<vcenter>/rest

Method HTTP request Description
get GET /appliance/services/service Returns the state of a service.
list GET /appliance/services Lists details of vCenter services.
restart POST /appliance/services/service/restart Restarts a service
start POST /appliance/services/service/start Starts a service
stop POST /appliance/services/service/stop Stops a service

get

ApplianceServicesResult get(service)

Returns the state of a service.

Example

# load the gem
require 'vsphere-automation-appliance'
# setup authorization
VSphereAutomation::Configuration.new.tap do |config|
  # Configure API key authorization: api_key
  config.api_key['vmware-api-session-id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['vmware-api-session-id'] = 'Bearer'
end

api_instance = VSphereAutomation::Appliance::ServicesApi.new
service = 'service_example' # String | identifier of the service whose state is being queried.

begin
  #Returns the state of a service.
  result = api_instance.get(service)
  p result
rescue VSphereAutomation::ApiError => e
  puts "Exception when calling ServicesApi->get: #{e}"
end

Parameters

Name Type Description Notes
service String identifier of the service whose state is being queried.

Return type

ApplianceServicesResult

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

list

ApplianceServicesListResult list

Lists details of vCenter services.

Example

# load the gem
require 'vsphere-automation-appliance'
# setup authorization
VSphereAutomation::Configuration.new.tap do |config|
  # Configure API key authorization: api_key
  config.api_key['vmware-api-session-id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['vmware-api-session-id'] = 'Bearer'
end

api_instance = VSphereAutomation::Appliance::ServicesApi.new

begin
  #Lists details of vCenter services.
  result = api_instance.list
  p result
rescue VSphereAutomation::ApiError => e
  puts "Exception when calling ServicesApi->list: #{e}"
end

Parameters

This endpoint does not need any parameter.

Return type

ApplianceServicesListResult

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

restart

restart(service)

Restarts a service

Example

# load the gem
require 'vsphere-automation-appliance'
# setup authorization
VSphereAutomation::Configuration.new.tap do |config|
  # Configure API key authorization: api_key
  config.api_key['vmware-api-session-id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['vmware-api-session-id'] = 'Bearer'
end

api_instance = VSphereAutomation::Appliance::ServicesApi.new
service = 'service_example' # String | identifier of the service to restart

begin
  #Restarts a service
  api_instance.restart(service)
rescue VSphereAutomation::ApiError => e
  puts "Exception when calling ServicesApi->restart: #{e}"
end

Parameters

Name Type Description Notes
service String identifier of the service to restart

Return type

nil (empty response body)

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

start

start(service)

Starts a service

Example

# load the gem
require 'vsphere-automation-appliance'
# setup authorization
VSphereAutomation::Configuration.new.tap do |config|
  # Configure API key authorization: api_key
  config.api_key['vmware-api-session-id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['vmware-api-session-id'] = 'Bearer'
end

api_instance = VSphereAutomation::Appliance::ServicesApi.new
service = 'service_example' # String | identifier of the service to start

begin
  #Starts a service
  api_instance.start(service)
rescue VSphereAutomation::ApiError => e
  puts "Exception when calling ServicesApi->start: #{e}"
end

Parameters

Name Type Description Notes
service String identifier of the service to start

Return type

nil (empty response body)

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

stop

stop(service)

Stops a service

Example

# load the gem
require 'vsphere-automation-appliance'
# setup authorization
VSphereAutomation::Configuration.new.tap do |config|
  # Configure API key authorization: api_key
  config.api_key['vmware-api-session-id'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['vmware-api-session-id'] = 'Bearer'
end

api_instance = VSphereAutomation::Appliance::ServicesApi.new
service = 'service_example' # String | identifier of the service to stop

begin
  #Stops a service
  api_instance.stop(service)
rescue VSphereAutomation::ApiError => e
  puts "Exception when calling ServicesApi->stop: #{e}"
end

Parameters

Name Type Description Notes
service String identifier of the service to stop

Return type

nil (empty response body)

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json