Secret

class perses_api.secret.GlobalSecret[source]

Bases: SecretBase

The class includes all necessary methods to access the Perses global secrets 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.secret.ProjectSecret[source]

Bases: SecretBase

The class includes all necessary methods to access the Perses project-scoped secrets 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 secret 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.secret.SecretBase[source]

Bases: ResourceBase

The class includes all necessary base methods to access the Perses secrets 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_secret(secret) dict[source]

The method includes a functionality to create a new secret

Parameters:

secret (Secret | GlobalSecret) – Specify the secret resource to create

Raises:

Exception – Unspecified error by executing the API call

Returns:

The created secret dict

Return type:

dict

delete_secret(name: str) None[source]

The method includes a functionality to delete a secret by name

Parameters:

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

Raises:

ValueError – Missed specifying a necessary value

get_secret(name: str) dict[source]

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

Parameters:

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

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

The secret dict

Return type:

dict

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

The method includes a functionality to retrieve all secrets

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 secret dicts

Return type:

list

update_secret(name: str, secret) dict[source]

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

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

  • secret (Secret | GlobalSecret) – Specify the updated secret resource

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

The updated secret dict

Return type:

dict