Model

class perses_api.model.APIEndpoints[source]

Bases: str, Enum

The enum includes all necessary API endpoint path templates for the Perses API

DASHBOARD = '/api/v1/projects/{project}/dashboards/{name}'
DASHBOARDS = '/api/v1/projects/{project}/dashboards'
DATASOURCE = '/api/v1/projects/{project}/datasources/{name}'
DATASOURCES = '/api/v1/projects/{project}/datasources'
EPHEMERAL_DASHBOARD = '/api/v1/projects/{project}/ephemeraldashboards/{name}'
EPHEMERAL_DASHBOARDS = '/api/v1/projects/{project}/ephemeraldashboards'
GLOBAL_DATASOURCE = '/api/v1/globaldatasources/{name}'
GLOBAL_DATASOURCES = '/api/v1/globaldatasources'
GLOBAL_ROLE = '/api/v1/globalroles/{name}'
GLOBAL_ROLES = '/api/v1/globalroles'
GLOBAL_ROLE_BINDING = '/api/v1/globalrolebindings/{name}'
GLOBAL_ROLE_BINDINGS = '/api/v1/globalrolebindings'
GLOBAL_SECRET = '/api/v1/globalsecrets/{name}'
GLOBAL_SECRETS = '/api/v1/globalsecrets'
GLOBAL_VARIABLE = '/api/v1/globalvariables/{name}'
GLOBAL_VARIABLES = '/api/v1/globalvariables'
MIGRATE = '/api/migrate'
PLUGINS = '/api/v1/plugins'
PROJECT = '/api/v1/projects/{project}'
PROJECTS = '/api/v1/projects'
ROLE = '/api/v1/projects/{project}/roles/{name}'
ROLES = '/api/v1/projects/{project}/roles'
ROLE_BINDING = '/api/v1/projects/{project}/rolebindings/{name}'
ROLE_BINDINGS = '/api/v1/projects/{project}/rolebindings'
SECRET = '/api/v1/projects/{project}/secrets/{name}'
SECRETS = '/api/v1/projects/{project}/secrets'
USER = '/api/v1/users/{name}'
USERS = '/api/v1/users'
VALIDATE = '/api/validate/{resource_type}'
VARIABLE = '/api/v1/projects/{project}/variables/{name}'
VARIABLES = '/api/v1/projects/{project}/variables'
__new__(value)
class perses_api.model.APIModel[source]

Bases: object

The dataclass includes all necessary values and information to access the Perses API

Parameters:
  • host (str) – Specify the host of the Perses instance

  • token (str) – Specify the bearer token for authentication (default None)

  • username (str) – Specify the username for basic authentication (default None)

  • password (str) – Specify the password for basic authentication (default None)

  • timeout (float) – Specify the timeout of the API call (default 10.0)

  • headers (dict) – Specify additional HTTP headers to include in every request (default None)

  • http2_support (bool) – Specify if HTTP/2 should be used (default False)

  • ssl_context (any) – Specify a custom SSL context or certificate path (default None)

  • num_pools (int) – Specify the maximum number of HTTP connections (default 10)

  • retries (any) – Specify the number of retries or a retry object (default False)

  • follow_redirects (bool) – Specify if HTTP redirects should be followed (default True)

__init__(host: str, token: str | None = None, username: str | None = None, password: str | None = None, timeout: float = 10.0, headers: dict | None = None, http2_support: bool = False, ssl_context: Any = None, num_pools: int = 10, retries: Any = False, follow_redirects: bool = True) None
follow_redirects: bool = True

Whether to follow HTTP redirects

headers: dict | None = None
host: str

The host of the Perses instance

http2_support: bool = False

Whether to use HTTP/2

num_pools: int = 10

Maximum number of HTTP connections

password: str | None = None

Password for basic authentication

retries: Any = False

Number of retries or a retry object

ssl_context: Any = None

Custom SSL context or certificate path

timeout: float = 10.0

Timeout of the API call in seconds

token: str | None = None

Bearer token for authentication

username: str | None = None

Username for basic authentication

class perses_api.model.Dashboard[source]

Bases: _CamelModel

The class includes all necessary values to represent a Perses dashboard resource

Parameters:
  • kind (str) – Specify the resource kind (default Dashboard)

  • metadata (Metadata) – Specify the resource metadata

  • spec (DashboardSpec) – Specify the dashboard spec (default DashboardSpec)

kind: str
metadata: Metadata
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: DashboardSpec
class perses_api.model.DashboardSpec[source]

Bases: _CamelModel

The class includes the spec for a Perses dashboard resource

Parameters:
  • display (dict) – Specify optional display properties (default None)

  • datasources (dict) – Specify the datasource references used by the dashboard (default None)

  • variables (list) – Specify the dashboard-scoped variables (default None)

  • panels (dict) – Specify the panel definitions keyed by panel ID (default None)

  • layouts (list) – Specify the layout configuration for the panels (default None)

  • duration (str) – Specify the default time range duration, e.g. 1h (default None)

  • refresh_interval (str) – Specify the default auto-refresh interval, e.g. 30s (default None)

datasources: dict | None
display: dict | None
duration: str | None
layouts: list | None
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

panels: dict | None
refresh_interval: str | None
variables: list | None
class perses_api.model.Datasource[source]

Bases: _CamelModel

The class includes all necessary values to represent a project-scoped Perses datasource resource

Parameters:
  • kind (str) – Specify the resource kind (default Datasource)

  • metadata (Metadata) – Specify the resource metadata including project

  • spec (DatasourceSpec) – Specify the datasource spec

kind: str
metadata: Metadata
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: DatasourceSpec
class perses_api.model.DatasourceSpec[source]

Bases: _CamelModel

The class includes the spec for a Perses datasource resource

Parameters:
  • default (bool) – Specify if this datasource is the default for its type (default False)

  • plugin (dict) – Specify the plugin configuration including kind and plugin-specific spec (default {})

default: bool
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

plugin: dict
class perses_api.model.EphemeralDashboard[source]

Bases: _CamelModel

The class includes all necessary values to represent a Perses ephemeral dashboard resource

Parameters:
  • kind (str) – Specify the resource kind (default EphemeralDashboard)

  • metadata (Metadata) – Specify the resource metadata

  • spec (EphemeralDashboardSpec) – Specify the ephemeral dashboard spec including TTL

kind: str
metadata: Metadata
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: EphemeralDashboardSpec
class perses_api.model.EphemeralDashboardSpec[source]

Bases: _CamelModel

The class includes the spec for a Perses ephemeral dashboard resource

Parameters:
  • ttl (str) – Specify the time-to-live duration after which the dashboard is deleted, e.g. 1h

  • display (dict) – Specify optional display properties (default None)

  • datasources (dict) – Specify the datasource references used by the dashboard (default None)

  • variables (list) – Specify the dashboard-scoped variables (default None)

  • panels (dict) – Specify the panel definitions keyed by panel ID (default None)

  • layouts (list) – Specify the layout configuration for the panels (default None)

  • duration (str) – Specify the default time range duration (default None)

  • refresh_interval (str) – Specify the default auto-refresh interval (default None)

datasources: dict | None
display: dict | None
duration: str | None
layouts: list | None
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

panels: dict | None
refresh_interval: str | None
ttl: str
variables: list | None
class perses_api.model.GlobalDatasource[source]

Bases: _CamelModel

The class includes all necessary values to represent a global Perses datasource resource

Parameters:
  • kind (str) – Specify the resource kind (default GlobalDatasource)

  • metadata (Metadata) – Specify the resource metadata

  • spec (DatasourceSpec) – Specify the datasource spec

kind: str
metadata: Metadata
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: DatasourceSpec
class perses_api.model.GlobalRole[source]

Bases: _CamelModel

The class includes all necessary values to represent a global Perses role resource

Parameters:
  • kind (str) – Specify the resource kind (default GlobalRole)

  • metadata (Metadata) – Specify the resource metadata

  • spec (RoleSpec) – Specify the role spec (default RoleSpec)

kind: str
metadata: Metadata
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: RoleSpec
class perses_api.model.GlobalRoleBinding[source]

Bases: _CamelModel

The class includes all necessary values to represent a global Perses role binding resource

Parameters:
  • kind (str) – Specify the resource kind (default GlobalRoleBinding)

  • metadata (Metadata) – Specify the resource metadata

  • spec (RoleBindingSpec) – Specify the role binding spec

kind: str
metadata: Metadata
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: RoleBindingSpec
class perses_api.model.GlobalSecret[source]

Bases: _CamelModel

The class includes all necessary values to represent a global Perses secret resource

Parameters:
  • kind (str) – Specify the resource kind (default GlobalSecret)

  • metadata (Metadata) – Specify the resource metadata

  • spec (SecretSpec) – Specify the secret spec

kind: str
metadata: Metadata
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: SecretSpec
class perses_api.model.GlobalVariable[source]

Bases: _CamelModel

The class includes all necessary values to represent a global Perses variable resource

Parameters:
  • kind (str) – Specify the resource kind (default GlobalVariable)

  • metadata (Metadata) – Specify the resource metadata

  • spec (VariableSpec) – Specify the variable spec

kind: str
metadata: Metadata
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: VariableSpec
class perses_api.model.Metadata[source]

Bases: _CamelModel

The class includes the common metadata envelope shared by all Perses resources

Parameters:
  • name (str) – Specify the name of the resource

  • project (str) – Specify the project the resource belongs to (default None)

  • created_at (str) – Specify the creation timestamp (default None)

  • updated_at (str) – Specify the last update timestamp (default None)

  • version (int) – Specify the resource version for optimistic concurrency (default None)

created_at: str | None
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
project: str | None
updated_at: str | None
version: int | None
class perses_api.model.Permission[source]

Bases: _CamelModel

The class includes a single permission entry for a Perses role

Parameters:
  • actions (list[str]) – Specify the allowed actions, e.g. read, write, or * for all

  • scopes (list[str]) – Specify the resource scopes the actions apply to, e.g. Dashboard or *

actions: list[str]
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

scopes: list[str]
class perses_api.model.PluginEntry[source]

Bases: _CamelModel

The class includes a single plugin entry within a plugin module

Parameters:
  • kind (str) – Specify the plugin kind

  • display (dict) – Specify optional display properties for the plugin (default None)

display: dict | None
kind: str
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class perses_api.model.PluginMetadata[source]

Bases: _CamelModel

The class includes the metadata for a Perses plugin module

Parameters:
  • name (str) – Specify the plugin module name

  • version (str) – Specify the plugin module version

model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
version: str
class perses_api.model.PluginModule[source]

Bases: _CamelModel

The class includes all necessary values to represent a Perses plugin module resource

Parameters:
  • kind (str) – Specify the resource kind (default PluginModule)

  • metadata (PluginMetadata) – Specify the plugin module metadata including name and version

  • spec (PluginModuleSpec) – Specify the plugin module spec (default PluginModuleSpec)

kind: str
metadata: PluginMetadata
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: PluginModuleSpec
class perses_api.model.PluginModuleSpec[source]

Bases: _CamelModel

The class includes the spec for a Perses plugin module resource

Parameters:
  • schemas_path (str) – Specify the path to the plugin schemas directory (default None)

  • plugins (list[PluginEntry]) – Specify the list of plugins provided by this module (default [])

model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

plugins: list[PluginEntry]
schemas_path: str | None
class perses_api.model.Project[source]

Bases: _CamelModel

The class includes all necessary values to represent a Perses project resource

Parameters:
  • kind (str) – Specify the resource kind (default Project)

  • metadata (Metadata) – Specify the resource metadata

  • spec (ProjectSpec) – Specify the project spec (default ProjectSpec)

kind: str
metadata: Metadata
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: ProjectSpec
class perses_api.model.ProjectSpec[source]

Bases: _CamelModel

The class includes the spec for a Perses project resource

Parameters:

display (dict) – Specify optional display properties such as a human-readable name (default None)

display: dict | None
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class perses_api.model.RequestsMethods[source]

Bases: str, Enum

The enum includes all necessary methods to access the Perses API

DELETE = 'DELETE'
GET = 'GET'
POST = 'POST'
PUT = 'PUT'
__new__(value)
class perses_api.model.Role[source]

Bases: _CamelModel

The class includes all necessary values to represent a project-scoped Perses role resource

Parameters:
  • kind (str) – Specify the resource kind (default Role)

  • metadata (Metadata) – Specify the resource metadata including project

  • spec (RoleSpec) – Specify the role spec (default RoleSpec)

kind: str
metadata: Metadata
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: RoleSpec
class perses_api.model.RoleBinding[source]

Bases: _CamelModel

The class includes all necessary values to represent a project-scoped Perses role binding resource

Parameters:
  • kind (str) – Specify the resource kind (default RoleBinding)

  • metadata (Metadata) – Specify the resource metadata including project

  • spec (RoleBindingSpec) – Specify the role binding spec

kind: str
metadata: Metadata
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: RoleBindingSpec
class perses_api.model.RoleBindingSpec[source]

Bases: _CamelModel

The class includes the spec for a Perses role binding resource

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

  • subjects (list[Subject]) – Specify the subjects the role is bound to (default [])

model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

role: str
subjects: list[Subject]
class perses_api.model.RoleSpec[source]

Bases: _CamelModel

The class includes the spec for a Perses role resource

Parameters:

permissions (list[Permission]) – Specify the list of permissions granted by the role (default [])

model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

permissions: list[Permission]
class perses_api.model.Secret[source]

Bases: _CamelModel

The class includes all necessary values to represent a project-scoped Perses secret resource

Parameters:
  • kind (str) – Specify the resource kind (default Secret)

  • metadata (Metadata) – Specify the resource metadata including project

  • spec (SecretSpec) – Specify the secret spec

kind: str
metadata: Metadata
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: SecretSpec
class perses_api.model.SecretSpec[source]

Bases: _CamelModel

The class includes the spec for a Perses secret resource

Parameters:
  • kind (str) – Specify the secret kind, e.g. BasicAuth or BearerToken

  • spec (dict) – Specify the secret kind-specific configuration (default {})

kind: str
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: dict
class perses_api.model.Subject[source]

Bases: _CamelModel

The class includes a single subject entry for a Perses role binding

Parameters:
  • kind (str) – Specify the subject kind, e.g. User or Team

  • name (str) – Specify the name of the subject

kind: str
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
class perses_api.model.User[source]

Bases: _CamelModel

The class includes all necessary values to represent a Perses user resource

Parameters:
  • kind (str) – Specify the resource kind (default User)

  • metadata (Metadata) – Specify the resource metadata

  • spec (UserSpec) – Specify the user spec (default UserSpec)

kind: str
metadata: Metadata
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: UserSpec
class perses_api.model.UserSpec[source]

Bases: _CamelModel

The class includes the spec for a Perses user resource

Parameters:
  • first_name (str) – Specify the user’s first name (default None)

  • last_name (str) – Specify the user’s last name (default None)

  • native_provider (dict) – Specify the native authentication provider config including password (default None)

  • oauth_providers (list) – Specify the list of OAuth provider configurations (default None)

first_name: str | None
last_name: str | None
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

native_provider: dict | None
oauth_providers: list | None
class perses_api.model.Variable[source]

Bases: _CamelModel

The class includes all necessary values to represent a project-scoped Perses variable resource

Parameters:
  • kind (str) – Specify the resource kind (default Variable)

  • metadata (Metadata) – Specify the resource metadata including project

  • spec (VariableSpec) – Specify the variable spec

kind: str
metadata: Metadata
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: VariableSpec
class perses_api.model.VariableSpec[source]

Bases: _CamelModel

The class includes the spec for a Perses variable resource

Parameters:
  • kind (str) – Specify the variable kind, e.g. StaticListVariable or QueryVariable

  • spec (dict) – Specify the variable kind-specific configuration (default {})

kind: str
model_config = {'alias_generator': <function to_camel>, 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

spec: dict