Class: OvirtSDK4::AffinityLabelService

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

#get(opts = {}) ⇒ AffinityLabel

Retrieves the details of a label.

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.

  • :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:



1250
1251
1252
# File 'lib/ovirtsdk4/services.rb', line 1250

def get(opts = {})
  internal_get(GET, opts)
end

#hosts_serviceAffinityLabelHostsService

List all hosts with this label.

Returns:



1310
1311
1312
# File 'lib/ovirtsdk4/services.rb', line 1310

def hosts_service
  @hosts_service ||= AffinityLabelHostsService.new(self, 'hosts')
end

#remove(opts = {}) ⇒ Object

Removes a label from the system and clears all assignments of the removed label.

Parameters:

  • 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.



1274
1275
1276
# File 'lib/ovirtsdk4/services.rb', line 1274

def remove(opts = {})
  internal_remove(REMOVE, 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.

Raises:



1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
# File 'lib/ovirtsdk4/services.rb', line 1330

def service(path)
  if path.nil? || path == ''
    return self
  end
  if path == 'hosts'
    return hosts_service
  end
  if path.start_with?('hosts/')
    return hosts_service.service(path[6..-1])
  end
  if path == 'vms'
    return vms_service
  end
  if path.start_with?('vms/')
    return vms_service.service(path[4..-1])
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end

#update(label, opts = {}) ⇒ AffinityLabel

Updates a label. This call will update all metadata, such as the name or description.

Parameters:

  • label (AffinityLabel)

    The label to update.

  • 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:



1301
1302
1303
# File 'lib/ovirtsdk4/services.rb', line 1301

def update(label, opts = {})
  internal_update(label, AffinityLabel, UPDATE, opts)
end

#vms_serviceAffinityLabelVmsService

List all virtual machines with this label.

Returns:



1319
1320
1321
# File 'lib/ovirtsdk4/services.rb', line 1319

def vms_service
  @vms_service ||= AffinityLabelVmsService.new(self, 'vms')
end