Skip to content

Commit e17407e

Browse files
committed
Refactor UpdateInstanceBandwidth to send structured JSON payload for bandwidth limit
1 parent 1adc599 commit e17407e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

instance.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,12 @@ func (c *Client) UpdateInstanceAllowedIPs(id string, allowedIPs []string) (*Simp
476476

477477
// UpdateInstanceBandwidth sets the list of IP addresses that an instance is allowed to use
478478
func (c *Client) UpdateInstanceBandwidth(id string, bandwidthLimit int) (*SimpleResponse, error) {
479-
resp, err := c.SendPutRequest(fmt.Sprintf("/v2/instances/%s/network_bandwidth_limit", id), bandwidthLimit)
479+
payload := map[string]int{
480+
"network_bandwidth_limit": bandwidthLimit,
481+
}
482+
resp, err := c.SendPutRequest(fmt.Sprintf("/v2/instances/%s/network_bandwidth_limit", id), payload)
480483
if err != nil {
481484
return nil, decodeError(err)
482485
}
483-
484486
return c.DecodeSimpleResponse(resp)
485487
}

0 commit comments

Comments
 (0)