Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions hcloud/zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ func (o *Zone) idOrName() (string, error) {
//
// See https://docs.hetzner.cloud/reference/cloud#zones and
// https://docs.hetzner.cloud/reference/cloud#zone-rrsets.
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
type ZoneClient struct {
client *Client
Action *ResourceActionClient
Expand All @@ -123,29 +120,20 @@ type ZoneClient struct {
// GetByID returns a single [Zone].
//
// See https://docs.hetzner.cloud/reference/cloud#zones-get-a-zone
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) GetByID(ctx context.Context, id int64) (*Zone, *Response, error) {
return c.getByIDOrName(ctx, strconv.FormatInt(id, 10))
}

// GetByName returns a single [Zone].
//
// See https://docs.hetzner.cloud/reference/cloud#zones-get-a-zone
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) GetByName(ctx context.Context, name string) (*Zone, *Response, error) {
return c.getByIDOrName(ctx, name)
}

// Get returns a single [Zone].
//
// See https://docs.hetzner.cloud/reference/cloud#zones-get-a-zone
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) Get(ctx context.Context, idOrName string) (*Zone, *Response, error) {
return c.getByIDOrName(ctx, idOrName)
}
Expand Down Expand Up @@ -191,9 +179,6 @@ func (l ZoneListOpts) values() url.Values {
// List returns a list of [Zone] for a specific page.
//
// See https://docs.hetzner.cloud/reference/cloud#zones-list-zones
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) List(ctx context.Context, opts ZoneListOpts) ([]*Zone, *Response, error) {
const opPath = "/zones?%s"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand All @@ -211,19 +196,13 @@ func (c *ZoneClient) List(ctx context.Context, opts ZoneListOpts) ([]*Zone, *Res
// All returns a list of all [Zone].
//
// See https://docs.hetzner.cloud/reference/cloud#zones-list-zones
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) All(ctx context.Context) ([]*Zone, error) {
return c.AllWithOpts(ctx, ZoneListOpts{ListOpts: ListOpts{PerPage: 50}})
}

// AllWithOpts returns a list of all [Zone] with the given options.
//
// See https://docs.hetzner.cloud/reference/cloud#zones-list-zones
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) AllWithOpts(ctx context.Context, opts ZoneListOpts) ([]*Zone, error) {
return iterPages(func(page int) ([]*Zone, *Response, error) {
opts.Page = page
Expand Down Expand Up @@ -271,9 +250,6 @@ type ZoneCreateResult struct {
// Create creates a new [Zone] from the given options.
//
// See https://docs.hetzner.cloud/reference/cloud#zones-create-a-zone
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) Create(ctx context.Context, opts ZoneCreateOpts) (ZoneCreateResult, *Response, error) {
const opPath = "/zones"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -303,9 +279,6 @@ type ZoneUpdateOpts struct {
// Update updates a [Zone] with the given options.
//
// See https://docs.hetzner.cloud/reference/cloud#zones-update-a-zone
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) Update(ctx context.Context, zone *Zone, opts ZoneUpdateOpts) (*Zone, *Response, error) {
const opPath = "/zones/%s"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -335,9 +308,6 @@ type ZoneDeleteResult struct {
// Delete deletes a [Zone].
//
// See https://docs.hetzner.cloud/reference/cloud#zones-delete-a-zone
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) Delete(ctx context.Context, zone *Zone) (ZoneDeleteResult, *Response, error) {
const opPath = "/zones/%s"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -369,9 +339,6 @@ type ZoneExportZonefileResult struct {
// ExportZonefile returns a generated [Zone] file in BIND (RFC 1034/1035) format.
//
// See https://docs.hetzner.cloud/reference/cloud#zones-export-a-zone-file
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) ExportZonefile(ctx context.Context, zone *Zone) (ZoneExportZonefileResult, *Response, error) {
const opPath = "/zones/%s/zonefile"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -403,9 +370,6 @@ type ZoneImportZonefileOpts struct {
// ImportZonefile imports a zone file, replacing all resource record sets (RRSets).
//
// See https://docs.hetzner.cloud/reference/cloud#zone-actions-import-a-zone-file
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) ImportZonefile(ctx context.Context, zone *Zone, opts ZoneImportZonefileOpts) (*Action, *Response, error) {
const opPath = "/zones/%s/actions/import_zonefile"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -435,9 +399,6 @@ type ZoneChangeProtectionOpts struct {
// ChangeProtection changes the protection of a [Zone].
//
// See https://docs.hetzner.cloud/reference/cloud#zone-actions-change-a-zones-protection
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) ChangeProtection(ctx context.Context, zone *Zone, opts ZoneChangeProtectionOpts) (*Action, *Response, error) {
const opPath = "/zones/%s/actions/change_protection"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -467,9 +428,6 @@ type ZoneChangeTTLOpts struct {
// ChangeTTL changes the TTL of a [Zone].
//
// See https://docs.hetzner.cloud/reference/cloud#zone-actions-change-a-zones-default-ttl
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) ChangeTTL(ctx context.Context, zone *Zone, opts ZoneChangeTTLOpts) (*Action, *Response, error) {
const opPath = "/zones/%s/actions/change_ttl"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -509,9 +467,6 @@ type ZoneChangePrimaryNameserversOptsPrimaryNameserver struct {
// ChangePrimaryNameservers changes the primary nameservers of a [Zone].
//
// See https://docs.hetzner.cloud/reference/cloud#zone-actions-change-a-zones-primary-nameservers
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) ChangePrimaryNameservers(ctx context.Context, zone *Zone, opts ZoneChangePrimaryNameserversOpts) (*Action, *Response, error) {
const opPath = "/zones/%s/actions/change_primary_nameservers"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down
39 changes: 0 additions & 39 deletions hcloud/zone_rrset.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ func (o *ZoneRRSet) nameAndType() (string, ZoneRRSetType, error) {
// GetRRSetByNameAndType returns a single [ZoneRRSet].
//
// See https://docs.hetzner.cloud/reference/cloud#zone-rrsets-get-an-rrset
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) GetRRSetByNameAndType(ctx context.Context, zone *Zone, rrsetName string, rrsetType ZoneRRSetType) (*ZoneRRSet, *Response, error) {
const opPath = "/zones/%s/rrsets/%s/%s"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand All @@ -109,9 +106,6 @@ func (c *ZoneClient) GetRRSetByNameAndType(ctx context.Context, zone *Zone, rrse
// GetRRSetByID returns a single [ZoneRRSet].
//
// See https://docs.hetzner.cloud/reference/cloud#zone-rrsets-get-an-rrset
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) GetRRSetByID(ctx context.Context, zone *Zone, rrsetID string) (*ZoneRRSet, *Response, error) {
rrsetName, rrsetType, ok := strings.Cut(rrsetID, "/")
if !ok {
Expand Down Expand Up @@ -146,9 +140,6 @@ func (l ZoneRRSetListOpts) values() url.Values {
// ListRRSets returns a list of [ZoneRRSet] for a specific page.
//
// See https://docs.hetzner.cloud/reference/cloud#zone-rrsets-list-rrsets
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) ListRRSets(ctx context.Context, zone *Zone, opts ZoneRRSetListOpts) ([]*ZoneRRSet, *Response, error) {
const opPath = "/zones/%s/rrsets?%s"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand All @@ -171,9 +162,6 @@ func (c *ZoneClient) ListRRSets(ctx context.Context, zone *Zone, opts ZoneRRSetL
// AllRRSetsWithOpts returns a list of all [ZoneRRSet] with the given options.
//
// See https://docs.hetzner.cloud/reference/cloud#zone-rrsets-list-rrsets
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) AllRRSetsWithOpts(ctx context.Context, zone *Zone, opts ZoneRRSetListOpts) ([]*ZoneRRSet, error) {
return iterPages(func(page int) ([]*ZoneRRSet, *Response, error) {
opts.Page = page
Expand All @@ -184,9 +172,6 @@ func (c *ZoneClient) AllRRSetsWithOpts(ctx context.Context, zone *Zone, opts Zon
// AllRRSets returns a list of all [ZoneRRSet].
//
// See https://docs.hetzner.cloud/reference/cloud#zone-rrsets-list-rrsets
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) AllRRSets(ctx context.Context, zone *Zone) ([]*ZoneRRSet, error) {
return c.AllRRSetsWithOpts(ctx, zone, ZoneRRSetListOpts{ListOpts: ListOpts{PerPage: 50}})
}
Expand All @@ -209,9 +194,6 @@ type ZoneRRSetCreateResult struct {
// CreateRRSet creates a new [ZoneRRSet] from the given options.
//
// See https://docs.hetzner.cloud/reference/cloud#zone-rrsets-create-an-rrset
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) CreateRRSet(ctx context.Context, zone *Zone, opts ZoneRRSetCreateOpts) (ZoneRRSetCreateResult, *Response, error) {
const opPath = "/zones/%s/rrsets"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -246,9 +228,6 @@ type ZoneRRSetUpdateOpts struct {
// UpdateRRSet updates a [ZoneRRSet] with the given options.
//
// See https://docs.hetzner.cloud/reference/cloud#zone-rrsets-update-an-rrset
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) UpdateRRSet(ctx context.Context, rrset *ZoneRRSet, opts ZoneRRSetUpdateOpts) (*ZoneRRSet, *Response, error) {
const opPath = "/zones/%s/rrsets/%s/%s"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -287,9 +266,6 @@ type ZoneRRSetDeleteResult struct {
// DeleteRRSet deletes a [ZoneRRSet].
//
// See https://docs.hetzner.cloud/reference/cloud#zone-rrsets-delete-an-rrset
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) DeleteRRSet(ctx context.Context, rrset *ZoneRRSet) (ZoneRRSetDeleteResult, *Response, error) {
const opPath = "/zones/%s/rrsets/%s/%s"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -330,9 +306,6 @@ type ZoneRRSetChangeProtectionOpts struct {
// ChangeRRSetProtection changes the protection of a [ZoneRRSet].
//
// See https://docs.hetzner.cloud/reference/cloud#zone-rrset-actions-change-an-rrsets-protection
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) ChangeRRSetProtection(ctx context.Context, rrset *ZoneRRSet, opts ZoneRRSetChangeProtectionOpts) (*Action, *Response, error) {
const opPath = "/zones/%s/rrsets/%s/%s/actions/change_protection"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -371,9 +344,6 @@ type ZoneRRSetChangeTTLOpts struct {
// ChangeRRSetTTL changes the TTL of a [ZoneRRSet].
//
// See https://docs.hetzner.cloud/reference/cloud#zone-rrset-actions-change-an-rrsets-ttl
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) ChangeRRSetTTL(ctx context.Context, rrset *ZoneRRSet, opts ZoneRRSetChangeTTLOpts) (*Action, *Response, error) {
const opPath = "/zones/%s/rrsets/%s/%s/actions/change_ttl"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -412,9 +382,6 @@ type ZoneRRSetSetRecordsOpts struct {
// SetRRSetRecords overwrites the records of a [ZoneRRSet].
//
// See https://docs.hetzner.cloud/reference/cloud#zone-rrset-actions-set-records-of-an-rrset
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) SetRRSetRecords(ctx context.Context, rrset *ZoneRRSet, opts ZoneRRSetSetRecordsOpts) (*Action, *Response, error) {
const opPath = "/zones/%s/rrsets/%s/%s/actions/set_records"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -454,9 +421,6 @@ type ZoneRRSetAddRecordsOpts struct {
// AddRRSetRecords adds records to a [ZoneRRSet].
//
// See https://docs.hetzner.cloud/reference/cloud#zone-rrset-actions-add-records-to-an-rrset
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) AddRRSetRecords(ctx context.Context, rrset *ZoneRRSet, opts ZoneRRSetAddRecordsOpts) (*Action, *Response, error) {
const opPath = "/zones/%s/rrsets/%s/%s/actions/add_records"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -495,9 +459,6 @@ type ZoneRRSetRemoveRecordsOpts struct {
// RemoveRRSetRecords removes records from a [ZoneRRSet].
//
// See https://docs.hetzner.cloud/reference/cloud#zone-rrset-actions-remove-records-from-an-rrset
//
// Experimental: DNS API is in beta, breaking changes may occur within minor releases.
// See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta
func (c *ZoneClient) RemoveRRSetRecords(ctx context.Context, rrset *ZoneRRSet, opts ZoneRRSetRemoveRecordsOpts) (*Action, *Response, error) {
const opPath = "/zones/%s/rrsets/%s/%s/actions/remove_records"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down
Loading