Class: OvirtSDK4::VmWatchdogsService

Inherits:
Service
  • Object
show all
Defined in:
lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb

Instance Method Summary collapse

Methods inherited from Service

#inspect, #to_s

Instance Method Details

#add(watchdog, opts = {}) ⇒ Watchdog

Adds new watchdog to the virtual machine.

For example, to add a watchdog to a virtual machine, send a request like this:

POST /ovirt-engine/api/vms/123/watchdogs
<watchdog>
  <action>poweroff</action>
  <model>i6300esb</model>
</watchdog>

with response body:

<watchdog href="/ovirt-engine/api/vms/123/watchdogs/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000">
  <vm href="/ovirt-engine/api/vms/123" id="123"/>
  <action>poweroff</action>
  <model>i6300esb</model>
</watchdog>

Parameters:

  • watchdog (Watchdog)

    The information about the watchdog.

    The request data must contain model element (such as i6300esb) and action element (one of none, reset, poweroff, dump, pause). The response data additionally contains references to the added watchdog and to the virtual machine.

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



32210
32211
32212
# File 'lib/ovirtsdk4/services.rb', line 32210

def add(watchdog, opts = {})
  internal_add(watchdog, Watchdog, ADD, opts)
end

#list(opts = {}) ⇒ Array<Watchdog>

The list of watchdogs of the virtual machine.

The order of the returned list of watchdogs isn’t guaranteed.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :follow (String)

    Indicates which inner links should be followed. The objects referenced by these links will be fetched as part of the current request. See here for details.

  • :max (Integer)

    Sets the maximum number of watchdogs to return. If not specified all the watchdogs are returned.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:



32244
32245
32246
# File 'lib/ovirtsdk4/services.rb', line 32244

def list(opts = {})
  internal_get(LIST, opts)
end

#service(path) ⇒ Service

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.



32266
32267
32268
32269
32270
32271
32272
32273
32274
32275
# File 'lib/ovirtsdk4/services.rb', line 32266

def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return watchdog_service(path)
  end
  return watchdog_service(path[0..(index - 1)]).service(path[(index +1)..-1])
end

#watchdog_service(id) ⇒ VmWatchdogService

Returns a reference to the service that manages a specific watchdog.

Parameters:

  • id (String)

    The identifier of the watchdog.

Returns:



32255
32256
32257
# File 'lib/ovirtsdk4/services.rb', line 32255

def watchdog_service(id)
  VmWatchdogService.new(self, id)
end