SaltDns. Zones. Validate
(Salt v1.0.0)
Validation and normalisation of rrsets.
normalise_rrset/3 takes user input (atom or string keys) and returns a
normalised rrset or a list of SaltDns.Zones.Error values, each with the
path of the offending field. check_conflicts/2 applies the rules that
involve other rrsets of the same name (CNAME exclusivity).
Input shape:
%{name: "WWW.example.com", type: "a", ttl: 300,
records: ["192.0.2.1", %{rdata: "192.0.2.2", disabled: true}]}Normalised shape:
%{name: "www.example.com", type: "A", ttl: 300,
records: [%{rdata: "192.0.2.1", disabled: false}, ...]}Records are sorted by rdata and de-duplicated. The names of the owner and
of names inside rdata are lower-case A-labels (see SaltDns.Zones.Name).
System-managed data is refused: SOA, the apex NS and everything DNSSEC produces. DS and NS records are only accepted below the apex, as child delegations.
Summary
Functions
Checks rrset against the other rrsets at the same name.
Normalises and validates an rrset for zone.
True when at least one record of the rrset is enabled.
The record types the system manages and nobody may write (SOA, DNSSEC).
The inclusive TTL bounds every organisation must stay within.
Types
@type rrset() :: %{ name: String.t(), type: String.t(), ttl: pos_integer(), records: [rrset_record()] }
Functions
@spec check_conflicts(rrset(), [rrset()]) :: :ok | {:error, [SaltDns.Zones.Error.t()]}
Checks rrset against the other rrsets at the same name.
A CNAME may not share its name with any other type, and no other type may be added where a CNAME is served. Rrsets whose records are all disabled are not served and do not conflict.
@spec normalise_rrset(String.t(), map(), keyword()) :: {:ok, rrset()} | {:error, [SaltDns.Zones.Error.t()]}
Normalises and validates an rrset for zone.
Options:
:ttl_min,:ttl_max- the organisation's TTL bounds (within 60..604800):ttl_floor- a lower global minimum, for records the system writes itself:default_ttl- used when the input has nottl
True when at least one record of the rrset is enabled.
@spec system_types() :: [String.t()]
The record types the system manages and nobody may write (SOA, DNSSEC).
@spec ttl_bounds() :: {pos_integer(), pos_integer()}
The inclusive TTL bounds every organisation must stay within.