Skip to content

Commit e9a0563

Browse files
committed
Refactor UpdateInstanceAllowedIPs to send structured JSON payload
1 parent e27f2be commit e9a0563

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

instance.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,12 @@ func (c *Client) GetRecoveryStatus(id string) (*SimpleResponse, error) {
461461

462462
// UpdateInstanceAllowedIPs sets the list of IP addresses that an instance is allowed to use
463463
func (c *Client) UpdateInstanceAllowedIPs(id string, allowedIPs []string) (*SimpleResponse, error) {
464-
resp, err := c.SendPutRequest(fmt.Sprintf("/v2/instances/%s/allowed_ips", id), allowedIPs)
464+
// Create a map to match the expected JSON structure
465+
payload := map[string][]string{
466+
"allowed_ips": allowedIPs,
467+
}
468+
// Send the payload map instead of the raw allowedIPs slice
469+
resp, err := c.SendPutRequest(fmt.Sprintf("/v2/instances/%s/allowed_ips", id), payload)
465470
if err != nil {
466471
return nil, decodeError(err)
467472
}

0 commit comments

Comments
 (0)