Access Groups#

The SDK provides functionality for interacting with access groups on on-premises Cloud Pak for Data.

This includes operations such as:
  • Creating a new access group

  • Listing access groups

  • Updating an existing access group

  • Deleting an existing access group

Create an Access Group#

An access group can be created by passing name, description, and roles to the Platform.create_access_group_on_prem() method. This method returns an AccessGroupOnPrem object.

>>> new_group = platform.create_access_group_on_prem(name='Developers', description='access group for Developers', roles=[role1, role2])
>>> new_group
AccessGroupOnPrem(group_id='123', name='Developers', members_count=3)

Listing all Access Groups#

Access groups can be retrieved using the Platform.access_groups property. This property returns a AccessGroupsOnPrem object, which is a collection of AccessGroupOnPrem objects.

>>> platform.access_groups
[...AccessGroupOnPrem(group_id='123', name='Developers', members_count=3)...]

Update an Access Group#

To update an access group, first modify the name and description fields of an existing AccessGroupOnPrem object. Then pass the updated AccessGroupOnPrem object to the Platform.update_access_group() method. This method returns an API response whose status code should be 200 if the access group was successfully updated.

>>> new_group.name = 'New Name'
>>> new_group.description = 'New Description'
>>> platform.update_access_group(new_group)
<Response [200]>

Delete an Access Group#

An access group can be deleted through the SDK by passing an AccessGroupOnPrem object to the Platform.delete_access_group() method. This method returns an API response whose status code should be 204 if the access group was successfully deleted.

>>> platform.delete_access_group(new_group)
<Response [204]>