Class: OvirtSDK4::SnapshotService

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

#cdroms_serviceSnapshotCdromsService

Locates the cdroms service.

Returns:



19487
19488
19489
# File 'lib/ovirtsdk4/services.rb', line 19487

def cdroms_service
  @cdroms_service ||= SnapshotCdromsService.new(self, 'cdroms')
end

#disks_serviceSnapshotDisksService

Locates the disks service.

Returns:



19496
19497
19498
# File 'lib/ovirtsdk4/services.rb', line 19496

def disks_service
  @disks_service ||= SnapshotDisksService.new(self, 'disks')
end

#get(opts = {}) ⇒ Snapshot

Returns the representation of the object managed by this service.

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:



19395
19396
19397
# File 'lib/ovirtsdk4/services.rb', line 19395

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

#nics_serviceSnapshotNicsService

Locates the nics service.

Returns:



19505
19506
19507
# File 'lib/ovirtsdk4/services.rb', line 19505

def nics_service
  @nics_service ||= SnapshotNicsService.new(self, 'nics')
end

#remove(opts = {}) ⇒ Object

Deletes the object managed by this service.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :all_content (Boolean)

    Indicates if all the attributes of the virtual machine snapshot should be included in the response.

    By default the attribute initialization.configuration.data is excluded.

    For example, to retrieve the complete representation of the snapshot with id 456 of the virtual machine with id 123 send a request like this:

    GET /ovirt-engine/api/vms/123/snapshots/456?all_content=true
  • :async (Boolean)

    Indicates if the remove should be performed asynchronously.

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



19431
19432
19433
# File 'lib/ovirtsdk4/services.rb', line 19431

def remove(opts = {})
  internal_remove(REMOVE, opts)
end

#restore(opts = {}) ⇒ Object

Restores a virtual machine snapshot.

For example, to restore the snapshot with identifier 456 of virtual machine with identifier 123 send a request like this:

POST /ovirt-engine/api/vms/123/snapshots/456/restore

With an empty action in the body:

<action/>

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the restore should be performed asynchronously.

  • :disks (Array<Disk>)
  • :restore_memory (Boolean)
  • :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.



19478
19479
19480
# File 'lib/ovirtsdk4/services.rb', line 19478

def restore(opts = {})
  internal_action(:restore, nil, RESTORE, 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:



19516
19517
19518
19519
19520
19521
19522
19523
19524
19525
19526
19527
19528
19529
19530
19531
19532
19533
19534
19535
19536
19537
19538
19539
# File 'lib/ovirtsdk4/services.rb', line 19516

def service(path)
  if path.nil? || path == ''
    return self
  end
  if path == 'cdroms'
    return cdroms_service
  end
  if path.start_with?('cdroms/')
    return cdroms_service.service(path[7..-1])
  end
  if path == 'disks'
    return disks_service
  end
  if path.start_with?('disks/')
    return disks_service.service(path[6..-1])
  end
  if path == 'nics'
    return nics_service
  end
  if path.start_with?('nics/')
    return nics_service.service(path[5..-1])
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end