Skip to content

Added DNS zones, DNS records, and PTR record management commands#56

Open
glymphie wants to merge 17 commits into
contabo:mainfrom
glymphie:dns
Open

Added DNS zones, DNS records, and PTR record management commands#56
glymphie wants to merge 17 commits into
contabo:mainfrom
glymphie:dns

Conversation

@glymphie
Copy link
Copy Markdown

Summary

This PR adds support for:

  • Listing DNS Zones
  • Managing DNS records
  • Managing PTR records. (reverse DNS)

Features

DNS Zones

  • List DNS zones
  • Retrieve a DNS zone

Records

  • List DNS records for a zone
  • Create DNS records
  • Update DNS records
  • Delete DNS records

PTR Records (Reverse DNS)

  • List PTR records
  • Retrieve PTR record by IP address
  • Create PTR record
  • Update PTR record
  • Delete PTR record

Implementation Notes

  • Follows existing CLI patterns (get, create, update, delete)
  • Uses outputFormatter for consistent output across commands
  • Supports input via flags and JSON/YAML (stdin/file) where applicable
  • DNS record updates use a fetch + merge approach to handle required fields in the API

Validation

  • PTR create is restricted to IPv6 (API limitation)
    • I've also limited PTR delete to IPv6 due to this limitation

Documentation

  • Updated README with DNS usage examples

Notes

  • API does not support fine-grained filtering for DNS records, so this is not included
  • CLI structure kept consistent with existing commands; naming can be adjusted if you guys prefer 🙂
  • This should also address issue Add reverse DNS through cntb tool #53
    • Unless that requires the ability to create a PTR record with an IPv4 address
    • or is specific for when creating new instances

glymphie added 17 commits April 10, 2026 14:14
Use `cntb get dns [zone]` to list the DNS zone records for a zone.
Was missing the documented fields.
Added recordids to regular output.
list.go - RetrieveDnsZonesList | **Get** /v1/dns/zones | List DNS zones
get.go - RetrieveDnsZone | **Get** /v1/dns/zones/{zoneName} | Retrieve a DNS Zone by zone name
getRecord.go - RetrieveDnsZoneRecordsList | **Get** /v1/dns/zones/{zoneName}/records | List a DNS Zone's records
createRecord.go - CreateDnsZoneRecord | **Post** /v1/dns/zones/{zoneName}/records | Create DNS zone record
deleteRecord.go - DeleteDnsZoneRecord | **Delete** /v1/dns/zones/{zoneName}/records/{recordId} | Delete a DNS zone record
updateRecord.go - UpdateDnsZoneRecord | **Patch** /v1/dns/zones/{zoneName}/records/{recordId} | Update DNS zone record
Also renamed some of the variables used for the DNS functionality to
better reflect their uses.
Also added periods for help texts.
Also renamed getRecords to listRecords for better consistency.
@glymphie glymphie changed the title DNS zones, DNS records, and PTR record management commands Added DNS zones, DNS records, and PTR record management commands Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant