User Groups¶
User Groups grant users access to projects and facilitate ease of access management.
Client Module¶
- class Client(auth_token, project=None)¶
Client class provides access to device, package, volume and deployment classes.
- __init__(auth_token, project=None)¶
Get new client object
- Parameters
auth_token (string) – Authentication token
project (string) – project_guid of the user
- create_usergroup(org_guid, usergroup)¶
Create usergroup in organization
- Parameters
org_guid (str) – Organization GUID
usergroup (py:class:~rapyuta_io.clients.user_group.UserGroup) – usergroup object
- Returns
Usergroup object
- Return type
Following example demonstrates how to create usergroup in an organization
>>> client = Client(auth_token='auth_token', project='project_guid') >>> user = self._core_api_client.get_user() >>> organization_guid = user.organization.guid >>> usergroup = UserGroup(name='test-usergroup', description='test-description', creator=user.guid) >>> usergroup = client.create_usergroup(organization_guid, usergroup)
- delete_usergroup(org_guid, group_guid)¶
Delete usergroup using its GUID
Following example demonstrates how to delete a usergroup using its GUID
>>> client = Client(auth_token='auth_token', project='project_guid') >>> user = self._core_api_client.get_user() >>> organization_guid = user.organization.guid >>> client.delete_usergroup(organization_guid, 'group-guid')
- get_usergroup(org_guid, group_guid)¶
Get usergroup using its GUID
- Parameters
- Returns
A usergroup
- Return type
Following example demonstrates how to fetch a usergroup using its GUID
>>> client = Client(auth_token='auth_token', project='project_guid') >>> user = self._core_api_client.get_user() >>> organization_guid = user.organization.guid >>> client.get_usergroup(organization_guid, 'group-guid')
- list_usergroups(org_guid)¶
List usergroups in an organization
- Parameters
org_guid (str) – Organization GUID
- Returns
A list of all Usergroups in the organization
- Return type
list(
UserGroup
)
Following example demonstrates how to list usergroups
>>> client = Client(auth_token='auth_token', project='project_guid') >>> user = self._core_api_client.get_user() >>> organization_guid = user.organization.guid >>> client.list_usergroups(organization_guid)
- update_usergroup(org_guid, group_guid, usergroup)¶
Update usergroup in organization
- Parameters
- Returns
Usergroup object
- Return type
Following example demonstrates how to update usergroup
>>> client = Client(auth_token='auth_token', project='project_guid') >>> user = self._core_api_client.get_user() >>> organization_guid = user.organization.guid >>> usergroup = UserGroup(name='test-usergroup-updated', description='test-description-updated', creator=user.guid) >>> usergroup = client.update_usergroup(organization_guid, 'group-guid', usergroup)
User Group Module¶
- class UserGroup¶
Usergroups in Rapyuta IO
- Variables
guid (str) – Group ID
name (str) – Group Name
description (str) – Description of the user group
creator (str) – Creator’s GUID
members (list(
User
)) – Members who are part of the user groupadmins (list(
User
)) – Admins of the user groupprojects (list(
Project
)) – Projects that are part of the user group