Class: Fog::Compute::Proxmox::Snapshot

Inherits:
Proxmox::Model show all
Defined in:
lib/fog/compute/proxmox/models/snapshot.rb

Overview

class Snapshot model

Instance Method Summary collapse

Methods inherited from Proxmox::Model

#initialize, #inspect, #to_s

Constructor Details

This class inherits a constructor from Fog::Proxmox::Model

Instance Method Details

#create(options = {}) ⇒ Object


41
42
43
44
45
46
# File 'lib/fog/compute/proxmox/models/snapshot.rb', line 41

def create(options = {})
  requires :server
  path_params = { node: server.node, type: server.type, vmid: server.vmid }
  body_params = options
  server.tasks.wait_for(service.create_snapshot(path_params, body_params))
end

#destroy(force = 0) ⇒ Object


61
62
63
64
65
66
# File 'lib/fog/compute/proxmox/models/snapshot.rb', line 61

def destroy(force = 0)
  requires :name, :server
  path_params = { node: server.node, type: server.type, vmid: server.vmid, snapname: name }
  query_params = { force: force }
  server.tasks.wait_for(service.delete_snapshot(path_params, query_params))
end

#rollbackObject


55
56
57
58
59
# File 'lib/fog/compute/proxmox/models/snapshot.rb', line 55

def rollback
  requires :name, :server
  path_params = { node: server.node, type: server.type, vmid: server.vmid, snapname: name }
  server.tasks.wait_for(service.rollback_snapshot(path_params))
end

#updateObject


48
49
50
51
52
53
# File 'lib/fog/compute/proxmox/models/snapshot.rb', line 48

def update
  requires :name, :server
  path_params = { node: server.node, type: server.type, vmid: server.vmid, snapname: name }
  body_params = { description: description }
  service.update_snapshot(path_params, body_params)
end