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

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

Overview

class Snapshot model

Instance Method Summary collapse

Constructor Details

#initialize(new_attributes = {}) ⇒ Snapshot

Returns a new instance of Snapshot.



42
43
44
45
46
47
48
49
50
# File 'lib/fog/compute/proxmox/models/snapshot.rb', line 42

def initialize(new_attributes = {})
  prepare_service_value(new_attributes)
  Fog::Proxmox::Attributes.set_attr_and_sym('node_id', attributes, new_attributes)
  Fog::Proxmox::Attributes.set_attr_and_sym('server_id', attributes, new_attributes)
  Fog::Proxmox::Attributes.set_attr_and_sym('server_type', attributes, new_attributes)
  Fog::Proxmox::Attributes.set_attr_and_sym('name', attributes, new_attributes)
  requires :node_id, :server_id, :server_type, :name
  super(new_attributes)
end

Instance Method Details

#destroy(force = 0) ⇒ Object



69
70
71
72
73
# File 'lib/fog/compute/proxmox/models/snapshot.rb', line 69

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

#rollbackObject



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

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

#saveObject



52
53
54
55
56
# File 'lib/fog/compute/proxmox/models/snapshot.rb', line 52

def save
  path_params = { node: node_id, type: server_type, vmid: server_id }
  body_params = { snapname: name }
  server.tasks.wait_for(service.create_snapshot(path_params, body_params))
end

#updateObject



58
59
60
61
62
# File 'lib/fog/compute/proxmox/models/snapshot.rb', line 58

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