-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new: [BREAKING] Add support for LKE Control Plane ACL (#495)
* Initial implementation; needs testing * Fix control plane omit empty * Add integration tests * Update IPv6 address * Add event actions * Account for fixture sanitization * make tidy * oops * oops again * Make enabled a *bool * [PROPOSED] breaking change * fix test * Use pointers for addresses * Reorder for readability * Address comment feedback
- Loading branch information
1 parent
bb0ff3f
commit 7c73ad6
Showing
8 changed files
with
857 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
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. | ||
type LKEClusterControlPlaneACL struct { | ||
Enabled bool `json:"enabled"` | ||
Addresses *LKEClusterControlPlaneACLAddresses `json:"addresses"` | ||
} | ||
|
||
// 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 *LKEClusterControlPlaneACLAddressesOptions `json:"addresses,omitempty"` | ||
} | ||
|
||
// 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. | ||
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. | ||
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. | ||
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), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.