Access Groups#
The SDK provides functionality to interact with the 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 in name, description and roles to the Platform.create_access_group_on_prem() method.
This method returns a 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 by 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#
An access group can be updated by first updating the name and description fields of an existing AccessGroupOnPrem object.
Following that, the updated AccessGroupOnPrem object must be passed 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]>