Class: Fog::Identity::Proxmox::Roles

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

Overview

class Roles model collection 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
33
# File 'lib/fog/identity/proxmox/models/roles.rb', line 30

def all(_options = {})
  # special attibute is volatile in role
  load_response(service.list_roles, 'roles', ['special'])
end

#destroy(id) ⇒ Object


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

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

#find_by_id(id) ⇒ Object


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

def find_by_id(id)
  cached_role = find { |role| role.roleid == id }
  return cached_role if cached_role
  role_hash = service.get_role(id)
  Fog::Identity::Proxmox::Role.new(
    role_hash.merge(service: service)
  )
end