Channel Revision Published Runs on
6/stable 229 20 Aug 2025
Ubuntu 22.04
6/candidate 229 20 Aug 2025
Ubuntu 22.04
6/beta 229 20 Aug 2025
Ubuntu 22.04
6/edge 229 20 Aug 2025
Ubuntu 22.04
8-transition/edge 233 01 Oct 2025
Ubuntu 24.04
8/candidate 228 07 Aug 2025
Ubuntu 24.04
8/beta 228 07 Aug 2025
Ubuntu 24.04
8/edge 232 29 Sep 2025
Ubuntu 24.04
juju deploy mongodb --channel 6/stable
Show information

Platform:

Ubuntu
24.04 22.04

charms.mongodb.v0.mongodb_secrets

Secrets related helper classes/functions.


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