Event

Reference to this set of docs will soon be replaced everywhere by reference to https://ops.readthedocs.io/en/latest/# (which, wherever applicable, will further link to Juju | Hook, reflecting the correct content dependency).

In Ops, an event is a data structure that encapsulates part of the execution context of a charm. In particular, it contains information regarding why this specific execution is taking place. When creating a charm, you write charms and implement handlers that respond to events and state changes communicated by Juju controller using the observer pattern.

The execution context of a charm is expressed in environment variables. For more, see Charm environment variables.

For example:

  • A config-changed event is the data structure used to communicate to the charm that its configuration has changed.
  • A http-relation-departed event is the data structure used to tell the charm that a particular unit is departing the http relation.

See more: