Class: Fog::Compute::Proxmox::Storages

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

Overview

class Storages Collection of storages

Instance Attribute Summary

Attributes inherited from Proxmox::Collection

#response

Instance Method Summary collapse

Methods inherited from Proxmox::Collection

#clear_ignored_attributes, #create, #destroy, #get, #load_response, #not_implemented, #read, #summary

Instance Method Details

#allObject


36
37
38
# File 'lib/fog/compute/proxmox/models/storages.rb', line 36

def all
  search
end

#find_by_id(id) ⇒ Object


49
50
51
52
53
54
55
56
# File 'lib/fog/compute/proxmox/models/storages.rb', line 49

def find_by_id(id)
  cached_storage = find { |storage| storage.storage == id }
  return cached_storage if cached_storage
  storage_hash = service.get_storage(node, id, {})
  Fog::Compute::Proxmox::Storage.new(
    storage_hash.merge(service: service)
  )
end

#list_by_content_type(content) ⇒ Object


45
46
47
# File 'lib/fog/compute/proxmox/models/storages.rb', line 45

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

#new(attributes = {}) ⇒ Object


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

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

#search(options = {}) ⇒ Object


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

def search(options = {})
  requires :node
  load_response(service.list_storages(node, options), 'storages')
end