Package cm_api :: Package endpoints :: Module users :: Class ApiUser
[hide private]
[frames] | no frames]

Class ApiUser

source code

         object --+        
                  |        
types.BaseApiObject --+    
                      |    
  types.BaseApiResource --+
                          |
                         ApiUser

Instance Methods [hide private]
 
__init__(self, resource_root, name=None, password=None, roles=None)
Initializes internal state and sets all known writable properties of the object to None.
source code
 
_path(self)
Returns the path to the resource.
source code
 
grant_admin_role(self)
Grant admin access to a user.
source code
 
revoke_admin_role(self)
Revoke admin access from a user.
source code

Inherited from types.BaseApiObject: __setattr__, __str__, to_json_dict

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __sizeof__, __subclasshook__

Class Methods [hide private]

Inherited from types.BaseApiObject: from_json_dict

Inherited from types.BaseApiObject (private): _get_attributes

Static Methods [hide private]

Inherited from types.BaseApiObject: init

Class Variables [hide private]
  _ATTRIBUTES = {'name': None, 'password': None, 'roles': None}

Inherited from types.BaseApiObject (private): _WHITELIST

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, resource_root, name=None, password=None, roles=None)
(Constructor)

source code 

Initializes internal state and sets all known writable properties of the object to None. Then initializes the properties given in the provided attributes dictionary.

Parameters:
  • resource_root - API resource object.
  • attrs - optional dictionary of attributes to set. This should only contain r/w attributes.
Overrides: object.__init__
(inherited documentation)

_path(self)

source code 

Returns the path to the resource.

e.g., for a service 'foo' in cluster 'bar', this should return '/clusters/bar/services/foo'.

Overrides: types.BaseApiResource._path
(inherited documentation)

grant_admin_role(self)

source code 

Grant admin access to a user. If the user already has admin access, this does nothing. If the user currently has a non-admin role, it will be replaced with the admin role.

Returns:
An ApiUser object

revoke_admin_role(self)

source code 

Revoke admin access from a user. If the user does not have admin access, this does nothing. After revocation, the user will have the un-privileged regular user role.

Returns:
An ApiUser object