SaltDns.Shaker.Source behaviour (Salt v1.0.0)

What Salt sends a Shaker, supplied by an implementation instead of spelling the certificate tables into the Shaker channel.

The certificate module (another part of Salt) will implement this; the channel and bootstrap code only know the two calls below. The implementation is chosen by application environment:

config :salt_dns, SaltDns.Shaker, source: MyCertificateModule

The default, SaltDns.Shaker.Source.Empty, sends an empty desired state (generation 0) and no certificates.

desired_state/1 returns a map in the shape of contract 3.4 (generation, issued_at, certificates, routes, backends, default_backend, config). certificate/3 returns the plaintext of a certificate envelope for one certificate version, or :not_found / :not_allowed. A node only gets a certificate its current desired state names; the channel enforces that before calling certificate/3.

Summary

Callbacks

certificate(t, t, t)

@callback certificate(SaltDns.Shaker.Node.t(), String.t(), String.t()) ::
  {:ok, map()} | {:error, :not_found | :not_allowed}

desired_state(t)

@callback desired_state(SaltDns.Shaker.Node.t()) :: {:ok, map()} | {:error, term()}