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

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#add_to_user(user, tenant) ⇒ Object



23
24
25
# File 'lib/rackspace-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/rackspace-fog/openstack/models/identity/role.rb', line 17

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

#remove_to_user(user, tenant) ⇒ Object



27
28
29
# File 'lib/rackspace-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/rackspace-fog/openstack/models/identity/role.rb', line 10

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