Skip to main content

Unifi

@mccormick/unifiv2026.06.09.1· 3d agoMODELS
01README

Custom/static DNS records on a local UniFi Network controller. The @mccormick/unifi/dns model reads, upserts, and deletes the custom DNS records a UniFi OS console serves on its LAN. list_records writes one dns_record resource per entry; upsert_record creates or updates a single record in place (find by key+type, PUT when it exists, else POST); delete_record removes one (idempotent). The mutating methods are gated by a live pre-flight check that confirms the controller is reachable before any write. This turns a cutover DNS flip — repointing a hostname at a new host — into a composable, reusable model method. Targets the local controller's internal v2 API (/proxy/network/v2/api/site/<site>/static-dns) with an X-API-KEY header. The cloud Site Manager API (api.ui.com) cannot edit DNS — use a key issued on the local UniFi OS console (Settings → Control Plane → Integrations). The api key is supplied through a vault, marked sensitive, and redacted from logs and error text.

02Models1
@mccormick/unifi/dnsv2026.06.09.1dns.ts

Global Arguments

ArgumentTypeDescription
controllerUrlstringLocal UniFi OS controller base URL, e.g. https://192.0.2.1
apiKeystringLocal controller API key (X-API-KEY); supply via
sitestringUniFi Network site name (usually 'default')
caCert?stringPEM CA certificate to trust the controller's self-signed cert
insecureSkipTlsVerifybooleanBest-effort skip of TLS verification (limited; prefer caCert)
fn list_records()
Read every custom/static DNS record from the controller and write
fn upsert_record(key: string, recordType: string, value: string, enabled: boolean)
Create or update a single custom DNS record: find it by key+type,
ArgumentTypeDescription
keystringRecord name/host, e.g. omni.example.net
recordTypestringDNS record type, e.g. A, AAAA, CNAME, TXT
valuestringRecord value, e.g. the target IP
enabledbooleanWhether the controller should serve the record
fn delete_record(key: string, recordType: string)
Delete a single custom DNS record by key+type. Idempotent: succeeds
ArgumentTypeDescription
keystringRecord name/host to delete, e.g. omni.example.net
recordTypestringDNS record type, e.g. A, AAAA, CNAME, TXT

Resources

dns_record(infinite)— A custom/static DNS record on the UniFi controller
03Previous Versions2
2026.06.04.2Jun 5, 2026

Modified 1 models

2026.06.04.1Jun 5, 2026
04Stats
A
100 / 100
Downloads
1
Archive size
12.1 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository2/2earned
05Platforms
06Labels