Vault

  • Canonical Telco
Channel Revision Published Runs on
latest/edge 89 31 Jan 2024
Ubuntu 22.04 Ubuntu 20.04
latest/edge 9 27 Jan 2023
Ubuntu 22.04 Ubuntu 20.04
1.16/stable 280 04 Oct 2024
Ubuntu 22.04
1.16/candidate 280 04 Oct 2024
Ubuntu 22.04
1.16/beta 280 04 Oct 2024
Ubuntu 22.04
1.16/edge 313 20 Dec 2024
Ubuntu 22.04
1.15/stable 248 24 Jul 2024
Ubuntu 22.04
1.15/candidate 248 24 Jul 2024
Ubuntu 22.04
1.15/beta 248 24 Jul 2024
Ubuntu 22.04
1.15/edge 248 10 Jul 2024
Ubuntu 22.04
juju deploy vault-k8s --channel 1.16/stable
Show information

Platform:

charms.vault_k8s.v0.juju_facade

This library provides a wrapper of the Juju API.


Index

class FacadeError

Description

Base class for custom errors raised by this library. None

class TransientJujuError

Description

Exception raised for transient Juju errors like ModelError. None

class SecretValidationError

Description

Exception raised for secret validation errors. None

class NoSuchSecretError

Description

Exception raised when a secret does not exist. None

class SecretRemovedError

Description

Exception raised when a secret does not exist anymore. None

class NoSuchRelationError

Description

Exception raised when a relation does not exist. None

class InvalidRelationDataError

Description

Exception raised when relation data is invalid. None

class NotLeaderError

Description

Exception raised when the unit is not leader. None

class NoSuchStorageError

Description

Exception raised when a storage does not exist. None

class SecretAccessDeniedError

Description

Exception raised if the charm does not have permission to access the secret. None

class NoRemoteAppError

Description

Exception raised when a relation has no remote application. None

class MultipleRelationsFoundError

Description

Exception raised when multiple relations are found. None

class JujuFacade

Description

Juju API wrapper class. None

Methods

JujuFacade. __init__( self , charm: CharmBase )

JujuFacade. get_secret( self , label , id )

Retrieve a secret and handles error.

JujuFacade. secret_exists( self , label , id )

Check if the secret exists.

Description

Raises: TransientJujuError

JujuFacade. secret_exists_with_fields( self , fields , label , id )

Check if the secret exists and has the required fields.

Description

Args: fields: The requested fields label: The secret label id: The secret id

Returns: True if the secret exists and has the required fields, False otherwise

Raises: TransientJujuError

JujuFacade. get_current_secret_content( self , label , id )

Get secret content if the secret exists and return currently tracked revision.

Description

Raises: TransientJujuError NoSuchSecretError SecretRemovedError

JujuFacade. get_latest_secret_content( self , label , id )

Get secret content if the secret exists and return latest revision.

Description

Raises: TransientJujuError NoSuchSecretError SecretRemovedError

JujuFacade. get_secret_content_values( self )

Get secret content values by keys.

Description

Args: keys: Keys of the requested values label: The secret label id: The secret id

Returns: tuple[str | None, ...]: The secret content values, if a key is not found, None is returned for its value

Raises: TransientJujuError NoSuchSecretError SecretRemovedError

JujuFacade. set_app_secret_content( self , content , label , id , description )

Set the secret content if the secret exists.

Description

Creates new secret revision if secret exists, otherwise creates a new secret.

Raises: TransientJujuError SecretValidationError

JujuFacade. set_unit_secret_content( self , content , label: str , id , description )

Set the secret content if the secret exists.

Description

Creates new secret revision if secret exists, otherwise creates a new secret.

Raises: TransientJujuError SecretValidationError

JujuFacade. set_secret_label( self , new_label: str , label: str , id )

Set a new label for the secret if the secret exists.

Description

Raises: TransientJujuError

JujuFacade. set_secret_expiry( self , expiry: datetime , label: str , id )

Set a new expiry date for the secret if the secret exists.

Description

Raises: TransientJujuError

JujuFacade. grant_secret( self , relation: Relation , secret , secret_id , secret_label )

Grant read access to the secret to the application related.

Description

If secret ID or label is provided, it retrieves the secret and grants it to the relation.

Raises: NoSuchSecretError SecretRemovedError

JujuFacade. remove_secret( self , label: str , id )

Description

Remove the secret if it exists. None

JujuFacade. get_relation( self , name: str , id: int )

Get the relation object by name and id.

Returns

The relation object

JujuFacade. get_relation_by_name( self , name: str )

Get the relation object by name.

Description

Raises: NoSuchRelationError MultipleRelationsFoundError

JujuFacade. get_relations( self , name: str )

Get all relation objects with the given name.

Returns

A list of relation objects, the list is empty if no relations are found

JujuFacade. get_active_relation( self , name: str , id: int )

Description

Get the active relation object by name and id. None

JujuFacade. get_active_relations( self , name: str , id )

Description

Get all relations with the given name that are active. None

JujuFacade. relation_exists( self , name: str )

Description

Check if there are any relations with the given name. None

JujuFacade. get_app_relation_data( self , name , id , relation )

Get relation data from the caller's application databag.

Description

Either relation or relation_name must be provided.

Returns: The relation data as a dict

Raises: NoSuchRelationError MultipleRelationsFoundError

JujuFacade. get_remote_app_relation_data( self , name , id , relation )

Get relation data from the remote application databag.

Description

Either relation or relation_name must be provided.

Returns: The relation data as a dict

Raises: NoSuchRelationError MultipleRelationsFoundError

JujuFacade. get_unit_relation_data( self , name , id , relation )

Get relation data from the caller's unit databag.

Description

Raises: NoSuchRelationError MultipleRelationsFoundError

JujuFacade. get_remote_unit_relation_data( self , unit: Unit , name , id , relation )

Description

Get relation data from the remote unit databag. None

JujuFacade. get_remote_units_relation_data( self , name , id , relation )

Get relation data from the remote units databags.

Description

Raises: NoSuchRelationError MultipleRelationsFoundError ValueError

JujuFacade. set_app_relation_data( self , data , name , id , relation )

Set relation data in the caller's application databag.

Description

Raises: NotLeaderError InvalidRelationDataError NoSuchRelationError MultipleRelationsFoundError

JujuFacade. set_unit_relation_data( self , data , name , id , relation )

Set relation data in the caller's unit databag.

Description

Raises: InvalidRelationDataError NoSuchRelationError MultipleRelationsFoundError

JujuFacade. get_string_config( self , key: str )

Description

Get a string config value. None

JujuFacade. get_int_config( self , key: str )

Description

Get an integer config value. None

JujuFacade. get_bool_config( self , key: str )

Description

Get a boolean config value. None

JujuFacade. get_storage_location( self , storage_name: str )

Description

Get the storage location. None

JujuFacade. get_binding( self , relation_name , relation , relation_id )

Description

Get the binding for the given relation. None

JujuFacade. get_egress_subnets( self , relation_name: str , relation_id , relation )

Get the list of egress subnets for the given relation.

Description

This returns how units on the relation will see the charm connecting from. For example ['10.0.0.1/32', '10.1.1.1/32']

JujuFacade. get_ingress_address( self , relation_name , relation , relation_id )

Description

Get the ingress address for the given relation. None

JujuFacade. get_bind_address( self , relation_name: str , relation_id , relation )

Description

Get the bind address for the given relation. None

JujuFacade. model_name( self )

Description

Get the model name. None

JujuFacade. app_name( self )

Description

Get the application name. None

JujuFacade. unit_name( self )

Description

Get the unit name. None

JujuFacade. model_storage_names( self )

Description

Get the model storage names. None

JujuFacade. is_leader( self )

Description

Check if the unit is leader. None