controllers.roles_controller module

class controllers.roles_controller.RolesController(config=None, client=None, call_back=None)[source]

Bases: cohesity_management_sdk.controllers.base_controller.BaseController

A Controller to access Endpoints in the cohesity_management_sdk API.

create_role(body=None)[source]

Does a POST request to /public/roles.

Returns the new custom role that was created. A custom role is a user-defined role that is created using the REST API, the Cohesity Cluster or the CLI.

Args:
body (RoleCreateParameters, optional): Request to create a new

custom Role.

Returns:

Role: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

delete_roles(body=None)[source]

Does a DELETE request to /public/roles.

Returns Success if all the specified Roles are deleted.

Args:
body (RoleDeleteParameters, optional): Request to delete one or

more Roles.

Returns:

void: Response from the API. No Content

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

get_roles(name=None, tenant_ids=None, all_under_hierarchy=None)[source]

Does a GET request to /public/roles.

If the ‘name’ parameter is not specified, all roles defined on the Cohesity Cluster are returned. In addition, information about each role is returned such as the name, description, assigned privileges, etc. If an exact role name (such as COHESITY_VIEWER) is specified in the ‘name’ parameter, only information about that single role is returned.

Args:

name (string, optional): Specifies the name of the role. tenant_ids (list of string, optional): TenantIds contains ids of

the tenants for which objects are to be returned.

all_under_hierarchy (bool, optional): AllUnderHierarchy specifies

if objects of all the tenants under the hierarchy of the logged in user’s organization should be returned.

Returns:

list of Role: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.

update_role(name, body=None)[source]

Does a PUT request to /public/roles/{name}.

For example, you could update the privileges assigned to a Role. Returns the updated role.

Args:

name (string): Specifies the name of the role to update. body (RoleUpdateParameters, optional): Request to update a custom

role.

Returns:

Role: Response from the API. Success

Raises:
APIException: When an error occurs while fetching the data from

the remote API. This exception includes the HTTP Response code, an error message, and the HTTP body that was received in the request.