Class: Fog::Identity::Proxmox::Groups

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

Overview

class Groups authentication

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/groups.rb', line 30

def all(_options = {})
  load_response(service.list_groups, 'groups')
end

#destroy(id) ⇒ Object


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

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

#find_by_id(id) ⇒ Object


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

def find_by_id(id)
  cached_group = find { |group| group.groupid == id }
  return cached_group if cached_group
  group_hash = service.get_group(id)
  Fog::Identity::Proxmox::Group.new(
    group_hash.merge(service: service)
  )
end