Data Platform Libs

Channel Revision Published Runs on
latest/stable 81 19 Nov 2024
Ubuntu 22.04
latest/edge 82 04 Dec 2024
Ubuntu 22.04
juju deploy data-platform-libs
Show information

Platform:

Ubuntu
22.04

charms.data_platform_libs.v0.data_secrets

Secrets related helper classes/functions.


class DataSecretsError

Description

A secret that we want to create already exists. None

class SecretAlreadyExistsError

Description

A secret that we want to create already exists. None

def generate_secret_label(
    charm: CharmBase,
    scope: Scopes
)

Generate unique group_mappings for secrets within a relation context.

Description

Defined as a standalone function, as the choice on secret labels definition belongs to the Application Logic. To be kept separate from classes below, which are simply to provide a (smart) abstraction layer above Juju Secrets.

class CachedSecret

Abstraction layer above direct Juju access with caching.

Description

The data structure is precisely re-using/simulating Juju Secrets behavior, while also making sure not to fetch a secret multiple times within the same event scope.

Methods

CachedSecret. __init__( self , charm: CharmBase , label: str , secret_uri )

CachedSecret. add_secret( self , content , scope: Scopes )

Description

Create a new secret. None

CachedSecret. meta( self )

Description

Getting cached secret meta-information. None

CachedSecret. get_content( self )

Description

Getting cached secret content. None

CachedSecret. set_content( self , content )

Description

Setting cached secret content. None

CachedSecret. get_info( self )

Description

Wrapper function for get the corresponding call on the Secret object if any. None

class SecretCache

Description

A data structure storing CachedSecret objects. None

Methods

SecretCache. __init__( self , charm )

SecretCache. get( self , label: str , uri )

Description

Getting a secret from Juju Secret store or cache. None

SecretCache. add( self , label: str , content , scope: Scopes )

Description

Adding a secret to Juju Secret. None