Skip to content

Commit

Permalink
define new methods as properties
Browse files Browse the repository at this point in the history
  • Loading branch information
arturo-seijas committed Nov 17, 2023
1 parent 4e31c14 commit f2cdf0d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/charms/redis_k8s/v0/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def _on_relation_broken(self, event):
# Trigger an event that our charm can react to.
self.charm.on.redis_relation_updated.emit()

def get_relation_data(self) -> Optional[Dict[str, str]]:
@property
def relation_data(self) -> Optional[Dict[str, str]]:
"""Retrieve the relation data.
Returns:
Expand All @@ -105,7 +106,8 @@ def get_relation_data(self) -> Optional[Dict[str, str]]:
unit = next(iter(relation.units))
return relation.data[unit]

def get_url(self) -> Optional[str]:
@property
def url(self) -> Optional[str]:
"""Retrieve the Redis URL.
Returns:
Expand Down

0 comments on commit f2cdf0d

Please sign in to comment.