Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new file,
compass_sdk/root_rbac.py
, which defines aCompassRootClient
class for managing users, groups, and roles in a Compass system. The class provides methods for fetching, creating, and deleting users, groups, and roles, as well as managing role mappings.The
CompassRootClient
class is initialised with acompass_url
and aroot_user_token
, which are used to construct the base URL and authorisation headers for API requests. The class methods use therequests
library to interact with the Compass API, performing various operations:fetch_users
retrieves a list of users and returns a list ofUserFetchResponse
objects.create_users
creates new users and returns a list ofUserCreateResponse
objects.delete_users
deletes users by their names and returns a list ofUserDeleteResponse
objects.fetch_groups
fetches a list of groups and returns a list ofGroupFetchResponse
objects.create_groups
creates new groups and returns a list ofGroupCreateResponse
objects.delete_groups
deletes groups by their names and returns a list ofGroupUserDeleteResponse
objects.delete_user_group
removes a user from a group and returns aGroupUserDeleteResponse
object.fetch_roles
retrieves a list of roles and returns a list ofRoleFetchResponse
objects.insert_roles
creates new roles and returns a list ofRoleCreateResponse
objects.update_role
updates a role's policies and returns aRoleCreateResponse
object.delete_roles
deletes roles by their IDs and returns a list ofRoleDeleteResponse
objects.insert_role_mappings
creates new role mappings and returns a list ofRoleMappingResponse
objects.fetch_role_mappings
fetches a list of role mappings and returns a list ofRoleMappingResponse
objects.delete_role_mappings
deletes role mappings for a specific role and group and returns a list ofRoleMappingDeleteResponse
objects.create_root_user
creates a root user and returns aUserCreateResponse
object.Additionally, the PR adds a new file,
compass_sdk/types.py
, which defines various Pydantic models for the Compass system, including:UserFetchResponse
,UserCreateRequest
,UserCreateResponse
, andUserDeleteResponse
for user-related operations.GroupFetchResponse
,GroupCreateRequest
,GroupCreateResponse
, andGroupUserDeleteResponse
for group-related operations.PolicyRequest
,PolicyResponse
,RoleFetchResponse
,RoleCreateRequest
,RoleCreateResponse
, andRoleDeleteResponse
for role-related operations.RoleMappingRequest
,RoleMappingResponse
, andRoleMappingDeleteResponse
for role mapping operations.