netlify_dns_records_set: Set Netlify DNS records

netlify_dns_records_setR Documentation

Set Netlify DNS records

Description

Sets DNS records on Netlify for the specified domain using the createDnsRecord endpoint of Netlify's REST API. DNS records must be provided as a dataframe/tibble with the columns "type", "hostname", "value", "ttl", "priority", "weight", "port", "flag" and "tag". Further columns are silently ignored.

Usage

netlify_dns_records_set(records, domain, token, max_tries = 3L)

Arguments

records

DNS records. A dataframe/tibble with the columns "type", "hostname", "value", "ttl", "priority", "weight", "port", "flag" and "tag". The first three columns are mandatory, columns not listed here are silently ignored.

domain

Domain name to set DNS records for. This is translated into the corresponding Netlify DNS Zone. A character scalar.

token

Personal access token used for authentication.

max_tries

Maximum number of attempts to retry in case of an HTTP error. An integerish scalar.

Details

Supported are the DNS record types ALIAS, CAA, CNAME, MX, NS, SPF, SRV and TXT. A and AAAA (or NETLIFY and NETLIFY6, respectively) cannot be set via the API and must be configured via Netlify's web interface.

Value

The newly set DNS records. A tibble with the columns id, dns_zone_id, site_id, managed, type, hostname, value, ttl, priority, weight, port, flag, and tag, invisibly.

See Also

Other Netlify functions: netlify_dns_records_delete(), netlify_dns_records_get()

Examples

## Not run: 
tibble::tribble(
  ~type,   ~hostname,            ~value,           ~ttl, ~priority, ~weight, ~port, ~flag, ~tag,
  "CAA",   "my.site",            "letsencrypt.org", 3600L, NA,      NA,      NA,    NA,    NA,
  "CNAME", "autoconfig",         "mailbox.org",     3600L, NA,      NA,      NA,    NA,    NA,
  "MX",    "my.site",            "mxext1.mailbox.org", 3600L, NA,   NA,      NA,    NA,    NA,
  "SRV",   "_hkps._tcp.my.site", "pgp.mailbox.org",    3600L, 1L,   1L,      443L,  NA,    NA,
  "TXT",   "_mta-sts",           "v=STSv1; id=001",    3600L, NA,   NA,      NA,    NA,    NA) |>
  yay::netlify_dns_records_set(domain = "my.site",
                               token  = "XYZ1234")
                               
# to use a TOML file that defines a `records` table as input:
pal::toml_read("dns_records.toml")$records |>
  purrr::map_dfr(tibble::as_tibble_row) |>
  yay::netlify_dns_records_set(domain = "my.site",
                               token  = Sys.getenv("NETLIFY_PAT"))
## End(Not run)

salim-b/yay documentation built on May 17, 2024, 5:24 a.m.