Sha256: 4e631b1a9f2c588cf36d97f123c0346f53e6de28725b9a3fa619f778e07fbe3b
Contents?: true
Size: 1.47 KB
Versions: 7
Compression:
Stored size: 1.47 KB
Contents
# frozen_string_literal: true # Copyright 2018 Tristan Robert # This file is part of Fog::Proxmox. # Fog::Proxmox is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # Fog::Proxmox is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>. require 'fog/proxmox/models/collection' require 'fog/identity/proxmox/models/pool' module Fog module Identity class Proxmox # class Pools Collection of pools of VMs class Pools < Fog::Proxmox::Collection model Fog::Identity::Proxmox::Pool def all(_options = {}) load_response(service.list_pools, 'pools') end 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 def destroy(id) pool = find_by_id(id) pool.destroy end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems