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/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()) } 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"`