Defdo.DDNS.RecordSnapshot (defdo_ddns v0.5.0)

Copy Markdown

Portable snapshot codec for DDNS records.

This module owns the canonical DDNS record shape and the JSON snapshot interchange format so stores and future adapters can share the same rules.

Summary

Types

record()

@type record() :: %{required(String.t()) => any()}

snapshot()

@type snapshot() :: %{required(String.t()) => any()}

Functions

decode(binary, opts \\ [])

@spec decode(
  String.t(),
  keyword()
) :: {:ok, snapshot()} | {:error, term()}

encode(snapshot, opts \\ [])

@spec encode(
  snapshot(),
  keyword()
) :: {:ok, String.t()} | {:error, term()}

from_legacy_cname_env(binary, opts \\ [])

@spec from_legacy_cname_env(
  String.t(),
  keyword()
) :: {:ok, snapshot()} | {:error, term()}

from_legacy_cname_records(records, opts \\ [])

@spec from_legacy_cname_records(
  [record()],
  keyword()
) :: {:ok, snapshot()} | {:error, term()}

new(records, opts \\ [])

@spec new(
  [record()],
  keyword()
) :: {:ok, snapshot()} | {:error, term()}

normalize_records(records, opts \\ [])

@spec normalize_records(
  [record()],
  keyword()
) :: {:ok, [record()]} | {:error, term()}

validate_snapshot(snapshot, opts \\ [])

@spec validate_snapshot(
  map() | any(),
  keyword()
) :: {:ok, snapshot()} | {:error, term()}