From b864b2773eaf851251e9211a56e268c75795bf7b Mon Sep 17 00:00:00 2001 From: Toni Kangas Date: Mon, 21 Oct 2024 13:56:06 +0300 Subject: [PATCH 1/2] feat(server): add `Index` field to `CreateServerInterface` --- CHANGELOG.md | 3 +++ upcloud/request/server.go | 1 + 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67a80aee..73088559 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/) ## [Unreleased] +### Added +- server: add `Index` field to `request.CreateServerInterface` + ## [8.10.0] ### Added diff --git a/upcloud/request/server.go b/upcloud/request/server.go index af428e34..f1193056 100644 --- a/upcloud/request/server.go +++ b/upcloud/request/server.go @@ -104,6 +104,7 @@ func (s CreateServerStorageDeviceSlice) MarshalJSON() ([]byte, error) { // CreateServerInterface represents a server network interface // that is needed during server creation. type CreateServerInterface struct { + Index int `json:"index,omitempty"` IPAddresses CreateServerIPAddressSlice `json:"ip_addresses"` Type string `json:"type"` Network string `json:"network,omitempty"` From d8fca088edf0c1245c04001ba152b97da81217e0 Mon Sep 17 00:00:00 2001 From: Toni Kangas Date: Mon, 21 Oct 2024 14:17:16 +0300 Subject: [PATCH 2/2] fix(client): use current `Version` in expected value --- upcloud/client/client_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/upcloud/client/client_test.go b/upcloud/client/client_test.go index 16a1906e..002da5a0 100644 --- a/upcloud/client/client_test.go +++ b/upcloud/client/client_test.go @@ -250,9 +250,9 @@ func TestClientWithLogger(t *testing.T) { _, err := c.Get(context.TODO(), "/test") require.NoError(t, err) - expected := `{"time":"2 Minutes to Midnight","level":"DEBUG","msg":"Sending request to UpCloud API","url":"http://server/1.3/test","method":"GET","headers":{"Accept":["application/json"],"Authorization":["Basic [REDACTED]"],"Content-Type":["application/json"],"User-Agent":["upcloud-go-api/8.9.0"]},"body":""} + expected := fmt.Sprintf(`{"time":"2 Minutes to Midnight","level":"DEBUG","msg":"Sending request to UpCloud API","url":"http://server/1.3/test","method":"GET","headers":{"Accept":["application/json"],"Authorization":["Basic [REDACTED]"],"Content-Type":["application/json"],"User-Agent":["upcloud-go-api/%s"]},"body":""} {"time":"2 Minutes to Midnight","level":"DEBUG","msg":"Received response from UpCloud API","url":"http://server/1.3/test","status":"200 OK","headers":{"Content-Length":["38"],"Content-Type":["text/plain; charset=utf-8"],"Date":["Fri, 11 Oct 2024 23:58:00 GMT"]},"body":"{\n \"method\": \"GET\",\n \"path\": \"/1.3/test\"\n}"} -` +`, Version) assert.Equal(t, expected, output.String()) }