Class: Fog::Identity::OpenStack::V3::Project
Class Attribute Summary collapse
#project
Instance Method Summary
collapse
#initialize, #save
Class Attribute Details
.cache ⇒ Object
Returns the value of attribute cache.
20
21
22
|
# File 'lib/fog/identity/openstack/v3/models/project.rb', line 20
def cache
@cache
end
|
Instance Method Details
#check_group_role(group_id, role_id) ⇒ Object
91
92
93
94
95
96
97
98
99
|
# File 'lib/fog/identity/openstack/v3/models/project.rb', line 91
def check_group_role(group_id, role_id)
requires :id
begin
service.check_project_group_role(id, group_id, role_id)
rescue Fog::Identity::OpenStack::NotFound
return false
end
true
end
|
#check_user_role(user_id, role_id) ⇒ Object
64
65
66
67
68
69
70
71
72
|
# File 'lib/fog/identity/openstack/v3/models/project.rb', line 64
def check_user_role(user_id, role_id)
requires :id
begin
service.check_project_user_role(id, user_id, role_id)
rescue Fog::Identity::OpenStack::NotFound
return false
end
true
end
|
#create ⇒ Object
45
46
47
48
49
50
51
|
# File 'lib/fog/identity/openstack/v3/models/project.rb', line 45
def create
clear_cache
merge_attributes(
service.create_project(attributes).body['project']
)
self
end
|
#destroy ⇒ Object
29
30
31
32
33
34
|
# File 'lib/fog/identity/openstack/v3/models/project.rb', line 29
def destroy
clear_cache
requires :id
service.delete_project(id)
true
end
|
#grant_role_to_group(role_id, group_id) ⇒ Object
85
86
87
88
89
|
# File 'lib/fog/identity/openstack/v3/models/project.rb', line 85
def grant_role_to_group(role_id, group_id)
clear_cache
requires :id
service.grant_project_group_role(id, group_id, role_id)
end
|
#grant_role_to_user(role_id, user_id) ⇒ Object
58
59
60
61
62
|
# File 'lib/fog/identity/openstack/v3/models/project.rb', line 58
def grant_role_to_user(role_id, user_id)
clear_cache
requires :id
service.grant_project_user_role(id, user_id, role_id)
end
|
#group_roles(group_id) ⇒ Object
80
81
82
83
|
# File 'lib/fog/identity/openstack/v3/models/project.rb', line 80
def group_roles(group_id)
requires :id
service.list_project_group_roles(id, group_id).body['roles']
end
|
#revoke_role_from_group(role_id, group_id) ⇒ Object
101
102
103
104
105
|
# File 'lib/fog/identity/openstack/v3/models/project.rb', line 101
def revoke_role_from_group(role_id, group_id)
clear_cache
requires :id
service.revoke_project_group_role(id, group_id, role_id)
end
|
#revoke_role_from_user(role_id, user_id) ⇒ Object
74
75
76
77
78
|
# File 'lib/fog/identity/openstack/v3/models/project.rb', line 74
def revoke_role_from_user(role_id, user_id)
clear_cache
requires :id
service.revoke_project_user_role(id, user_id, role_id)
end
|
#to_s ⇒ Object
25
26
27
|
# File 'lib/fog/identity/openstack/v3/models/project.rb', line 25
def to_s
name
end
|
#update(attr = nil) ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'lib/fog/identity/openstack/v3/models/project.rb', line 36
def update(attr = nil)
clear_cache
requires :id
merge_attributes(
service.update_project(id, attr || attributes).body['project']
)
self
end
|
#user_roles(user_id) ⇒ Object
53
54
55
56
|
# File 'lib/fog/identity/openstack/v3/models/project.rb', line 53
def user_roles(user_id)
requires :id
service.list_project_user_roles(id, user_id).body['roles']
end
|