diff --git a/lke_clusters_acl.go b/lke_clusters_acl.go index 6c702d381..57494b618 100644 --- a/lke_clusters_acl.go +++ b/lke_clusters_acl.go @@ -5,15 +5,15 @@ import "context" // LKEClusterControlPlaneACLAddresses describes the // allowed IP ranges for an LKE cluster's control plane. type LKEClusterControlPlaneACLAddresses struct { - IPv4 []string `json:"ipv4"` - IPv6 []string `json:"ipv6"` + IPv4 []string `json:"ipv4,omitempty"` + IPv6 []string `json:"ipv6,omitempty"` } // LKEClusterControlPlaneACL describes the ACL configuration // for an LKE cluster's control plane. type LKEClusterControlPlaneACL struct { - Enabled bool `json:"enabled"` - Addresses LKEClusterControlPlaneACLAddresses `json:"addresses"` + Enabled bool `json:"enabled,omitempty"` + Addresses LKEClusterControlPlaneACLAddresses `json:"addresses,omitempty"` } // LKEClusterControlPlaneACLUpdateOptions represents the options diff --git a/test/integration/fixtures/TestLKECluster_withACL.yaml b/test/integration/fixtures/TestLKECluster_withACL.yaml index 48245fd4a..690198c4c 100644 --- a/test/integration/fixtures/TestLKECluster_withACL.yaml +++ b/test/integration/fixtures/TestLKECluster_withACL.yaml @@ -269,7 +269,7 @@ interactions: Content-Type: - application/json Expires: - - Mon, 29 Apr 2024 16:51:45 GMT + - Mon, 29 Apr 2024 17:01:06 GMT Pragma: - no-cache Strict-Transport-Security: @@ -307,7 +307,7 @@ interactions: url: https://api.linode.com/v4beta/lke/clusters method: POST response: - body: '{"id": 173778, "status": "ready", "created": "2018-01-02T03:04:05", "updated": + body: '{"id": 173783, "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: @@ -332,7 +332,7 @@ interactions: Content-Type: - application/json Expires: - - Mon, 29 Apr 2024 16:52:13 GMT + - Mon, 29 Apr 2024 17:01:34 GMT Pragma: - no-cache Strict-Transport-Security: @@ -365,7 +365,7 @@ interactions: - application/json User-Agent: - linodego/dev https://github.com/linode/linodego - url: https://api.linode.com/v4beta/lke/clusters/173778/control_plane_acl + url: https://api.linode.com/v4beta/lke/clusters/173783/control_plane_acl method: GET response: body: '{"acl": {"enabled": true, "addresses": {"ipv4": ["10.0.0.1/32"], "ipv6": @@ -392,7 +392,7 @@ interactions: Content-Type: - application/json Expires: - - Mon, 29 Apr 2024 16:52:13 GMT + - Mon, 29 Apr 2024 17:01:35 GMT Pragma: - no-cache Strict-Transport-Security: @@ -417,7 +417,7 @@ interactions: code: 200 duration: "" - request: - body: '{"acl":{"enabled":true,"addresses":{"ipv4":["10.0.0.2/32"],"ipv6":["1234::5678"]}}}' + body: '{"acl":{"enabled":true,"addresses":{"ipv4":["10.0.0.2/32"]}}}' form: {} headers: Accept: @@ -426,11 +426,10 @@ interactions: - application/json User-Agent: - linodego/dev https://github.com/linode/linodego - url: https://api.linode.com/v4beta/lke/clusters/173778/control_plane_acl + url: https://api.linode.com/v4beta/lke/clusters/173783/control_plane_acl method: PUT response: - body: '{"acl": {"enabled": true, "addresses": {"ipv4": ["10.0.0.2/32"], "ipv6": - ["1234::5678/128"]}}}' + body: '{"acl": {"enabled": true, "addresses": {"ipv4": ["10.0.0.2/32"]}}}' headers: Access-Control-Allow-Credentials: - "true" @@ -447,13 +446,13 @@ interactions: Connection: - keep-alive Content-Length: - - "94" + - "66" Content-Security-Policy: - default-src 'none' Content-Type: - application/json Expires: - - Mon, 29 Apr 2024 16:52:17 GMT + - Mon, 29 Apr 2024 17:01:38 GMT Pragma: - no-cache Strict-Transport-Security: @@ -486,7 +485,7 @@ interactions: - application/json User-Agent: - linodego/dev https://github.com/linode/linodego - url: https://api.linode.com/v4beta/lke/clusters/173778/control_plane_acl + url: https://api.linode.com/v4beta/lke/clusters/173783/control_plane_acl method: DELETE response: body: '{}' @@ -512,7 +511,7 @@ interactions: Content-Type: - application/json Expires: - - Mon, 29 Apr 2024 16:52:19 GMT + - Mon, 29 Apr 2024 17:01:41 GMT Pragma: - no-cache Strict-Transport-Security: @@ -545,7 +544,7 @@ interactions: - application/json User-Agent: - linodego/dev https://github.com/linode/linodego - url: https://api.linode.com/v4beta/lke/clusters/173778/control_plane_acl + url: https://api.linode.com/v4beta/lke/clusters/173783/control_plane_acl method: GET response: body: '{"acl": {"enabled": false, "addresses": null}}' @@ -571,7 +570,7 @@ interactions: Content-Type: - application/json Expires: - - Mon, 29 Apr 2024 16:52:20 GMT + - Mon, 29 Apr 2024 17:01:41 GMT Pragma: - no-cache Strict-Transport-Security: @@ -605,7 +604,7 @@ interactions: - application/json User-Agent: - linodego/dev https://github.com/linode/linodego - url: https://api.linode.com/v4beta/lke/clusters/173778 + url: https://api.linode.com/v4beta/lke/clusters/173783 method: DELETE response: body: '{}' @@ -631,7 +630,7 @@ interactions: Content-Type: - application/json Expires: - - Mon, 29 Apr 2024 16:52:42 GMT + - Mon, 29 Apr 2024 17:02:04 GMT Pragma: - no-cache Strict-Transport-Security: diff --git a/test/integration/lke_clusters_acl_test.go b/test/integration/lke_clusters_acl_test.go index 9ba2e2657..4ba0cc4c5 100644 --- a/test/integration/lke_clusters_acl_test.go +++ b/test/integration/lke_clusters_acl_test.go @@ -51,7 +51,7 @@ func TestLKECluster_withACL(t *testing.T) { Enabled: true, Addresses: linodego.LKEClusterControlPlaneACLAddresses{ IPv4: []string{"10.0.0.2/32"}, - IPv6: []string{"1235::5678"}, + IPv6: []string{}, }, }, }, @@ -60,7 +60,7 @@ func TestLKECluster_withACL(t *testing.T) { require.Equal(t, true, acl.ACL.Enabled) require.Equal(t, "10.0.0.2/32", acl.ACL.Addresses.IPv4[0]) - require.Equal(t, "1235::5678/128", acl.ACL.Addresses.IPv6[0]) + require.Equal(t, 0, len(acl.ACL.Addresses.IPv6)) err = client.DeleteLKEClusterControlPlaneACL(context.Background(), cluster.ID) require.NoError(t, err)