# `class GrafanaDashboardProvides(RequesterEndpoint)`
Base class for Endpoints that create requests in the request / response
pattern.
Subclasses **must** set the ``REQUEST_CLASS`` attribute to a subclass
of :class:`BaseRequest` which defines the fields the request will use.
## `all_departed_units`
Collection of all units that were previously part of any relation on
this endpoint but which have since departed.
This collection is persistent and mutable. The departed units will
be kept until they are explicitly removed, to allow for reasonable
cleanup of units that have left.
Example: You need to run a command each time a unit departs the relation.
.. code-block:: python
@when('endpoint.{endpoint_name}.departed')
def handle_departed_unit(self):
for name, unit in self.all_departed_units.items():
# run the command to remove `unit` from the cluster
# ..
self.all_departed_units.clear()
clear_flag(self.expand_name('departed'))
Once a unit is departed, it will no longer show up in
:attr:`all_joined_units`. Note that units are considered departed as
soon as the departed hook is entered, which differs slightly from how
the Juju primitives behave (departing units are still returned from
``related-units`` until after the departed hook is complete).
This collection is a :class:`KeyList`, so can be used as a mapping to
look up units by their unit name, or iterated or accessed by index.
## `all_joined_units`
A list view of all the units of all relations attached to this
:class:`~charms.reactive.endpoints.Endpoint`.
This is actually a
:class:`~charms.reactive.endpoints.CombinedUnitsView`, so the units
will be in order by relation ID and then unit name, and you can access a
merged view of all the units' data as a single mapping. You should be
very careful when using the merged data collections, however, and
consider carefully what will happen when the endpoint has multiple
relations and multiple remote units on each. It is probably better to
iterate over each unit and handle its data individually. See
:class:`~charms.reactive.endpoints.CombinedUnitsView` for an
explanation of how the merged data collections work.
Note that, because a given application might be related multiple times
on a given endpoint, units may show up in this collection more than
once.
## `all_units`
.. deprecated:: 0.6.1
Use :attr:`all_joined_units` instead
## `endpoint_name`
Relation name of this endpoint.
## `failed_imports`
A list of requests that failed to import.
## `is_joined`
Whether this endpoint has remote applications attached to it.
## `joined`
.. deprecated:: 0.6.3
Use :attr:`is_joined` instead
## `def manage_flags(self)`
Method that subclasses can override to perform any flag management
needed during startup.
This will be called automatically after the framework-managed automatic
flags have been updated.
## `def register_dashboard(self, name, dashboard)`
Request a dashboard to be imported.
:param name: Name of dashboard. Informational only, so that you can
tell which dashboard request this was, e.g. to check for success or
failure.
:param dashboard: Data structure defining the dashboard. Must be JSON
serializable. (Note: This should *not* be pre-serialized JSON.)
## `relations`
Collection of :class:`Relation` instances that are established for
this :class:`Endpoint`.
This is a :class:`KeyList`, so it can be iterated and indexed as a list,
or you can look up relations by their ID. For example::
rel0 = endpoint.relations[0]
assert rel0 is endpoint.relations[rel0.relation_id]
assert all(rel is endpoint.relations[rel.relation_id]
for rel in endpoint.relations)
print(', '.join(endpoint.relations.keys()))
## `requests`
A list of all requests which have been submitted.
## `responses`
A list of all responses which have been received.