Dashboard

class perses_api.dashboard.Dashboard[source]

Bases: object

The class includes all necessary methods to access the Perses dashboards 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

__init__(perses_api_model: APIModel)[source]
create_dashboard(project_name: str, dashboard: Dashboard) dict[source]

The method includes a functionality to create a new dashboard within a project

Parameters:
  • project_name (str) – Specify the name of the project to create the dashboard in

  • dashboard (Dashboard) – Specify the dashboard resource to create

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

The created dashboard dict

Return type:

dict

delete_dashboard(project_name: str, name: str) None[source]

The method includes a functionality to delete a dashboard by name

Parameters:
  • project_name (str) – Specify the name of the project the dashboard belongs to

  • name (str) – Specify the name of the dashboard to delete

Raises:

ValueError – Missed specifying a necessary value

get_dashboard(project_name: str, name: str) dict[source]

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

Parameters:
  • project_name (str) – Specify the name of the project the dashboard belongs to

  • name (str) – Specify the name of the dashboard to retrieve

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

The dashboard dict

Return type:

dict

get_dashboards(project_name: str, name: str = None) list[source]

The method includes a functionality to retrieve all dashboards within a project

Parameters:
  • project_name (str) – Specify the name of the project to list dashboards for

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

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

A list of dashboard dicts

Return type:

list

update_dashboard(project_name: str, name: str, dashboard: Dashboard) dict[source]

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

Parameters:
  • project_name (str) – Specify the name of the project the dashboard belongs to

  • name (str) – Specify the name of the dashboard to update

  • dashboard (Dashboard) – Specify the updated dashboard resource

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

The updated dashboard dict

Return type:

dict