diff --git a/providers/dns/njalla/internal/client.go b/providers/dns/njalla/internal/client.go index 8fc69129..8b1a1a8b 100644 --- a/providers/dns/njalla/internal/client.go +++ b/providers/dns/njalla/internal/client.go @@ -48,7 +48,7 @@ func (c *Client) AddRecord(record Record) (*Record, error) { } // RemoveRecord removes a record. -func (c *Client) RemoveRecord(id int, domain string) error { +func (c *Client) RemoveRecord(id string, domain string) error { data := APIRequest{ Method: "remove-record", Params: Record{ diff --git a/providers/dns/njalla/internal/client_test.go b/providers/dns/njalla/internal/client_test.go index 1a8bad79..934cbe76 100644 --- a/providers/dns/njalla/internal/client_test.go +++ b/providers/dns/njalla/internal/client_test.go @@ -56,7 +56,7 @@ func TestClient_AddRecord(t *testing.T) { return } - apiReq.Params.ID = 123 + apiReq.Params.ID = "123" resp := map[string]interface{}{ "jsonrpc": "2.0", @@ -83,7 +83,7 @@ func TestClient_AddRecord(t *testing.T) { require.NoError(t, err) expected := &Record{ - ID: 123, + ID: "123", Content: "foobar", Domain: "test", Name: "example.com", @@ -130,7 +130,7 @@ func TestClient_ListRecords(t *testing.T) { "result": Records{ Records: []Record{ { - ID: 1, + ID: "1", Domain: apiReq.Params.Domain, Content: "test", Name: "test01", @@ -138,7 +138,7 @@ func TestClient_ListRecords(t *testing.T) { Type: "TXT", }, { - ID: 2, + ID: "2", Domain: apiReq.Params.Domain, Content: "txtTxt", Name: "test02", @@ -161,7 +161,7 @@ func TestClient_ListRecords(t *testing.T) { expected := []Record{ { - ID: 1, + ID: "1", Domain: "example.com", Content: "test", Name: "test01", @@ -169,7 +169,7 @@ func TestClient_ListRecords(t *testing.T) { Type: "TXT", }, { - ID: 2, + ID: "2", Domain: "example.com", Content: "txtTxt", Name: "test02", @@ -204,7 +204,7 @@ func TestClient_RemoveRecord(t *testing.T) { return } - if apiReq.Params.ID == 0 { + if apiReq.Params.ID == "" { _, _ = rw.Write([]byte(`{"jsonrpc":"2.0", "Error": {"code": 400, "message": ""missing ID"}}`)) return } @@ -217,7 +217,7 @@ func TestClient_RemoveRecord(t *testing.T) { _, _ = rw.Write([]byte(`{"jsonrpc":"2.0"}`)) }) - err := client.RemoveRecord(123, "example.com") + err := client.RemoveRecord("123", "example.com") require.NoError(t, err) } @@ -225,6 +225,6 @@ func TestClient_RemoveRecord_error(t *testing.T) { client := setup(t, nil) client.token = "invalid" - err := client.RemoveRecord(123, "example.com") + err := client.RemoveRecord("123", "example.com") require.Error(t, err) } diff --git a/providers/dns/njalla/internal/types.go b/providers/dns/njalla/internal/types.go index 2864649f..74efe8d4 100644 --- a/providers/dns/njalla/internal/types.go +++ b/providers/dns/njalla/internal/types.go @@ -31,7 +31,7 @@ func (a APIError) Error() string { // Record is a DNS record. type Record struct { - ID int `json:"id,omitempty"` + ID string `json:"id,omitempty"` Content string `json:"content,omitempty"` Domain string `json:"domain,omitempty"` Name string `json:"name,omitempty"` diff --git a/providers/dns/njalla/njalla.go b/providers/dns/njalla/njalla.go index 4a394a42..88153033 100644 --- a/providers/dns/njalla/njalla.go +++ b/providers/dns/njalla/njalla.go @@ -52,7 +52,7 @@ type DNSProvider struct { config *Config client *internal.Client - recordIDs map[string]int + recordIDs map[string]string recordIDsMu sync.Mutex } @@ -89,7 +89,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return &DNSProvider{ config: config, client: client, - recordIDs: make(map[string]int), + recordIDs: make(map[string]string), }, nil } @@ -147,7 +147,7 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { err = d.client.RemoveRecord(recordID, dns01.UnFqdn(rootDomain)) if err != nil { - return fmt.Errorf("njalla: failed to delete TXT records: fqdn=%s, recordID=%d: %w", fqdn, recordID, err) + return fmt.Errorf("njalla: failed to delete TXT records: fqdn=%s, recordID=%s: %w", fqdn, recordID, err) } // deletes record ID from map