Class: Fog::Identity::OpenStack::V3::Project

Inherits:
OpenStack::Model show all
Defined in:
lib/fog/openstack/models/identity_v3/project.rb

Instance Attribute Summary

Attributes inherited from OpenStack::Model

#project

Instance Method Summary collapse

Methods inherited from OpenStack::Model

#initialize, #save

Constructor Details

This class inherits a constructor from Fog::OpenStack::Model

Instance Method Details

#check_group_role(group_id, role_id) ⇒ Object



77
78
79
80
81
82
83
84
85
# File 'lib/fog/openstack/models/identity_v3/project.rb', line 77

def check_group_role(group_id, role_id)
  requires :id
  begin
    service.check_project_group_role(self.id, group_id, role_id)
  rescue Fog::Identity::OpenStack::NotFound
    return false
  end
  return true
end

#check_user_role(user_id, role_id) ⇒ Object



52
53
54
55
56
57
58
59
60
# File 'lib/fog/openstack/models/identity_v3/project.rb', line 52

def check_user_role(user_id, role_id)
  requires :id
  begin
    service.check_project_user_role(self.id, user_id, role_id)
  rescue Fog::Identity::OpenStack::NotFound
    return false
  end
  return true
end

#createObject



36
37
38
39
40
# File 'lib/fog/openstack/models/identity_v3/project.rb', line 36

def create
  merge_attributes(
      service.create_project(attributes).body['project'])
  self
end

#destroyObject



23
24
25
26
27
# File 'lib/fog/openstack/models/identity_v3/project.rb', line 23

def destroy
  requires :id
  service.delete_project(self.id)
  true
end

#grant_role_to_group(role_id, group_id) ⇒ Object



72
73
74
75
# File 'lib/fog/openstack/models/identity_v3/project.rb', line 72

def grant_role_to_group(role_id, group_id)
  requires :id
  service.grant_project_group_role(self.id, group_id, role_id)
end

#grant_role_to_user(role_id, user_id) ⇒ Object



47
48
49
50
# File 'lib/fog/openstack/models/identity_v3/project.rb', line 47

def grant_role_to_user(role_id, user_id)
  requires :id
  service.grant_project_user_role(self.id, user_id, role_id)
end

#group_roles(group_id) ⇒ Object



67
68
69
70
# File 'lib/fog/openstack/models/identity_v3/project.rb', line 67

def group_roles(group_id)
  requires :id
  service.list_project_group_roles(self.id, group_id).body['roles']
end

#revoke_role_from_group(role_id, group_id) ⇒ Object



87
88
89
90
# File 'lib/fog/openstack/models/identity_v3/project.rb', line 87

def revoke_role_from_group(role_id, group_id)
  requires :id
  service.revoke_project_group_role(self.id, group_id, role_id)
end

#revoke_role_from_user(role_id, user_id) ⇒ Object



62
63
64
65
# File 'lib/fog/openstack/models/identity_v3/project.rb', line 62

def revoke_role_from_user(role_id, user_id)
  requires :id
  service.revoke_project_user_role(self.id, user_id, role_id)
end

#to_sObject



19
20
21
# File 'lib/fog/openstack/models/identity_v3/project.rb', line 19

def to_s
  self.name
end

#update(attr = nil) ⇒ Object



29
30
31
32
33
34
# File 'lib/fog/openstack/models/identity_v3/project.rb', line 29

def update(attr = nil)
  requires :id
  merge_attributes(
      service.update_project(self.id, attr || attributes).body['project'])
  self
end

#user_roles(user_id) ⇒ Object



42
43
44
45
# File 'lib/fog/openstack/models/identity_v3/project.rb', line 42

def user_roles(user_id)
  requires :id
  service.list_project_user_roles(self.id, user_id).body['roles']
end