Class: Fog::Identity::Proxmox::Pools

Inherits:
Proxmox::Collection show all
Defined in:
lib/fog/identity/proxmox/models/pools.rb

Overview

class Pools Collection of pools of VMs

Instance Attribute Summary

Attributes inherited from Proxmox::Collection

#response

Instance Method Summary collapse

Methods inherited from Proxmox::Collection

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

Instance Method Details

#all(_options = {}) ⇒ Object


30
31
32
# File 'lib/fog/identity/proxmox/models/pools.rb', line 30

def all(_options = {})
  load_response(service.list_pools, 'pools')
end

#destroy(id) ⇒ Object


43
44
45
46
# File 'lib/fog/identity/proxmox/models/pools.rb', line 43

def destroy(id)
  pool = find_by_id(id)
  pool.destroy
end

#find_by_id(id) ⇒ Object


34
35
36
37
38
39
40
41
# File 'lib/fog/identity/proxmox/models/pools.rb', line 34

def find_by_id(id)
  cached_pool = find { |pool| pool.poolid == id }
  return cached_pool if cached_pool
  pool_hash = service.get_pool(id)
  Fog::Identity::Proxmox::Pool.new(
    pool_hash.merge(service: service)
  )
end