Skip to content

Commit

Permalink
feat(server): add Index field to CreateServerInterface (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
kangasta authored Oct 23, 2024
1 parent 91d34ab commit 19403de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions upcloud/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

Expand Down
1 change: 1 addition & 0 deletions upcloud/request/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 19403de

Please sign in to comment.