SaltDns. Proxy. State
(Salt v1.0.0)
Builds the state plaintext sent to a Shaker node. Pure.
The shape is exactly the one in the Salt/Shaker contract: string keys, RFC
3339 UTC times, and a config object holding the software, version line,
SHA-256 and complete generated configuration. issued_at is passed in, so
nothing here reads a clock and the same input always produces the same
state and the same canonical JSON bytes.
The routes and backends are validated before they reach the state: host
names and backend names must be valid for HAProxy, a route may not point at
a backend missing from backends ({:error, {:unknown_backend, name}}),
and the configuration is rendered by SaltDns.Proxy.HaproxyConfig so the
same checks apply to the file Shaker will write.
Summary
Functions
Builds the state map.
Encodes a state as canonical JSON: object keys sorted, no insignificant whitespace, and the same bytes for the same value.
Types
Functions
Builds the state map.
Input keys (atom or string keys): generation, issued_at, certificates,
routes, backends, default_backend, paths, version_line, socket_group,
drop_privileges, run_user, run_group and http01_thumbprint (see
HaproxyConfig.render/1).
Certificates are maps with id, version, names and not_after; their
names are normalised like routes, the version is lower-cased hexadecimal and
times are reduced to whole seconds in UTC. Routes are normalised, sorted and
deduplicated by Routes.split/1.
Returns {:ok, state} or the first validation error, including
{:error, {:unknown_backend, name}} when a route names a backend that is
not in backends.
Encodes a state as canonical JSON: object keys sorted, no insignificant whitespace, and the same bytes for the same value.
This is the form Shaker hashes and signs, so it must not depend on map iteration order.