class OpenStack::Keystone::Admin::Tenant
An OpenStack
Tenant
(“admin view”)
Attributes¶ ↑
-
name
- The name of this tenant -
description
- A description of this tenant -
enabled
- True if this tenant is enabled
Public Class Methods
Public Instance Methods
Adds a role to a user in this tenant
Attributes¶ ↑
-
role
- Instance ofOpenStack::Keystone::Admin::Role
or a role id -
user
- Instance ofOpenStack::Keystone::Admin::User
or a user id
# File lib/open_stack/keystone/admin/tenant.rb, line 111 def add_role_to_user(role, user) role_id = role.is_a?(OpenStack::Keystone::Admin::Role) ? role.id : role user_id = user.is_a?(OpenStack::Keystone::Admin::User) ? user.id : user put("users/#{user_id}/roles/OS-KSADM/#{role_id}", {}, "null") end
Removes a role to a user in this tenant
Attributes¶ ↑
-
role
- Instance ofOpenStack::Keystone::Admin::Role
or a role id -
user
- Instance ofOpenStack::Keystone::Admin::User
or a user id
# File lib/open_stack/keystone/admin/tenant.rb, line 123 def delete_role_from_user(role, user) role_id = role.is_a?(OpenStack::Keystone::Admin::Role) ? role.id : role user_id = user.is_a?(OpenStack::Keystone::Admin::User) ? user.id : user delete("users/#{user_id}/roles/OS-KSADM/#{role_id}") end
Returns a filtered description for this tenant
# File lib/open_stack/keystone/admin/tenant.rb, line 131 def description=(description) @attributes[:description] = description.gsub /[^\w\s\.\-:@+,'"]/, '_' if description end
Returns the instance of OpenStack::Keystone::Admin::User
with the given id
Attributes¶ ↑
-
id
- A string
# File lib/open_stack/keystone/admin/tenant.rb, line 91 def user(id) users(id) end
List if roles in this tenant for a given instance of OpenStack::Keystone::Admin::User
or user id
Attributes¶ ↑
-
user
- A string -
scope
- AnActiveResource
scope (defaults to :all)
# File lib/open_stack/keystone/admin/tenant.rb, line 100 def user_roles(user, scope = :all) user_id = user.is_a?(OpenStack::Keystone::Admin::User) ? user.id : user Role.find(scope, :params => {:tenant_id => self.id, :user_id => user_id}) end
List of Users (instances of OpenStack::Keystone::Admin::User
) in this tenant
Attributes¶ ↑
-
scope
- AnActiveResource
scope (defaults to :all)
# File lib/open_stack/keystone/admin/tenant.rb, line 83 def users(scope = :all) User.find(scope, :params => {:tenant_id => self.id}) end
Protected Instance Methods
# File lib/open_stack/keystone/admin/tenant.rb, line 44 def initialize(params = {}, persisted = false) # :notnew: super(params, persisted) self.description = description end