class Fog::Proxmox::Compute::Snapshot

class Snapshot model

Public Class Methods

new(new_attributes = {}) click to toggle source
Calls superclass method
# File lib/fog/compute/proxmox/models/snapshot.rb, line 41
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

Public Instance Methods

destroy(force = 0) click to toggle source
# File lib/fog/compute/proxmox/models/snapshot.rb, line 68
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
rollback() click to toggle source
# File lib/fog/compute/proxmox/models/snapshot.rb, line 63
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
save() click to toggle source
# File lib/fog/compute/proxmox/models/snapshot.rb, line 51
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
update() click to toggle source
# File lib/fog/compute/proxmox/models/snapshot.rb, line 57
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

Private Instance Methods

server() click to toggle source
# File lib/fog/compute/proxmox/models/snapshot.rb, line 76
def server
  Fog::Proxmox::Compute::Server.new(service: service, node_id: node_id, type: server_type, vmid: server_id)
end