@@ -3,6 +3,7 @@ package linodego
33import (
44 "context"
55 "encoding/json"
6+ "fmt"
67 "time"
78
89 "github.com/linode/linodego/internal/parseabletime"
@@ -31,6 +32,9 @@ type LKECluster struct {
3132
3233 // NOTE: Tier may not currently be available to all users and can only be used with v4beta.
3334 Tier string `json:"tier"`
35+
36+ // NOTE: APLEnabled is currently in beta and may only function with API version v4beta.
37+ APLEnabled bool `json:"apl_enabled"`
3438}
3539
3640// LKEClusterCreateOptions fields are those accepted by CreateLKECluster
@@ -44,6 +48,9 @@ type LKEClusterCreateOptions struct {
4448
4549 // NOTE: Tier may not currently be available to all users and can only be used with v4beta.
4650 Tier string `json:"tier,omitempty"`
51+
52+ // NOTE: APLEnabled is currently in beta and may only function with API version v4beta.
53+ APLEnabled bool `json:"apl_enabled,omitempty"`
4754}
4855
4956// LKEClusterUpdateOptions fields are those accepted by UpdateLKECluster
@@ -246,3 +253,31 @@ func (c *Client) DeleteLKEClusterServiceToken(ctx context.Context, clusterID int
246253 e := formatAPIPath ("lke/clusters/%d/servicetoken" , clusterID )
247254 return doDELETERequest (ctx , c , e )
248255}
256+
257+ // GetLKEClusterAPLConsoleURL gets the URL of this cluster's APL installation if this cluster is APL-enabled.
258+ func (c * Client ) GetLKEClusterAPLConsoleURL (ctx context.Context , clusterID int ) (string , error ) {
259+ cluster , err := c .GetLKECluster (ctx , clusterID )
260+ if err != nil {
261+ return "" , err
262+ }
263+
264+ if cluster .APLEnabled {
265+ return fmt .Sprintf ("https://console.lke%d.akamai-apl.net" , cluster .ID ), nil
266+ }
267+
268+ return "" , nil
269+ }
270+
271+ // GetLKEClusterAPLHealthCheckURL gets the URL of this cluster's APL health check endpoint if this cluster is APL-enabled.
272+ func (c * Client ) GetLKEClusterAPLHealthCheckURL (ctx context.Context , clusterID int ) (string , error ) {
273+ cluster , err := c .GetLKECluster (ctx , clusterID )
274+ if err != nil {
275+ return "" , err
276+ }
277+
278+ if cluster .APLEnabled {
279+ return fmt .Sprintf ("https://auth.lke%d.akamai-apl.net/ready" , cluster .ID ), nil
280+ }
281+
282+ return "" , nil
283+ }
0 commit comments