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

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

Overview

class Volumes Collection of volumes

Instance Method Summary collapse

Instance Method Details

#all(filters = {}) ⇒ Object



35
36
37
# File 'lib/fog/compute/proxmox/models/volumes.rb', line 35

def all(filters = {})
  load service.list_volumes(node_id, storage_id, filters)
end

#destroy(id) ⇒ Object



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

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

#get(id) ⇒ Object



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

def get(id)
  new service.get_volume(node: node_id, storage: storage_id, volume: id)
end

#list_by_content_type(content) ⇒ Object



39
40
41
# File 'lib/fog/compute/proxmox/models/volumes.rb', line 39

def list_by_content_type(content)
  all.select { |volume| volume.content.include? content}
end

#list_by_content_type_and_by_server(content, vmid) ⇒ Object



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

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

#new(new_attributes = {}) ⇒ Object



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

def new(new_attributes = {})
  super({ node_id: node_id, storage_id: storage_id }.merge(new_attributes))
end