From 342751d5b5353b19356446c4d583f344aef01fba Mon Sep 17 00:00:00 2001 From: Janar Todesk Date: Tue, 22 Oct 2024 11:01:09 +0300 Subject: [PATCH] provider: Fix Defined.net HTTP API client's host update endpoint The HTTP API provides `PUT /v2/hosts/:id` endpoint instead of the currently configured `PUT /v1/hosts/:id`. --- internal/definednet/host.go | 2 +- internal/definednet/host_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/definednet/host.go b/internal/definednet/host.go index 264d239..6af4ae0 100644 --- a/internal/definednet/host.go +++ b/internal/definednet/host.go @@ -70,7 +70,7 @@ type GetHostRequest struct { // UpdateHost updates a Defined.net host. func UpdateHost(ctx context.Context, client Client, req UpdateHostRequest) (*Host, error) { var resp Response[Host] - if err := client.Do(ctx, http.MethodPut, []string{"v1", "hosts", req.ID}, req, &resp); err != nil { + if err := client.Do(ctx, http.MethodPut, []string{"v2", "hosts", req.ID}, req, &resp); err != nil { return nil, err } diff --git a/internal/definednet/host_test.go b/internal/definednet/host_test.go index 6b5dba0..a3c263c 100644 --- a/internal/definednet/host_test.go +++ b/internal/definednet/host_test.go @@ -99,7 +99,7 @@ var _ = Describe("getting hosts", func() { var _ = Describe("updating hosts", func() { Specify("hosts are updated on Defined.net", func(ctx SpecContext) { server.AppendHandlers(ghttp.CombineHandlers( - ghttp.VerifyRequest(http.MethodPut, "/v1/hosts/host-id"), + ghttp.VerifyRequest(http.MethodPut, "/v2/hosts/host-id"), ghttp.VerifyJSONRepresenting(map[string]any{ "roleID": "role-id", "name": "host.smaily.testing",