DNS zones. bunny.net can host your domain's DNS alongside its CDN. A zone
represents a domain and contains DNS records managed through Bunnyx.DnsRecord.
Uses the main API client created with Bunnyx.new/1.
Usage
client = Bunnyx.new(api_key: "sk-...")
{:ok, zone} = Bunnyx.DnsZone.create(client, domain: "example.com")
{:ok, zone} = Bunnyx.DnsZone.get(client, zone.id)
{:ok, page} = Bunnyx.DnsZone.list(client)
{:ok, zone} = Bunnyx.DnsZone.update(client, zone.id, logging_enabled: true)
{:ok, nil} = Bunnyx.DnsZone.delete(client, zone.id)Fetching a zone with get/2 includes its records as a list of %Bunnyx.DnsRecord{}
structs in the :records field.
Summary
Functions
Checks if a DNS zone name is available.
Creates a DNS zone with the given attributes.
Deletes a DNS zone.
Disables DNSSEC for a DNS zone.
Enables DNSSEC for a DNS zone.
Exports a DNS zone as a BIND-format zone file.
Fetches a DNS zone by ID, including its records.
Imports DNS records from a BIND-format zone file.
Issues a wildcard certificate for a DNS zone.
Lists DNS zones.
Returns DNS zone query statistics.
Updates a DNS zone.
Types
@type t() :: %Bunnyx.DnsZone{ certificate_key_type: integer() | nil, custom_nameservers_enabled: boolean() | nil, date_created: String.t() | nil, date_modified: String.t() | nil, dns_sec_enabled: boolean() | nil, domain: String.t() | nil, id: pos_integer() | nil, log_anonymization_type: integer() | nil, logging_enabled: boolean() | nil, logging_ip_anonymization_enabled: boolean() | nil, nameserver1: String.t() | nil, nameserver2: String.t() | nil, nameservers_detected: boolean() | nil, nameservers_next_check: String.t() | nil, records: [Bunnyx.DnsRecord.t()] | nil, soa_email: String.t() | nil }
Functions
@spec check_availability(Bunnyx.t() | keyword(), String.t()) :: {:ok, boolean()} | {:error, Bunnyx.Error.t()}
Checks if a DNS zone name is available.
@spec create(Bunnyx.t() | keyword(), Bunnyx.Params.attrs()) :: {:ok, t()} | {:error, Bunnyx.Error.t()}
Creates a DNS zone with the given attributes.
@spec delete(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Deletes a DNS zone.
@spec disable_dnssec(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Disables DNSSEC for a DNS zone.
@spec enable_dnssec(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Enables DNSSEC for a DNS zone.
@spec export(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, String.t()} | {:error, Bunnyx.Error.t()}
Exports a DNS zone as a BIND-format zone file.
@spec get(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, t()} | {:error, Bunnyx.Error.t()}
Fetches a DNS zone by ID, including its records.
@spec import_records(Bunnyx.t() | keyword(), pos_integer(), String.t()) :: {:ok, %{ records_successful: integer(), records_failed: integer(), records_skipped: integer() }} | {:error, Bunnyx.Error.t()}
Imports DNS records from a BIND-format zone file.
@spec issue_certificate(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Issues a wildcard certificate for a DNS zone.
@spec list( Bunnyx.t() | keyword(), keyword() ) :: {:ok, %{ items: [t()], current_page: integer(), total_items: integer(), has_more_items: boolean() }} | {:error, Bunnyx.Error.t()}
Lists DNS zones.
Options
:page— page number:per_page— items per page:search— search term
@spec statistics(Bunnyx.t() | keyword(), pos_integer(), keyword()) :: {:ok, %{ total_queries_served: integer(), queries_served_chart: map(), normal_queries_served_chart: map(), smart_queries_served_chart: map(), queries_by_type_chart: map() }} | {:error, Bunnyx.Error.t()}
Returns DNS zone query statistics.
Options
:date_from— start date (ISO 8601 string):date_to— end date (ISO 8601 string)
@spec update(Bunnyx.t() | keyword(), pos_integer(), Bunnyx.Params.attrs()) :: {:ok, t()} | {:error, Bunnyx.Error.t()}
Updates a DNS zone.