Class: Fog::OpenStack::Identity::V2::Role

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/openstack/identity/v2/models/role.rb

Instance Attribute Summary

Attributes inherited from Model

#project

Instance Method Summary collapse

Methods inherited from Model

#create, #initialize, #update

Constructor Details

This class inherits a constructor from Fog::OpenStack::Model

Instance Method Details

#add_to_user(user, tenant) ⇒ Object



24
25
26
# File 'lib/fog/openstack/identity/v2/models/role.rb', line 24

def add_to_user(user, tenant)
  add_remove_to_user(user, tenant, :add)
end

#destroyObject



18
19
20
21
22
# File 'lib/fog/openstack/identity/v2/models/role.rb', line 18

def destroy
  requires :id
  service.delete_role(id)
  true
end

#remove_to_user(user, tenant) ⇒ Object



28
29
30
# File 'lib/fog/openstack/identity/v2/models/role.rb', line 28

def remove_to_user(user, tenant)
  add_remove_to_user(user, tenant, :remove)
end

#saveObject



11
12
13
14
15
16
# File 'lib/fog/openstack/identity/v2/models/role.rb', line 11

def save
  requires :name
  data = service.create_role(name)
  merge_attributes(data.body['role'])
  true
end