Class: Fog::Identity::OpenStack::V2::Tenant
Instance Attribute Summary
#project
Instance Method Summary
collapse
#initialize, #save
Instance Method Details
#create ⇒ Object
44
45
46
47
48
49
50
|
# File 'lib/fog/identity/openstack/v2/models/tenant.rb', line 44
def create
requires :name
merge_attributes(
service.create_tenant(attributes).body['tenant']
)
self
end
|
#destroy ⇒ Object
30
31
32
33
34
|
# File 'lib/fog/identity/openstack/v2/models/tenant.rb', line 30
def destroy
requires :id
service.delete_tenant(id)
true
end
|
#grant_user_role(user_id, role_id) ⇒ Object
52
53
54
|
# File 'lib/fog/identity/openstack/v2/models/tenant.rb', line 52
def grant_user_role(user_id, role_id)
service.add_user_to_tenant(id, user_id, role_id)
end
|
#revoke_user_role(user_id, role_id) ⇒ Object
56
57
58
|
# File 'lib/fog/identity/openstack/v2/models/tenant.rb', line 56
def revoke_user_role(user_id, role_id)
service.remove_user_from_tenant(id, user_id, role_id)
end
|
#roles_for(user) ⇒ Object
18
19
20
21
22
23
|
# File 'lib/fog/identity/openstack/v2/models/tenant.rb', line 18
def roles_for(user)
service.roles(
:tenant => self,
:user => user
)
end
|
#to_s ⇒ Object
14
15
16
|
# File 'lib/fog/identity/openstack/v2/models/tenant.rb', line 14
def to_s
name
end
|
#update(attr = nil) ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/fog/identity/openstack/v2/models/tenant.rb', line 36
def update(attr = nil)
requires :id, :name
merge_attributes(
service.update_tenant(id, attr || attributes).body['tenant']
)
self
end
|
#users ⇒ Object
25
26
27
28
|
# File 'lib/fog/identity/openstack/v2/models/tenant.rb', line 25
def users
requires :id
service.users(:tenant_id => id)
end
|