SaltDns. Registrar
(Salt v1.0.0)
The optional registrar module: Salt DNS holds accounts at domain registrars
and buys, renews and manages domain names through them. An outside billing
system only coordinates: it asks Salt, and registrar credentials never
leave Salt. Off unless SALT_DNS_REGISTRAR=on; an installation without it
is unchanged. See docs/registrar.md.
The registrar is reached through an adapter (SaltDns.Registrar.Adapter,
the plug-in point); SaltDns.Registrar.Openprovider is the one Salt ships.
Adapters are registered by name and each provider row names its adapter:
config :salt_dns, SaltDns.Registrar,
adapters: %{"openprovider" => SaltDns.Registrar.Openprovider}Creating zones is not part of this module: it only sets the name servers of a registered name.
Name servers and glue
A name server is a plain host name or a map with :name and the optional
:ipv4 and :ipv6. A name server that is the domain itself or under it
(in bailiwick) must have an address (glue); an address on one outside the
domain is refused, because the registry ignores or refuses it. See
SaltDns.Registrar.NameServers. The addresses a domain is read with are kept
in domain.name_server_addresses and carried forward by a later
set_name_servers/4 that names the same server without an address.
Money
Money is always an integer in minor units (cents) next to an ISO currency
code: %{minor: 1117, currency: "USD"}. See SaltDns.Registrar.Money.
Calls that spend money
register/3, transfer/3, renew/4 and restore/3 spend money; nothing
else in this module does. Each has three guards:
- An operation reference (
:reference, chosen by the caller, unique per organisation). The same reference never buys twice. A row of the operations ledger (SaltDns.Registrar.Operation) is inserted before the registrar is called. The same reference with the same request (the fingerprint: kind, name, years, owner contact, privacy, ceiling, currency, and the name servers with their glue when there is any) returns the stored operation and buys nothing, also when the first call is still with the registrar. The same reference with another request is:reference_reuse. - A price ceiling (
:max_cost_minorand:currency). Salt reads the price from the registrar immediately before buying and refuses with:price_above_ceilingif it is higher or in another currency. - Premium names are refused (
:invalidwithpremium: true) unless the call hasallow_premium: true; the premium price must still be within the ceiling.
What a caller gets
{:ok, operation} with operation.state :done, :pending (the registrar
has not finished; sync_domain/2 resolves it) or :started (a repeat of a
call that is still with the registrar), and operation.domain (nil until
the registrar has taken the order), or {:error, {kind, message}}. A
repeat of a failed operation returns the same error.
When a call ends without a final answer (the registrar was not reached, or
the process died), the operation stays :started. The next call with the
same reference first looks the name up at the registrar (lookup/2 of the
adapter) and completes the operation from what it finds; only when the name
is not there does it order. A :started operation that ended with an
error is resumed at once; one that just sits there is left alone for
:stale_after seconds (default 600, longer than the slowest execution can
take, see default_stale_after/0) so a call that is still running is not
doubled.
Errors
{:error, {kind, message}} with kind one of :insufficient_funds,
:name_unavailable, :price_above_ceiling, :reference_reuse,
:invalid, :rate_limited, :registrar_unavailable, :not_found,
:locked, :unauthorized and :provider. message is a string, or a map
with a :message and extras: :current_minor, :current_currency,
:ceiling_minor and :ceiling_currency (:price_above_ceiling), :fields
(:invalid), :retry_after in seconds (:rate_limited).
Contacts
A contact (the registrant) goes to the registrar and Salt keeps only the
caller's reference, its version and the registrar's handle
(SaltDns.Registrar.Contact). Admin, tech and billing contacts of every
name are the provider's company_handle.
History
Every operation and connection test leaves a SaltDns.Registrar.Event.
Events hold names, amounts and error kinds; never credentials, auth codes
or personal data. (The zone audit table is for zone changes and does not fit
here; certificates keep their own events table in the same way.)
Summary
Functions
Gives up an operation that is stuck at :started, so that its name is free
again (the live-acquisition index of an operation in flight blocks every
other order for the name). It never abandons blindly: it first looks the
name up at the registrar.
The account at the registrar: {:ok, %{balance: minor, reserved: minor, currency: "USD"}}.
The currency of the registrar account, read from it and kept a few minutes. The API refuses a request in another currency instead of converting.
The provider an organisation's calls go to (the organisation of an API token;
a provisioning token's customers are served through its own organisation):
its own provider that is not disabled (the oldest), else a shared provider
(one of no organisation) that is not disabled and that lists the
organisation as allowed (see allow_organisation/2), else nil. A shared
provider is never used by an organisation the operator has not allowed, at
any level, including reading the account.
The adapter module of a provider, or nil when its name is not registered.
The names of the registered adapters, sorted.
The registered adapters, by name.
Lets an organisation use a shared provider (one of no organisation). Only
the operator does this, from the command line (SaltDns.Release.registrar_allow/2);
no console page and no API call reaches it. Returns the provider.
The transfer authorisation code. It is returned and never stored or logged; only the fact that it was asked for is recorded.
Changeset for the provider form.
Whether names are free, with what they cost for period years (option
period, default 1). One map per name
The one thing the background work does to an operation that is :started:
look the name up at the registrar and complete the operation from what is
found. The adapter calls made here are lookup/2 and nothing else (no
price read, no register, transfer, renew or restore), so this function cannot
place an order. Returns :completed, :nothing_ordered (the registrar does
not have the name, or not as ordered; the operation is left open so the
caller's next call with the reference orders it), :open (the lookup failed)
or :busy (another call has the operation).
The state of the e-mail verification of a contact:
{:ok, %{state: :verified | :pending | :failed | :none, status: String.t() | nil}}.
Adds a provider to an organisation (nil for one shared by the whole
installation). Nothing is sent to the registrar; test_connection/1 does
that.
The names of the API tokens that asked for these operations, by credential id.
The default number of seconds after which an operation that sits at
:started with no error is taken for dead. It is longer than the slowest
execution (a lookup, a price read and the order, each at most 4 requests of
40 s); the clock is restarted just before the order. Change it with
config :salt_dns, SaltDns.Registrar, stale_after: seconds.
Deletes a provider that no domain, operation or contact uses.
Turns a provider off: nothing is sent to it until enable_provider/1.
Takes an organisation off the list of a shared provider (operator, command line).
Turns a disabled provider on again (status :new: test the connection).
True when the module is switched on (SALT_DNS_REGISTRAR=on).
Fails one operation that stayed :started although the registrar answered
with its own error code: a refusal (a non-zero code in the registrar's
envelope, HTTP 500 included) means nothing was ordered, so the operation
must not keep its name held or be resumed. Only an operation in
:started whose recorded error is such a refusal is changed; anything else
is refused. Writes the same operation.failed event as any other failure.
The contact stored under the caller's reference, or nil.
A domain of the organisation by id (an integer or its text), or nil.
A domain of the organisation by name, or nil.
The operation the organisation stored under a reference (with its domain), or nil.
A provider the organisation may use (see list_providers/1), or nil. id is an integer or its text.
A provider by id, without an organisation check (internal).
The domains of an organisation, by name.
The latest history of a domain, newest first.
The latest operations of an organisation, newest first.
The providers an organisation may use: its own, and the shared ones (those of no organisation) it has been allowed to use by the operator. A shared provider the organisation is not allowed to use is not listed at all.
The price of one operation on a domain for period years, read from the
registrar now and stored nowhere: :create, :renew, :transfer or
:restore. This is the price shown before a renewal; renew/4 reads it
again just before it buys and refuses above the ceiling the caller gives.
The price list of an extension ("com") for period years (option
period, default 1): see SaltDns.Registrar.Adapter.price_list/0. The
totals are the registrar's own for that period. The list has :fetched_at,
when the registrar was asked. Cached for a few minutes per extension and
period; fresh: true skips the cache.
Creates or updates a registrant contact at the registrar. ref is the
caller's reference for it (unique per organisation) and version the
number the caller keeps: the contact is created the first time, updated
when version is higher than the stored one, and left alone (nothing is
sent) when it is the same. An older version is :invalid. contact is a
map with :name (%{first_name:, last_name:}), :company_name, :email,
:phone (%{country_code:, area_code:, subscriber_number:}), :address
(%{street:, number:, zipcode:, city:, country:}) and :locale. Salt does
not keep it; only the registrar does.
Reads again every domain the registrar holds for us that has not been read for 20 hours: expiry, status, lock, name servers. Returns how many were read.
Registers a name. params: :name, :years (1 to 10), :owner_contact
(the reference of a contact from put_contact/5, at this provider),
:name_servers (host names; empty means the registrar's default),
:privacy (default false) and :autorenew (default false). opts:
:organisation (the owner of the domain), :reference, :max_cost_minor,
:currency, :allow_premium (default false). Admin, tech and billing
contacts are the provider's company_handle, which must be set. See the
module documentation for the guards and the return values.
Renews a domain of the organisation for years (1 to 10); a domain of another
organisation is :not_found. opts: :reference,
:max_cost_minor, :currency, :allow_premium.
Sends the verification e-mail of a contact again.
Restores a domain in its redemption period. opts as for renew/4.
Looks at every operation that has been :started for longer than the stale
time (a crash or a timeout in the middle). It never orders anything. For
each one it asks the registrar whether the name is there
(complete_from_lookup/1), completes the operation if it is, and leaves it
for the caller's retry if it is not. Returns %{completed: n, open: n}.
Sends the expiry reminders that are due (60, 30 and 7 days before a domain
expires) to the owners and admins of its organisation. See
SaltDns.Registrar.Reminders; returns its counts.
True when the registrar account of via (the organisation of the API token,
see active_provider/1) is the one the domain is held at. Only then may a
call that reaches the registrar, or hands out a secret, be made through the
domain; otherwise only the stored record may be read.
Sets automatic renewal at the registrar, then stores it.
Turns DNSSEC on or off at the registrar. dnssec is %{enabled: boolean, keys: [%{flags:, protocol:, alg:, pub_key:}]}: the DNSKEY fields of the
zone's keys, not a DS record.
Sets the transfer lock at the registrar, then stores it.
Replaces the name servers at the registrar, then stores them. Each entry is a
host name or a map with :name and the optional :ipv4 and :ipv6 (see
SaltDns.Registrar.NameServers). An in-bailiwick name server needs an
address; an address on an out-of-bailiwick one is refused. An address stored
with the domain is kept when its name server is given again without one.
Turns WHOIS privacy at the registrar on or off, then stores it. Whether the
extension allows it is the registrar's answer: {:error, {:invalid, message}}
when it does not.
Reads again every operation that is :pending (the registrar had not
finished), by syncing its domain. Returns how many were looked at.
Reads the domain again from the registrar and stores what it says: status,
dates, renewal, lock, privacy, name servers, DNSSEC. When the registrar now
says the name is active, operations of it that were :pending become
:done; when it says the order failed, they become :failed. A domain
with no registrar reference cannot be read.
Logs in and reads the account, then stores the result: status :ok with
the last error cleared, or :error with the registrar's message in
last_error. Returns the provider as stored and the account (see
account/1), or the provider as stored and the error.
Starts a transfer in. params as for register/3, with :auth_code (the
code the current registrar gave; it is sent and never stored or logged) and
:years defaulting to 1. The operation is usually :pending; sync_domain/2
resolves it.
Changes a provider's name, adapter, user name, company handle, password
(blank keeps the old one) or mode. A change of the adapter, credentials or
mode sets the status back to :new until the connection is tested again.
Types
Functions
@spec abandon_operation(SaltDns.Accounts.Organisation.t(), String.t(), keyword()) :: {:ok, SaltDns.Registrar.Operation.t()} | error()
Gives up an operation that is stuck at :started, so that its name is free
again (the live-acquisition index of an operation in flight blocks every
other order for the name). It never abandons blindly: it first looks the
name up at the registrar.
- the registrar holds the name as ordered (or the renewal is shown to have gone through): the operation is completed, not abandoned;
- the registrar does not hold the name, or holds it without the order
having happened: the operation becomes
:failedwith the kind:providerand the message "abandoned"; - the lookup fails, or the renewal cannot be shown either way: nothing changes and the error is returned.
An operation that is still within :stale_after seconds of its last sign of
life, and has no error recorded, is taken to be running and is refused.
Whatever its error, "nothing was ordered" is concluded only when the last
attempt is at least :stale_after seconds old (after a timeout the registrar
may still complete the order); before that, when the lookup finds nothing,
the call is refused with :invalid and nothing changes. A name that is
found is completed at any age.
Returns the operation.
@spec account(SaltDns.Registrar.Provider.t()) :: {:ok, map()} | error()
The account at the registrar: {:ok, %{balance: minor, reserved: minor, currency: "USD"}}.
@spec account_currency(SaltDns.Registrar.Provider.t()) :: {:ok, String.t()} | error()
The currency of the registrar account, read from it and kept a few minutes. The API refuses a request in another currency instead of converting.
@spec active_provider(SaltDns.Accounts.Organisation.t()) :: SaltDns.Registrar.Provider.t() | nil
The provider an organisation's calls go to (the organisation of an API token;
a provisioning token's customers are served through its own organisation):
its own provider that is not disabled (the oldest), else a shared provider
(one of no organisation) that is not disabled and that lists the
organisation as allowed (see allow_organisation/2), else nil. A shared
provider is never used by an organisation the operator has not allowed, at
any level, including reading the account.
@spec adapter(SaltDns.Registrar.Provider.t()) :: module() | nil
The adapter module of a provider, or nil when its name is not registered.
@spec adapter_names() :: [String.t()]
The names of the registered adapters, sorted.
The registered adapters, by name.
@spec allow_organisation(SaltDns.Registrar.Provider.t(), integer()) :: {:ok, SaltDns.Registrar.Provider.t()} | {:error, :not_shared}
Lets an organisation use a shared provider (one of no organisation). Only
the operator does this, from the command line (SaltDns.Release.registrar_allow/2);
no console page and no API call reaches it. Returns the provider.
@spec auth_code( SaltDns.Accounts.Organisation.t(), SaltDns.Registrar.Domain.t(), keyword() ) :: {:ok, String.t()} | error()
The transfer authorisation code. It is returned and never stored or logged; only the fact that it was asked for is recorded.
@spec change_provider(SaltDns.Registrar.Provider.t(), map()) :: Ecto.Changeset.t()
Changeset for the provider form.
@spec check(SaltDns.Registrar.Provider.t(), [String.t()], keyword()) :: {:ok, [map()]} | error()
Whether names are free, with what they cost for period years (option
period, default 1). One map per name:
%{name: "example.org",
status: :free | :taken | :premium | :unavailable,
period: years,
costs: %{create: money, renew: money, transfer: money, restore: money,
renew_yearly: money},
promotion: nil | %{ends_on: Date | nil, non_promotion: money},
min_period: years, max_period: years, privacy_allowed: boolean,
quarantine_days: days, soft_quarantine_days: days, fetched_at: DateTime}create, renew and transfer are totals for the period, read from the
registrar for that period and never multiplied; renew_yearly is the price
of renewing for one year. For a period of one year create is the
registrar's price for that very name (it differs for premium names); for
longer periods it is the price of the extension, and the price of the name
itself is read again when it is ordered. The price list is cached for a few
minutes per extension and period. A cost the registrar did not give is nil.
Options: fresh: true skips the cache. A period the extension does not allow
is :invalid naming the field "period". At most 100 names; they are
normalised and repeated names are asked once.
@spec complete_from_lookup(SaltDns.Registrar.Operation.t()) :: :completed | :nothing_ordered | :open | :busy
The one thing the background work does to an operation that is :started:
look the name up at the registrar and complete the operation from what is
found. The adapter calls made here are lookup/2 and nothing else (no
price read, no register, transfer, renew or restore), so this function cannot
place an order. Returns :completed, :nothing_ordered (the registrar does
not have the name, or not as ordered; the operation is left open so the
caller's next call with the reference orders it), :open (the lookup failed)
or :busy (another call has the operation).
@spec contact_verification( SaltDns.Registrar.Provider.t(), SaltDns.Accounts.Organisation.t(), String.t(), keyword() ) :: {:ok, map()} | error()
The state of the e-mail verification of a contact:
{:ok, %{state: :verified | :pending | :failed | :none, status: String.t() | nil}}.
@spec create_provider(SaltDns.Accounts.Organisation.t() | nil, map()) :: {:ok, SaltDns.Registrar.Provider.t()} | {:error, Ecto.Changeset.t()}
Adds a provider to an organisation (nil for one shared by the whole
installation). Nothing is sent to the registrar; test_connection/1 does
that.
@spec credential_names([SaltDns.Registrar.Operation.t()]) :: %{ required(integer()) => String.t() }
The names of the API tokens that asked for these operations, by credential id.
@spec default_stale_after() :: pos_integer()
The default number of seconds after which an operation that sits at
:started with no error is taken for dead. It is longer than the slowest
execution (a lookup, a price read and the order, each at most 4 requests of
40 s); the clock is restarted just before the order. Change it with
config :salt_dns, SaltDns.Registrar, stale_after: seconds.
@spec delete_provider(SaltDns.Registrar.Provider.t()) :: {:ok, SaltDns.Registrar.Provider.t()} | {:error, :in_use}
Deletes a provider that no domain, operation or contact uses.
@spec disable_provider(SaltDns.Registrar.Provider.t()) :: {:ok, SaltDns.Registrar.Provider.t()}
Turns a provider off: nothing is sent to it until enable_provider/1.
@spec disallow_organisation(SaltDns.Registrar.Provider.t(), integer()) :: {:ok, SaltDns.Registrar.Provider.t()} | {:error, :not_shared}
Takes an organisation off the list of a shared provider (operator, command line).
@spec enable_provider(SaltDns.Registrar.Provider.t()) :: {:ok, SaltDns.Registrar.Provider.t()}
Turns a disabled provider on again (status :new: test the connection).
@spec enabled?() :: boolean()
True when the module is switched on (SALT_DNS_REGISTRAR=on).
@spec fail_refused_operation(SaltDns.Accounts.Organisation.t(), integer()) :: {:ok, SaltDns.Registrar.Operation.t()} | error()
Fails one operation that stayed :started although the registrar answered
with its own error code: a refusal (a non-zero code in the registrar's
envelope, HTTP 500 included) means nothing was ordered, so the operation
must not keep its name held or be resumed. Only an operation in
:started whose recorded error is such a refusal is changed; anything else
is refused. Writes the same operation.failed event as any other failure.
@spec get_contact(SaltDns.Accounts.Organisation.t(), String.t()) :: SaltDns.Registrar.Contact.t() | nil
The contact stored under the caller's reference, or nil.
@spec get_domain(SaltDns.Accounts.Organisation.t(), term()) :: SaltDns.Registrar.Domain.t() | nil
A domain of the organisation by id (an integer or its text), or nil.
@spec get_domain_by_fqdn(SaltDns.Accounts.Organisation.t(), String.t()) :: SaltDns.Registrar.Domain.t() | nil
A domain of the organisation by name, or nil.
@spec get_operation(SaltDns.Accounts.Organisation.t(), String.t()) :: SaltDns.Registrar.Operation.t() | nil
The operation the organisation stored under a reference (with its domain), or nil.
@spec get_provider(SaltDns.Accounts.Organisation.t(), term()) :: SaltDns.Registrar.Provider.t() | nil
A provider the organisation may use (see list_providers/1), or nil. id is an integer or its text.
@spec get_provider!(integer()) :: SaltDns.Registrar.Provider.t()
A provider by id, without an organisation check (internal).
@spec list_domains(SaltDns.Accounts.Organisation.t()) :: [ SaltDns.Registrar.Domain.t() ]
The domains of an organisation, by name.
@spec list_events(SaltDns.Registrar.Domain.t(), pos_integer()) :: [ SaltDns.Registrar.Event.t() ]
The latest history of a domain, newest first.
@spec list_operations(SaltDns.Accounts.Organisation.t(), pos_integer()) :: [ SaltDns.Registrar.Operation.t() ]
The latest operations of an organisation, newest first.
@spec list_providers(SaltDns.Accounts.Organisation.t()) :: [ SaltDns.Registrar.Provider.t() ]
The providers an organisation may use: its own, and the shared ones (those of no organisation) it has been allowed to use by the operator. A shared provider the organisation is not allowed to use is not listed at all.
@spec price( SaltDns.Accounts.Organisation.t(), SaltDns.Registrar.Domain.t(), atom(), pos_integer() ) :: {:ok, map()} | error()
The price of one operation on a domain for period years, read from the
registrar now and stored nowhere: :create, :renew, :transfer or
:restore. This is the price shown before a renewal; renew/4 reads it
again just before it buys and refuses above the ceiling the caller gives.
@spec prices(SaltDns.Registrar.Provider.t(), String.t(), keyword()) :: {:ok, map()} | error()
The price list of an extension ("com") for period years (option
period, default 1): see SaltDns.Registrar.Adapter.price_list/0. The
totals are the registrar's own for that period. The list has :fetched_at,
when the registrar was asked. Cached for a few minutes per extension and
period; fresh: true skips the cache.
@spec put_contact( SaltDns.Registrar.Provider.t(), SaltDns.Accounts.Organisation.t(), String.t(), integer(), map(), keyword() ) :: {:ok, SaltDns.Registrar.Contact.t()} | error()
Creates or updates a registrant contact at the registrar. ref is the
caller's reference for it (unique per organisation) and version the
number the caller keeps: the contact is created the first time, updated
when version is higher than the stored one, and left alone (nothing is
sent) when it is the same. An older version is :invalid. contact is a
map with :name (%{first_name:, last_name:}), :company_name, :email,
:phone (%{country_code:, area_code:, subscriber_number:}), :address
(%{street:, number:, zipcode:, city:, country:}) and :locale. Salt does
not keep it; only the registrar does.
Returns {:ok, %SaltDns.Registrar.Contact{}} (the handle is contact.handle).
@spec refresh_domains() :: non_neg_integer()
Reads again every domain the registrar holds for us that has not been read for 20 hours: expiry, status, lock, name servers. Returns how many were read.
@spec register(SaltDns.Registrar.Provider.t(), map(), keyword()) :: {:ok, SaltDns.Registrar.Operation.t()} | error()
Registers a name. params: :name, :years (1 to 10), :owner_contact
(the reference of a contact from put_contact/5, at this provider),
:name_servers (host names; empty means the registrar's default),
:privacy (default false) and :autorenew (default false). opts:
:organisation (the owner of the domain), :reference, :max_cost_minor,
:currency, :allow_premium (default false). Admin, tech and billing
contacts are the provider's company_handle, which must be set. See the
module documentation for the guards and the return values.
@spec renew( SaltDns.Accounts.Organisation.t(), SaltDns.Registrar.Domain.t(), pos_integer(), keyword() ) :: {:ok, SaltDns.Registrar.Operation.t()} | error()
Renews a domain of the organisation for years (1 to 10); a domain of another
organisation is :not_found. opts: :reference,
:max_cost_minor, :currency, :allow_premium.
@spec resend_contact_verification( SaltDns.Registrar.Provider.t(), SaltDns.Accounts.Organisation.t(), String.t(), keyword() ) :: :ok | error()
Sends the verification e-mail of a contact again.
@spec restore( SaltDns.Accounts.Organisation.t(), SaltDns.Registrar.Domain.t(), keyword() ) :: {:ok, SaltDns.Registrar.Operation.t()} | error()
Restores a domain in its redemption period. opts as for renew/4.
@spec resume_stuck() :: %{completed: non_neg_integer(), open: non_neg_integer()}
Looks at every operation that has been :started for longer than the stale
time (a crash or a timeout in the middle). It never orders anything. For
each one it asks the registrar whether the name is there
(complete_from_lookup/1), completes the operation if it is, and leaves it
for the caller's retry if it is not. Returns %{completed: n, open: n}.
@spec send_expiry_reminders() :: %{ sent: non_neg_integer(), failed: non_neg_integer(), skipped: non_neg_integer() }
Sends the expiry reminders that are due (60, 30 and 7 days before a domain
expires) to the owners and admins of its organisation. See
SaltDns.Registrar.Reminders; returns its counts.
@spec served?( SaltDns.Accounts.Organisation.t(), SaltDns.Registrar.Domain.t() | integer() ) :: boolean()
True when the registrar account of via (the organisation of the API token,
see active_provider/1) is the one the domain is held at. Only then may a
call that reaches the registrar, or hands out a secret, be made through the
domain; otherwise only the stored record may be read.
@spec set_autorenew( SaltDns.Accounts.Organisation.t(), SaltDns.Registrar.Domain.t(), boolean(), keyword() ) :: {:ok, SaltDns.Registrar.Domain.t()} | error()
Sets automatic renewal at the registrar, then stores it.
@spec set_dnssec( SaltDns.Accounts.Organisation.t(), SaltDns.Registrar.Domain.t(), map(), keyword() ) :: {:ok, SaltDns.Registrar.Domain.t()} | error()
Turns DNSSEC on or off at the registrar. dnssec is %{enabled: boolean, keys: [%{flags:, protocol:, alg:, pub_key:}]}: the DNSKEY fields of the
zone's keys, not a DS record.
@spec set_lock( SaltDns.Accounts.Organisation.t(), SaltDns.Registrar.Domain.t(), boolean(), keyword() ) :: {:ok, SaltDns.Registrar.Domain.t()} | error()
Sets the transfer lock at the registrar, then stores it.
@spec set_name_servers( SaltDns.Accounts.Organisation.t(), SaltDns.Registrar.Domain.t(), [String.t() | map()], keyword() ) :: {:ok, SaltDns.Registrar.Domain.t()} | error()
Replaces the name servers at the registrar, then stores them. Each entry is a
host name or a map with :name and the optional :ipv4 and :ipv6 (see
SaltDns.Registrar.NameServers). An in-bailiwick name server needs an
address; an address on an out-of-bailiwick one is refused. An address stored
with the domain is kept when its name server is given again without one.
@spec set_privacy( SaltDns.Accounts.Organisation.t(), SaltDns.Registrar.Domain.t(), boolean(), keyword() ) :: {:ok, SaltDns.Registrar.Domain.t()} | error()
Turns WHOIS privacy at the registrar on or off, then stores it. Whether the
extension allows it is the registrar's answer: {:error, {:invalid, message}}
when it does not.
@spec sweep_pending() :: non_neg_integer()
Reads again every operation that is :pending (the registrar had not
finished), by syncing its domain. Returns how many were looked at.
@spec sync_domain( SaltDns.Accounts.Organisation.t(), SaltDns.Registrar.Domain.t(), keyword() ) :: {:ok, SaltDns.Registrar.Domain.t()} | error()
Reads the domain again from the registrar and stores what it says: status,
dates, renewal, lock, privacy, name servers, DNSSEC. When the registrar now
says the name is active, operations of it that were :pending become
:done; when it says the order failed, they become :failed. A domain
with no registrar reference cannot be read.
@spec test_connection(SaltDns.Registrar.Provider.t()) :: {:ok, SaltDns.Registrar.Provider.t(), map()} | {:error, SaltDns.Registrar.Provider.t(), {atom(), String.t() | map()}}
Logs in and reads the account, then stores the result: status :ok with
the last error cleared, or :error with the registrar's message in
last_error. Returns the provider as stored and the account (see
account/1), or the provider as stored and the error.
@spec transfer(SaltDns.Registrar.Provider.t(), map(), keyword()) :: {:ok, SaltDns.Registrar.Operation.t()} | error()
Starts a transfer in. params as for register/3, with :auth_code (the
code the current registrar gave; it is sent and never stored or logged) and
:years defaulting to 1. The operation is usually :pending; sync_domain/2
resolves it.
@spec update_provider(SaltDns.Registrar.Provider.t(), map()) :: {:ok, SaltDns.Registrar.Provider.t()} | {:error, Ecto.Changeset.t()}
Changes a provider's name, adapter, user name, company handle, password
(blank keeps the old one) or mode. A change of the adapter, credentials or
mode sets the status back to :new until the connection is tested again.