Depending on the request issued by poundctl
, the invoked template
can receive as its argument (dot) an object of the following
types: full listing, listener, service, or backend.
Since there is no explicit indication of the object type being passed, templates normally use heuristics based on the presence or absence of certain attribute to deduce the object type in question. The recommended approach is described in the following pseudo-code fragment:
{{if exists . "listeners" }} {{/* This is a full listing, as requested bypoundctl list
. */}} ... {{else if exists . "services"}} {{/* Single listener, as requested bypoundctl list /L
. Notice that this attribute is present in the full listing as well, so presence of "listeners" should be checked first. */}} ... {{else if exists . "backends"}} {{/* Single service, as requested bypoundctl list /L/S
. */}} ... {{else}} {{/* Backend listing (poundctl list /L/I/B
) */}} ... {{end}}
Structures of each object are discussed in subsections that follow.