Skip to content

Commit bfbf5eb

Browse files
jooolaphm07apricote
authored
feat: support the new DNS API (#1182)
Add support for the new [DNS API](https://docs.hetzner.cloud/reference/cloud#dns). The DNS API is currently in **beta**. See the [DNS API beta changelog](https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta) for more details. Co-authored-by: phm07 <22707808+phm07@users.noreply.github.com> Co-authored-by: Julian Tölle <julian.toelle@hetzner-cloud.de>
1 parent d1c32c3 commit bfbf5eb

File tree

100 files changed

+6131
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+6131
-3
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ linters:
4343
default-signifies-exhaustive: true
4444

4545
staticcheck:
46-
checks: ["all", "-ST1005"]
46+
checks: ["all", "-ST1005", "-S1016"]
4747

4848
gosec:
4949
excludes:

docs/reference/manual/hcloud.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ A command-line interface for Hetzner Cloud
4343
* [hcloud ssh-key](hcloud_ssh-key.md) - Manage SSH Keys
4444
* [hcloud version](hcloud_version.md) - Print version information
4545
* [hcloud volume](hcloud_volume.md) - Manage Volumes
46+
* [hcloud zone](hcloud_zone.md) - [experimental] Manage DNS Zones and Zone RRSets (records)

docs/reference/manual/hcloud_all_list.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Listed resources are:
1919
- Firewalls
2020
- Certificates
2121
- SSH Keys
22+
- Zones
2223

2324
```
2425
hcloud all list [options]
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
## hcloud zone
2+
3+
[experimental] Manage DNS Zones and Zone RRSets (records)
4+
5+
### Synopsis
6+
7+
For more details, see the documentation for Zones https://docs.hetzner.cloud/reference/cloud#zones or Zone RRSets https://docs.hetzner.cloud/reference/cloud#zone-rrsets.
8+
9+
Experimental: DNS API is in beta, breaking changes may occur within minor releases.
10+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
11+
12+
13+
### Options
14+
15+
```
16+
-h, --help help for zone
17+
```
18+
19+
### Options inherited from parent commands
20+
21+
```
22+
--config string Config file path (default "~/.config/hcloud/cli.toml")
23+
--context string Currently active context
24+
--debug Enable debug output
25+
--debug-file string File to write debug output to
26+
--endpoint string Hetzner Cloud API endpoint (default "https://api.hetzner.cloud/v1")
27+
--no-experimental-warnings If true, experimental warnings are not shown
28+
--poll-interval duration Interval at which to poll information, for example action progress (default 500ms)
29+
--quiet If true, only print error messages
30+
```
31+
32+
### SEE ALSO
33+
34+
* [hcloud](hcloud.md) - Hetzner Cloud CLI
35+
* [hcloud zone add-label](hcloud_zone_add-label.md) - [experimental] Add a label to a Zone
36+
* [hcloud zone add-records](hcloud_zone_add-records.md) - [experimental] Add records to a Zone RRSet
37+
* [hcloud zone change-primary-nameservers](hcloud_zone_change-primary-nameservers.md) - [experimental] Changes the primary nameservers of a secondary Zone
38+
* [hcloud zone change-ttl](hcloud_zone_change-ttl.md) - [experimental] Changes the default Time To Live (TTL) of a Zone
39+
* [hcloud zone create](hcloud_zone_create.md) - [experimental] Create a Zone
40+
* [hcloud zone delete](hcloud_zone_delete.md) - [experimental] Delete a Zone
41+
* [hcloud zone describe](hcloud_zone_describe.md) - [experimental] Describe a Zone
42+
* [hcloud zone disable-protection](hcloud_zone_disable-protection.md) - [experimental] Disable resource protection for a Zone
43+
* [hcloud zone enable-protection](hcloud_zone_enable-protection.md) - [experimental] Enable resource protection for a Zone
44+
* [hcloud zone export-zonefile](hcloud_zone_export-zonefile.md) - [experimental] Returns a generated Zone file in BIND (RFC 1034/1035) format
45+
* [hcloud zone import-zonefile](hcloud_zone_import-zonefile.md) - [experimental] Imports a zone file, replacing all Zone RRSets
46+
* [hcloud zone list](hcloud_zone_list.md) - [experimental] List Zones
47+
* [hcloud zone remove-label](hcloud_zone_remove-label.md) - [experimental] Remove a label from a Zone
48+
* [hcloud zone remove-records](hcloud_zone_remove-records.md) - [experimental] Remove records from a Zone RRSet.
49+
* [hcloud zone rrset](hcloud_zone_rrset.md) - [experimental] Manage Zone RRSets (records)
50+
* [hcloud zone set-records](hcloud_zone_set-records.md) - [experimental] Set the records of a Zone RRSet
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## hcloud zone add-label
2+
3+
[experimental] Add a label to a Zone
4+
5+
### Synopsis
6+
7+
Add a label to a Zone
8+
9+
Experimental: DNS API is in beta, breaking changes may occur within minor releases.
10+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
11+
12+
13+
```
14+
hcloud zone add-label [--overwrite] <zone> <label>...
15+
```
16+
17+
### Options
18+
19+
```
20+
-h, --help help for add-label
21+
-o, --overwrite Overwrite label if it exists already (true, false)
22+
```
23+
24+
### Options inherited from parent commands
25+
26+
```
27+
--config string Config file path (default "~/.config/hcloud/cli.toml")
28+
--context string Currently active context
29+
--debug Enable debug output
30+
--debug-file string File to write debug output to
31+
--endpoint string Hetzner Cloud API endpoint (default "https://api.hetzner.cloud/v1")
32+
--no-experimental-warnings If true, experimental warnings are not shown
33+
--poll-interval duration Interval at which to poll information, for example action progress (default 500ms)
34+
--quiet If true, only print error messages
35+
```
36+
37+
### SEE ALSO
38+
39+
* [hcloud zone](hcloud_zone.md) - [experimental] Manage DNS Zones and Zone RRSets (records)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
## hcloud zone add-records
2+
3+
[experimental] Add records to a Zone RRSet
4+
5+
### Synopsis
6+
7+
Add records to a Zone RRSet.
8+
9+
If the Zone RRSet doesn't exist, it will automatically be created.
10+
11+
The optional records file has to be in JSON format. You can find the schema at https://docs.hetzner.cloud/reference/cloud#zone-rrset-actions-set-records-of-an-rrset
12+
13+
Example file content:
14+
15+
[
16+
{
17+
"value": "198.51.100.1",
18+
"comment": "My web server at Hetzner Cloud."
19+
},
20+
{
21+
"value": "198.51.100.2",
22+
"comment": "My other server at Hetzner Cloud."
23+
}
24+
]
25+
26+
Experimental: DNS API is in beta, breaking changes may occur within minor releases.
27+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
28+
29+
30+
```
31+
hcloud zone add-records (--record <value>... | --records-file <file>) <zone> <name> <type>
32+
```
33+
34+
### Options
35+
36+
```
37+
-h, --help help for add-records
38+
--record stringArray List of records (can be specified multiple times, conflicts with --records-file)
39+
--records-file string JSON file containing the records (conflicts with --record)
40+
--ttl int Time To Live (TTL) of the Zone RRSet
41+
```
42+
43+
### Options inherited from parent commands
44+
45+
```
46+
--config string Config file path (default "~/.config/hcloud/cli.toml")
47+
--context string Currently active context
48+
--debug Enable debug output
49+
--debug-file string File to write debug output to
50+
--endpoint string Hetzner Cloud API endpoint (default "https://api.hetzner.cloud/v1")
51+
--no-experimental-warnings If true, experimental warnings are not shown
52+
--poll-interval duration Interval at which to poll information, for example action progress (default 500ms)
53+
--quiet If true, only print error messages
54+
```
55+
56+
### SEE ALSO
57+
58+
* [hcloud zone](hcloud_zone.md) - [experimental] Manage DNS Zones and Zone RRSets (records)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
## hcloud zone change-primary-nameservers
2+
3+
[experimental] Changes the primary nameservers of a secondary Zone
4+
5+
### Synopsis
6+
7+
Changes the primary nameservers of a secondary Zone.
8+
9+
Input file has to be in JSON format. You can find the schema at https://docs.hetzner.cloud/reference/cloud#zone-actions-change-a-zone-primary-nameservers
10+
11+
Example file content:
12+
13+
[
14+
{
15+
"address": "203.0.113.10"
16+
},
17+
{
18+
"address": "203.0.113.11",
19+
"port": 5353
20+
},
21+
{
22+
"address": "203.0.113.12",
23+
"tsig_algorithm": "hmac-sha256",
24+
"tsig_key": "example-key"
25+
}
26+
]
27+
28+
Experimental: DNS API is in beta, breaking changes may occur within minor releases.
29+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
30+
31+
32+
```
33+
hcloud zone change-primary-nameservers --primary-nameservers-file <file> <zone>
34+
```
35+
36+
### Options
37+
38+
```
39+
-h, --help help for change-primary-nameservers
40+
--primary-nameservers-file string JSON file containing the new primary nameservers. (use - to read from stdin)
41+
```
42+
43+
### Options inherited from parent commands
44+
45+
```
46+
--config string Config file path (default "~/.config/hcloud/cli.toml")
47+
--context string Currently active context
48+
--debug Enable debug output
49+
--debug-file string File to write debug output to
50+
--endpoint string Hetzner Cloud API endpoint (default "https://api.hetzner.cloud/v1")
51+
--no-experimental-warnings If true, experimental warnings are not shown
52+
--poll-interval duration Interval at which to poll information, for example action progress (default 500ms)
53+
--quiet If true, only print error messages
54+
```
55+
56+
### SEE ALSO
57+
58+
* [hcloud zone](hcloud_zone.md) - [experimental] Manage DNS Zones and Zone RRSets (records)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## hcloud zone change-ttl
2+
3+
[experimental] Changes the default Time To Live (TTL) of a Zone
4+
5+
### Synopsis
6+
7+
Changes the default Time To Live (TTL) of a Zone
8+
9+
Experimental: DNS API is in beta, breaking changes may occur within minor releases.
10+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
11+
12+
13+
```
14+
hcloud zone change-ttl --ttl <ttl> <zone>
15+
```
16+
17+
### Options
18+
19+
```
20+
-h, --help help for change-ttl
21+
--ttl int Default Time To Live (TTL) of the Zone (required) (default 3600)
22+
```
23+
24+
### Options inherited from parent commands
25+
26+
```
27+
--config string Config file path (default "~/.config/hcloud/cli.toml")
28+
--context string Currently active context
29+
--debug Enable debug output
30+
--debug-file string File to write debug output to
31+
--endpoint string Hetzner Cloud API endpoint (default "https://api.hetzner.cloud/v1")
32+
--no-experimental-warnings If true, experimental warnings are not shown
33+
--poll-interval duration Interval at which to poll information, for example action progress (default 500ms)
34+
--quiet If true, only print error messages
35+
```
36+
37+
### SEE ALSO
38+
39+
* [hcloud zone](hcloud_zone.md) - [experimental] Manage DNS Zones and Zone RRSets (records)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## hcloud zone create
2+
3+
[experimental] Create a Zone
4+
5+
### Synopsis
6+
7+
Create a Zone
8+
9+
Experimental: DNS API is in beta, breaking changes may occur within minor releases.
10+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
11+
12+
13+
```
14+
hcloud zone create [options] --name <name> [--mode secondary --primary-nameservers <file>]
15+
```
16+
17+
### Options
18+
19+
```
20+
--enable-protection strings Enable protection (delete) (default: none)
21+
-h, --help help for create
22+
--label stringToString User-defined labels ('key=value') (can be specified multiple times) (default [])
23+
--mode string Mode of the Zone (primary, secondary) (default "primary")
24+
--name string Zone name (required)
25+
-o, --output stringArray output options: json|yaml
26+
--primary-nameservers-file string JSON file containing the new primary nameservers. (See 'hcloud zone change-primary-nameservers -h' for help)
27+
--ttl int Default Time To Live (TTL) of the Zone
28+
--zonefile string Zone file in BIND (RFC 1034/1035) format (use - to read from stdin)
29+
```
30+
31+
### Options inherited from parent commands
32+
33+
```
34+
--config string Config file path (default "~/.config/hcloud/cli.toml")
35+
--context string Currently active context
36+
--debug Enable debug output
37+
--debug-file string File to write debug output to
38+
--endpoint string Hetzner Cloud API endpoint (default "https://api.hetzner.cloud/v1")
39+
--no-experimental-warnings If true, experimental warnings are not shown
40+
--poll-interval duration Interval at which to poll information, for example action progress (default 500ms)
41+
--quiet If true, only print error messages
42+
```
43+
44+
### SEE ALSO
45+
46+
* [hcloud zone](hcloud_zone.md) - [experimental] Manage DNS Zones and Zone RRSets (records)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## hcloud zone delete
2+
3+
[experimental] Delete a Zone
4+
5+
### Synopsis
6+
7+
Delete a Zone
8+
9+
Experimental: DNS API is in beta, breaking changes may occur within minor releases.
10+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
11+
12+
13+
```
14+
hcloud zone delete <zone>...
15+
```
16+
17+
### Options
18+
19+
```
20+
-h, --help help for delete
21+
```
22+
23+
### Options inherited from parent commands
24+
25+
```
26+
--config string Config file path (default "~/.config/hcloud/cli.toml")
27+
--context string Currently active context
28+
--debug Enable debug output
29+
--debug-file string File to write debug output to
30+
--endpoint string Hetzner Cloud API endpoint (default "https://api.hetzner.cloud/v1")
31+
--no-experimental-warnings If true, experimental warnings are not shown
32+
--poll-interval duration Interval at which to poll information, for example action progress (default 500ms)
33+
--quiet If true, only print error messages
34+
```
35+
36+
### SEE ALSO
37+
38+
* [hcloud zone](hcloud_zone.md) - [experimental] Manage DNS Zones and Zone RRSets (records)

0 commit comments

Comments
 (0)