Prev: Next: Up: poundctl template[Contents][Index]


10.5.4 Input object

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 by poundctl list. */}}
  ...
{{else if exists . "services"}}
  {{/* Single listener, as requested by poundctl 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 by poundctl list /L/S. */}}
  ...
{{else}}
  {{/* Backend listing (poundctl list /L/I/B) */}}
  ...
{{end}}

Structures of each object are discussed in subsections that follow.