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