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

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

Instance Attribute Summary

Attributes inherited from OpenStack::Model

#project

Instance Method Summary collapse

Methods inherited from OpenStack::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/identity/openstack/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/identity/openstack/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/identity/openstack/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/identity/openstack/v2/models/role.rb', line 11

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