1 package linodego
2 3 import "context"
4 5 // LKEClusterControlPlane fields contained within the `control_plane` attribute of an LKE cluster.
6 type LKEClusterControlPlane struct {
7 HighAvailability bool `json:"high_availability"`
8 9 // AuditLogsEnabled may not currently be available to all users and can only be used with v4beta.
10 AuditLogsEnabled bool `json:"audit_logs_enabled,omitempty"`
11 }
12 13 // LKEClusterControlPlaneACLAddresses describes the
14 // allowed IP ranges for an LKE cluster's control plane.
15 type LKEClusterControlPlaneACLAddresses struct {
16 IPv4 []string `json:"ipv4"`
17 IPv6 []string `json:"ipv6"`
18 }
19 20 // LKEClusterControlPlaneACL describes the ACL configuration
21 // for an LKE cluster's control plane.
22 type LKEClusterControlPlaneACL struct {
23 Enabled bool `json:"enabled"`
24 Addresses *LKEClusterControlPlaneACLAddresses `json:"addresses"`
25 RevisionID string `json:"revision-id"`
26 }
27 28 // LKEClusterControlPlaneACLAddressesOptions are the options used to
29 // specify the allowed IP ranges for an LKE cluster's control plane.
30 type LKEClusterControlPlaneACLAddressesOptions struct {
31 IPv4 *[]string `json:"ipv4,omitempty"`
32 IPv6 *[]string `json:"ipv6,omitempty"`
33 }
34 35 // LKEClusterControlPlaneACLOptions represents the options used when
36 // configuring an LKE cluster's control plane ACL policy.
37 type LKEClusterControlPlaneACLOptions struct {
38 Enabled *bool `json:"enabled,omitempty"`
39 Addresses *LKEClusterControlPlaneACLAddressesOptions `json:"addresses,omitempty"`
40 RevisionID string `json:"revision-id,omitempty"`
41 }
42 43 // LKEClusterControlPlaneOptions represents the options used when
44 // configuring an LKE cluster's control plane.
45 type LKEClusterControlPlaneOptions struct {
46 HighAvailability *bool `json:"high_availability,omitempty"`
47 ACL *LKEClusterControlPlaneACLOptions `json:"acl,omitempty"`
48 49 // AuditLogsEnabled may not currently be available to all users and can only be used with v4beta.
50 AuditLogsEnabled *bool `json:"audit_logs_enabled,omitempty"`
51 }
52 53 // LKEClusterControlPlaneACLUpdateOptions represents the options
54 // available when updating the ACL configuration of an LKE cluster's
55 // control plane.
56 type LKEClusterControlPlaneACLUpdateOptions struct {
57 ACL LKEClusterControlPlaneACLOptions `json:"acl"`
58 }
59 60 // LKEClusterControlPlaneACLResponse represents the response structure
61 // for the Client.GetLKEClusterControlPlaneACL(...) method.
62 type LKEClusterControlPlaneACLResponse struct {
63 ACL LKEClusterControlPlaneACL `json:"acl"`
64 }
65 66 // GetLKEClusterControlPlaneACL gets the ACL configuration for the
67 // given cluster's control plane.
68 func (c *Client) GetLKEClusterControlPlaneACL(ctx context.Context, clusterID int) (*LKEClusterControlPlaneACLResponse, error) {
69 return doGETRequest[LKEClusterControlPlaneACLResponse](
70 ctx,
71 c,
72 formatAPIPath("lke/clusters/%d/control_plane_acl", clusterID),
73 )
74 }
75 76 // UpdateLKEClusterControlPlaneACL updates the ACL configuration for the
77 // given cluster's control plane.
78 func (c *Client) UpdateLKEClusterControlPlaneACL(
79 ctx context.Context,
80 clusterID int,
81 opts LKEClusterControlPlaneACLUpdateOptions,
82 ) (*LKEClusterControlPlaneACLResponse, error) {
83 return doPUTRequest[LKEClusterControlPlaneACLResponse](
84 ctx,
85 c,
86 formatAPIPath("lke/clusters/%d/control_plane_acl", clusterID),
87 opts,
88 )
89 }
90 91 // DeleteLKEClusterControlPlaneACL deletes the ACL configuration for the
92 // given cluster's control plane.
93 func (c *Client) DeleteLKEClusterControlPlaneACL(
94 ctx context.Context,
95 clusterID int,
96 ) error {
97 return doDELETERequest(
98 ctx,
99 c,
100 formatAPIPath("lke/clusters/%d/control_plane_acl", clusterID),
101 )
102 }
103