Skip to content

Commit

Permalink
apis/zones: deprecate AddRecordSetToZone
Browse files Browse the repository at this point in the history
  • Loading branch information
Veratil committed Aug 29, 2024
1 parent ae05536 commit 86cf576
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 2 additions & 0 deletions apis/zones/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ type Client interface {

// AddRecordSetToZone will add a new set of records to a zone. Existing record sets for
// the exact name/type combination will be replaced.
//
// Deprecated: Superceded by AddRecordSetsToZone
AddRecordSetToZone(ctx context.Context, serverID string, zoneID string, set ResourceRecordSet) error

// AddRecordSetsToZone will add new sets of records to a zone. Existing record sets for
Expand Down
11 changes: 1 addition & 10 deletions apis/zones/zones_addrecordset.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@ import (
)

func (c *client) AddRecordSetToZone(ctx context.Context, serverID string, zoneID string, set ResourceRecordSet) error {
path := fmt.Sprintf("/servers/%s/zones/%s", url.PathEscape(serverID), url.PathEscape(zoneID))

set.ChangeType = ChangeTypeReplace
patch := Zone{
ResourceRecordSets: []ResourceRecordSet{
set,
},
}

return c.httpClient.Patch(ctx, path, nil, pdnshttp.WithJSONRequestBody(&patch))
return c.AddRecordSetsToZone(ctx, serverID, zoneID, []ResourceRecordSet{set})
}

func (c *client) AddRecordSetsToZone(ctx context.Context, serverID string, zoneID string, sets []ResourceRecordSet) error {
Expand Down

0 comments on commit 86cf576

Please sign in to comment.