Skip to content

Commit

Permalink
Use pointers for addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarber-akamai committed May 2, 2024
1 parent 6f2d419 commit ac5c248
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
15 changes: 11 additions & 4 deletions lke_clusters_control_plane.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ type LKEClusterControlPlane struct {
// LKEClusterControlPlaneACLAddresses describes the
// allowed IP ranges for an LKE cluster's control plane.
type LKEClusterControlPlaneACLAddresses struct {
IPv4 []string `json:"ipv4,omitempty"`
IPv6 []string `json:"ipv6,omitempty"`
IPv4 []string `json:"ipv4"`
IPv6 []string `json:"ipv6"`
}

// LKEClusterControlPlaneACL describes the ACL configuration
Expand All @@ -27,11 +27,18 @@ type LKEClusterControlPlaneACLResponse struct {
ACL LKEClusterControlPlaneACL `json:"acl"`
}

// LKEClusterControlPlaneACLAddressesOptions are the options used to
// specify the allowed IP ranges for an LKE cluster's control plane.
type LKEClusterControlPlaneACLAddressesOptions struct {
IPv4 *[]string `json:"ipv4,omitempty"`
IPv6 *[]string `json:"ipv6,omitempty"`
}

// LKEClusterControlPlaneACLOptions represents the options used when
// configuring an LKE cluster's control plane ACL policy.
type LKEClusterControlPlaneACLOptions struct {
Enabled *bool `json:"enabled,omitempty"`
Addresses *LKEClusterControlPlaneACLAddresses `json:"addresses,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Addresses *LKEClusterControlPlaneACLAddressesOptions `json:"addresses,omitempty"`
}

// LKEClusterControlPlaneOptions represents the options used when
Expand Down
12 changes: 6 additions & 6 deletions test/integration/lke_clusters_acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ func TestLKECluster_withACL(t *testing.T) {
options.ControlPlane = &linodego.LKEClusterControlPlaneOptions{
ACL: &linodego.LKEClusterControlPlaneACLOptions{
Enabled: &valueTrue,
Addresses: &linodego.LKEClusterControlPlaneACLAddresses{
IPv4: []string{"10.0.0.1/32"},
IPv6: []string{"1234::5678"},
Addresses: &linodego.LKEClusterControlPlaneACLAddressesOptions{
IPv4: &[]string{"10.0.0.1/32"},
IPv6: &[]string{"1234::5678"},
},
},
}
Expand All @@ -46,9 +46,9 @@ func TestLKECluster_withACL(t *testing.T) {
linodego.LKEClusterControlPlaneACLUpdateOptions{
ACL: linodego.LKEClusterControlPlaneACLOptions{
Enabled: &valueTrue,
Addresses: &linodego.LKEClusterControlPlaneACLAddresses{
IPv4: []string{"10.0.0.2/32"},
IPv6: []string{},
Addresses: &linodego.LKEClusterControlPlaneACLAddressesOptions{
IPv4: &[]string{"10.0.0.2/32"},
IPv6: &[]string{},
},
},
},
Expand Down

0 comments on commit ac5c248

Please sign in to comment.