Class: Fog::Compute::Proxmox::Volumes

Inherits:
Proxmox::Collection show all
Defined in:
lib/fog/compute/proxmox/models/volumes.rb

Overview

class Volumes Collection of volumes

Instance Attribute Summary

Attributes inherited from Proxmox::Collection

#response

Instance Method Summary collapse

Methods inherited from Proxmox::Collection

#clear_ignored_attributes, #create, #find_by_id, #load_response, #not_implemented, #read, #summary

Instance Method Details

#allObject


37
38
39
# File 'lib/fog/compute/proxmox/models/volumes.rb', line 37

def all
  search
end

#destroy(id) ⇒ Object


60
61
62
63
# File 'lib/fog/compute/proxmox/models/volumes.rb', line 60

def destroy(id)
  volume = get(id)
  volume.destroy
end

#get(id) ⇒ Object


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

def get(id)
  all
  cached_volume = find { |volume| volume.id == id }
  return cached_volume if cached_volume
end

#list_by_content_type(content) ⇒ Object


46
47
48
# File 'lib/fog/compute/proxmox/models/volumes.rb', line 46

def list_by_content_type(content)
  search(content: content)
end

#list_by_content_type_and_by_server(content, vmid) ⇒ Object


50
51
52
# File 'lib/fog/compute/proxmox/models/volumes.rb', line 50

def list_by_content_type_and_by_server(content, vmid)
  search(content: content, vmid: vmid)
end

#new(attributes = {}) ⇒ Object


32
33
34
35
# File 'lib/fog/compute/proxmox/models/volumes.rb', line 32

def new(attributes = {})
  requires :node, :storage
  super({ node: node, storage: storage }.merge(attributes))
end

#search(options = {}) ⇒ Object


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

def search(options = {})
  requires :node, :storage
  load_response(service.list_volumes(node, storage, options), 'volumes')
end