Skip to content

Commit

Permalink
Fixed unmarshalling error when IP Allowlist is configured on viridian
Browse files Browse the repository at this point in the history
2023-08-11T19:47:32.962+0100    ERROR   viridian/common.go:228  listing clusters: json: cannot unmarshal array into Go struct field Cluster.Content.allowedIps of type string

Here's an example grabbed from the Viridian UI
{id: 177, ip: "207.154.227.247", description: null}
  • Loading branch information
pmcgleenon committed Aug 11, 2023
1 parent db7c020 commit 767d42d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/viridian/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Cluster struct {
HotRestartEnabled bool `json:"hotRestartEnabled"`
PlanName string `json:"planName"`
Regions []Region `json:"regions"`
AllowedIps []string `json:"allowedIps"`
AllowedIps []IP `json:"allowedIps"`
IPWhitelistEnabled bool `json:"ipWhitelistEnabled"`
MaxAvailableMemory int `json:"maxAvailableMemory"`
}
Expand All @@ -44,3 +44,9 @@ type ClusterType struct {
type Region struct {
Title string `json:"title"`
}

type IP struct {
ID int `json:"id"`
IP string `json:"ip"`
description string `json:"description",omitempty`
}

0 comments on commit 767d42d

Please sign in to comment.