Skip to content

Commit 93b8bb7

Browse files
authored
hetzner: use int64 for IDs (#2720)
1 parent 0abf391 commit 93b8bb7

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

providers/dns/hetzner/internal/hetznerv1/hetznerv1.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
184184
return d.config.PropagationTimeout, d.config.PollingInterval
185185
}
186186

187-
func (d *DNSProvider) waitAction(ctx context.Context, actionID int) error {
187+
func (d *DNSProvider) waitAction(ctx context.Context, actionID int64) error {
188188
return wait.Retry(ctx,
189189
func() error {
190190
result, err := d.client.GetAction(ctx, actionID)

providers/dns/hetzner/internal/hetznerv1/internal/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ func (c *Client) RemoveRRSetRecords(ctx context.Context, zoneIDName, recordType,
8585

8686
// GetAction gets an action.
8787
// https://docs.hetzner.cloud/reference/cloud#actions-get-an-action
88-
func (c *Client) GetAction(ctx context.Context, id int) (*Action, error) {
89-
endpoint := c.BaseURL.JoinPath("actions", strconv.Itoa(id))
88+
func (c *Client) GetAction(ctx context.Context, id int64) (*Action, error) {
89+
endpoint := c.BaseURL.JoinPath("actions", strconv.FormatInt(id, 10))
9090

9191
req, err := newJSONRequest(ctx, http.MethodGet, endpoint, nil)
9292
if err != nil {

providers/dns/hetzner/internal/hetznerv1/internal/client_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func TestClient_AddRRSetRecords(t *testing.T) {
4949
Command: "add_rrset_records",
5050
Status: "running",
5151
Progress: 50,
52-
Resources: []Resources{{ID: 42, Type: "zone"}},
52+
Resources: []Resources{{ID: 590000000000000, Type: "zone"}},
5353
}
5454

5555
assert.Equal(t, expected, result)
@@ -139,11 +139,11 @@ func TestClient_GetAction(t *testing.T) {
139139
require.NoError(t, err)
140140

141141
expected := &Action{
142-
ID: 42,
142+
ID: 590000000000000,
143143
Command: "start_resource",
144144
Status: "running",
145145
Progress: 100,
146-
Resources: []Resources{{ID: 42, Type: "server"}},
146+
Resources: []Resources{{ID: 590000000000000, Type: "server"}},
147147
ErrorInfo: &ErrorInfo{
148148
Code: "action_failed",
149149
Message: "Action failed",

providers/dns/hetzner/internal/hetznerv1/internal/fixtures/add_rrset_records.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"finished": null,
99
"resources": [
1010
{
11-
"id": 42,
11+
"id": 590000000000000,
1212
"type": "zone"
1313
}
1414
],

providers/dns/hetzner/internal/hetznerv1/internal/fixtures/get_action.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"action": {
3-
"id": 42,
3+
"id": 590000000000000,
44
"command": "start_resource",
55
"status": "running",
66
"started": "2016-01-30T23:55:00+00:00",
77
"finished": "2016-01-30T23:55:00+00:00",
88
"progress": 100,
99
"resources": [
1010
{
11-
"id": 42,
11+
"id": 590000000000000,
1212
"type": "server"
1313
}
1414
],

providers/dns/hetzner/internal/hetznerv1/internal/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ type ActionResponse struct {
7979
}
8080

8181
type Action struct {
82-
ID int `json:"id,omitempty"`
82+
ID int64 `json:"id,omitempty"`
8383
Command string `json:"command,omitempty"`
8484

8585
// It can be: `running`, `success`, `error`.
@@ -93,6 +93,6 @@ type Action struct {
9393
}
9494

9595
type Resources struct {
96-
ID int `json:"id,omitempty"`
96+
ID int64 `json:"id,omitempty"`
9797
Type string `json:"type,omitempty"`
9898
}

0 commit comments

Comments
 (0)