Skip to content

Commit

Permalink
Make enabled a *bool
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarber-akamai committed Apr 29, 2024
1 parent 1bbab93 commit f2219b4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lke_clusters_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type LKEClusterControlPlaneACLAddresses struct {
// LKEClusterControlPlaneACL describes the ACL configuration
// for an LKE cluster's control plane.
type LKEClusterControlPlaneACL struct {
Enabled bool `json:"enabled,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Addresses *LKEClusterControlPlaneACLAddresses `json:"addresses,omitempty"`
}

Expand Down
26 changes: 13 additions & 13 deletions test/integration/fixtures/TestLKECluster_withACL.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Mon, 29 Apr 2024 17:01:06 GMT
- Mon, 29 Apr 2024 17:28:41 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -307,7 +307,7 @@ interactions:
url: https://api.linode.com/v4beta/lke/clusters
method: POST
response:
body: '{"id": 173783, "status": "ready", "created": "2018-01-02T03:04:05", "updated":
body: '{"id": 173796, "status": "ready", "created": "2018-01-02T03:04:05", "updated":
"2018-01-02T03:04:05", "label": "go-test-def", "region": "ap-west", "k8s_version":
"1.29", "control_plane": {"high_availability": false}, "tags": ["testing"]}'
headers:
Expand All @@ -332,7 +332,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Mon, 29 Apr 2024 17:01:34 GMT
- Mon, 29 Apr 2024 17:29:09 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -365,7 +365,7 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/lke/clusters/173783/control_plane_acl
url: https://api.linode.com/v4beta/lke/clusters/173796/control_plane_acl
method: GET
response:
body: '{"acl": {"enabled": true, "addresses": {"ipv4": ["10.0.0.1/32"], "ipv6":
Expand All @@ -392,7 +392,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Mon, 29 Apr 2024 17:01:35 GMT
- Mon, 29 Apr 2024 17:29:10 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -426,7 +426,7 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/lke/clusters/173783/control_plane_acl
url: https://api.linode.com/v4beta/lke/clusters/173796/control_plane_acl
method: PUT
response:
body: '{"acl": {"enabled": true, "addresses": {"ipv4": ["10.0.0.2/32"]}}}'
Expand All @@ -452,7 +452,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Mon, 29 Apr 2024 17:01:38 GMT
- Mon, 29 Apr 2024 17:29:13 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -485,7 +485,7 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/lke/clusters/173783/control_plane_acl
url: https://api.linode.com/v4beta/lke/clusters/173796/control_plane_acl
method: DELETE
response:
body: '{}'
Expand All @@ -511,7 +511,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Mon, 29 Apr 2024 17:01:41 GMT
- Mon, 29 Apr 2024 17:29:15 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -544,7 +544,7 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/lke/clusters/173783/control_plane_acl
url: https://api.linode.com/v4beta/lke/clusters/173796/control_plane_acl
method: GET
response:
body: '{"acl": {"enabled": false, "addresses": null}}'
Expand All @@ -570,7 +570,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Mon, 29 Apr 2024 17:01:41 GMT
- Mon, 29 Apr 2024 17:29:16 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -604,7 +604,7 @@ interactions:
- application/json
User-Agent:
- linodego/dev https://github.com/linode/linodego
url: https://api.linode.com/v4beta/lke/clusters/173783
url: https://api.linode.com/v4beta/lke/clusters/173796
method: DELETE
response:
body: '{}'
Expand All @@ -630,7 +630,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Mon, 29 Apr 2024 17:02:04 GMT
- Mon, 29 Apr 2024 17:29:38 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down
12 changes: 7 additions & 5 deletions test/integration/lke_clusters_acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import (
)

func TestLKECluster_withACL(t *testing.T) {
valueTrue := true

client, cluster, teardown, err := setupLKECluster(
t,
[]clusterModifier{
func(options *linodego.LKEClusterCreateOptions) {
options.ControlPlane = &linodego.LKEClusterControlPlane{
ACL: &linodego.LKEClusterControlPlaneACL{
Enabled: true,
Enabled: &valueTrue,
Addresses: &linodego.LKEClusterControlPlaneACLAddresses{
IPv4: []string{"10.0.0.1/32"},
IPv6: []string{"1234::5678"},
Expand All @@ -39,7 +41,7 @@ func TestLKECluster_withACL(t *testing.T) {
acl, err := client.GetLKEClusterControlPlaneACL(context.Background(), cluster.ID)
assert.NoError(t, err)

require.Equal(t, true, acl.ACL.Enabled)
require.Equal(t, true, *acl.ACL.Enabled)
require.Equal(t, "10.0.0.1/32", acl.ACL.Addresses.IPv4[0])
require.Equal(t, "1234::5678/128", acl.ACL.Addresses.IPv6[0])

Expand All @@ -48,7 +50,7 @@ func TestLKECluster_withACL(t *testing.T) {
cluster.ID,
linodego.LKEClusterControlPlaneACLUpdateOptions{
ACL: linodego.LKEClusterControlPlaneACL{
Enabled: true,
Enabled: &valueTrue,
Addresses: &linodego.LKEClusterControlPlaneACLAddresses{
IPv4: []string{"10.0.0.2/32"},
IPv6: []string{},
Expand All @@ -58,7 +60,7 @@ func TestLKECluster_withACL(t *testing.T) {
)
require.NoError(t, err)

require.Equal(t, true, acl.ACL.Enabled)
require.Equal(t, true, *acl.ACL.Enabled)
require.Equal(t, "10.0.0.2/32", acl.ACL.Addresses.IPv4[0])
require.Equal(t, 0, len(acl.ACL.Addresses.IPv6))

Expand All @@ -68,5 +70,5 @@ func TestLKECluster_withACL(t *testing.T) {
acl, err = client.GetLKEClusterControlPlaneACL(context.Background(), cluster.ID)
assert.NoError(t, err)

assert.Equal(t, false, acl.ACL.Enabled)
assert.Equal(t, false, *acl.ACL.Enabled)
}

0 comments on commit f2219b4

Please sign in to comment.