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)
  attributes[:node_id] = new_attributes[:node_id] unless new_attributes[:node_id].nil?
  attributes[:server_id] = new_attributes[:server_id] unless new_attributes[:server_id].nil?
  attributes[:server_type] = new_attributes[:server_type] unless new_attributes[:server_type].nil?
  attributes[:name] = new_attributes[:name] unless new_attributes[:name].nil?
  attributes[:name] = new_attributes['name'] unless new_attributes['name'].nil?
  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 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
rollback() click to toggle source
# 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
save() click to toggle source
# 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
update() click to toggle source
# 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

Private Instance Methods

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