Role

class perses_api.role.GlobalRole[source]

Bases: RoleBase

The class includes all necessary methods to access the Perses global roles API

Parameters:

perses_api_model (APIModel) – Inject a Perses API model object that includes all necessary values and information

api

This is where we store the api

Type:

Api

class perses_api.role.ProjectRole[source]

Bases: RoleBase

The class includes all necessary methods to access the Perses project-scoped roles API

Parameters:
  • perses_api_model (APIModel) – Inject a Perses API model object that includes all necessary values and information

  • project_name (str) – Specify the name of the project to scope role operations to

api

This is where we store the api

Type:

Api

project_name

This is where we store the project_name

Type:

str

__init__(perses_api_model: APIModel, project_name: str)[source]
class perses_api.role.RoleBase[source]

Bases: ResourceBase

The class includes all necessary base methods to access the Perses roles API

Parameters:

perses_api_model (APIModel) – Inject a Perses API model object that includes all necessary values and information

api

This is where we store the api

Type:

Api

create_role(role) dict[source]

The method includes a functionality to create a new role

Parameters:

role (Role | GlobalRole) – Specify the role resource to create

Raises:

Exception – Unspecified error by executing the API call

Returns:

The created role dict

Return type:

dict

delete_role(name: str) None[source]

The method includes a functionality to delete a role by name

Parameters:

name (str) – Specify the name of the role to delete

Raises:

ValueError – Missed specifying a necessary value

get_role(name: str) dict[source]

The method includes a functionality to retrieve a single role by name

Parameters:

name (str) – Specify the name of the role to retrieve

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

The role dict

Return type:

dict

get_roles(name: str = None) list[source]

The method includes a functionality to retrieve all roles

Parameters:

name (str) – Specify a name to filter the results (default None)

Raises:

Exception – Unspecified error by executing the API call

Returns:

A list of role dicts

Return type:

list

update_role(name: str, role) dict[source]

The method includes a functionality to update an existing role by name

Parameters:
  • name (str) – Specify the name of the role to update

  • role (Role | GlobalRole) – Specify the updated role resource

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

The updated role dict

Return type:

dict