Charmed Redis K8s

Channel Revision Published Runs on
latest/stable 7 12 May 2021
Ubuntu 20.04
latest/edge 38 11 Nov 2024
Ubuntu 22.04 Ubuntu 20.04
latest/edge 23 05 Dec 2022
Ubuntu 22.04 Ubuntu 20.04
juju deploy redis-k8s
Show information

Platform:

charms.redis_k8s.v0.redis

Library for the redis relation.

This library contains the Requires and Provides classes for handling the redis interface.

Import RedisRequires in your charm by adding the following to src/charm.py:

from charms.redis_k8s.v0.redis import RedisRequires

Define the following attributes in charm charm class for the library to be able to work with it

    on = RedisRelationCharmEvents()

And then wherever you need to reference the relation data it will be available in the property relation_data:

redis_host = self.redis.relation_data.get("hostname")
redis_port = self.redis.relation_data.get("port")

You will also need to add the following to metadata.yaml:

requires:
  redis:
    interface: redis

class RedisRelationUpdatedEvent

Description

An event for the redis relation having been updated. None

class RedisRelationCharmEvents

Description

A class to carry custom charm events so requires can react to relation changes. None

class RedisRequires

Methods

RedisRequires. __init__( self , charm , relation_name: str )

Description

A class implementing the redis requires relation. None

RedisRequires. app_data( self )

Retrieve the app data.

Returns

Dict

dict containing the app data.

RedisRequires. relation_data( self )

Retrieve the relation data.

Returns

Dict

dict containing the relation data.

RedisRequires. url( self )

Retrieve the Redis URL.

Returns

str

the Redis URL.

class RedisProvides

Methods

RedisProvides. __init__( self , charm , port )

Description

A class implementing the redis provides relation. None