Class: OvirtSDK4::SnapshotService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#cdroms_service ⇒ SnapshotCdromsService
Locates the
cdroms
service. -
#disks_service ⇒ SnapshotDisksService
Locates the
disks
service. -
#get(opts = {}) ⇒ Snapshot
Returns the representation of the object managed by this service.
-
#nics_service ⇒ SnapshotNicsService
Locates the
nics
service. -
#remove(opts = {}) ⇒ Object
Deletes the object managed by this service.
-
#restore(opts = {}) ⇒ Object
Restores a virtual machine snapshot.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
Methods inherited from Service
Instance Method Details
#cdroms_service ⇒ SnapshotCdromsService
Locates the cdroms
service.
19641 19642 19643 |
# File 'lib/ovirtsdk4/services.rb', line 19641 def cdroms_service @cdroms_service ||= SnapshotCdromsService.new(self, 'cdroms') end |
#disks_service ⇒ SnapshotDisksService
Locates the disks
service.
19650 19651 19652 |
# File 'lib/ovirtsdk4/services.rb', line 19650 def disks_service @disks_service ||= SnapshotDisksService.new(self, 'disks') end |
#get(opts = {}) ⇒ Snapshot
Returns the representation of the object managed by this service.
19526 19527 19528 |
# File 'lib/ovirtsdk4/services.rb', line 19526 def get(opts = {}) internal_get(GET, opts) end |
#nics_service ⇒ SnapshotNicsService
Locates the nics
service.
19659 19660 19661 |
# File 'lib/ovirtsdk4/services.rb', line 19659 def nics_service @nics_service ||= SnapshotNicsService.new(self, 'nics') end |
#remove(opts = {}) ⇒ Object
Deletes the object managed by this service.
19562 19563 19564 |
# File 'lib/ovirtsdk4/services.rb', line 19562 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/>
19632 19633 19634 |
# File 'lib/ovirtsdk4/services.rb', line 19632 def restore(opts = {}) internal_action(:restore, nil, RESTORE, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
19670 19671 19672 19673 19674 19675 19676 19677 19678 19679 19680 19681 19682 19683 19684 19685 19686 19687 19688 19689 19690 19691 19692 19693 |
# File 'lib/ovirtsdk4/services.rb', line 19670 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 |