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

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

Instance Method Summary collapse

Instance Method Details

#add_to_user(user, tenant) ⇒ Object



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

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

#destroyObject



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

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

#remove_to_user(user, tenant) ⇒ Object



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

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

#saveObject



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

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