Skip to content

Commit 45e6b7c

Browse files
authored
Region adjustement SKE (#3072)
* Region adjustement SKE Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de> * Adjust waiters, example and changelog Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de> --------- Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
1 parent 3a76557 commit 45e6b7c

File tree

82 files changed

+771
-473
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+771
-473
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
## Release (2025-XX-XX)
2+
3+
- `ske`: [v1.0.0](services/ske/CHANGELOG.md#v100)
4+
- **Breaking Change:** The region is no longer specified within the client configuration. Instead, the region must be passed as a parameter to any region-specific request.
25
- `opensearch`: [v0.24.0](services/opensearch/CHANGELOG.md#v0240)
36
- **Breaking change:** `InstanceParametersTlsProtocols` is now a string array instead of a single string
47
- Add `required:"true"` tags to model structs

examples/ske/ske.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"fmt"
66
"os"
77

8-
"github.com/stackitcloud/stackit-sdk-go/core/config"
98
"github.com/stackitcloud/stackit-sdk-go/core/utils"
109
"github.com/stackitcloud/stackit-sdk-go/services/ske"
1110
"github.com/stackitcloud/stackit-sdk-go/services/ske/wait"
@@ -15,10 +14,11 @@ func main() {
1514
// Specify the project ID
1615
projectId := "PROJECT_ID"
1716

17+
// Specify the region
18+
region := "REGION"
19+
1820
// Create a new API client, that uses default authentication and configuration
19-
skeClient, err := ske.NewAPIClient(
20-
config.WithRegion("eu01"),
21-
)
21+
skeClient, err := ske.NewAPIClient()
2222
if err != nil {
2323
fmt.Fprintf(os.Stderr, "Creating API client: %v\n", err)
2424
os.Exit(1)
@@ -33,7 +33,7 @@ func main() {
3333
// }
3434

3535
// Get the ske clusters for your project
36-
getClustersResp, err := skeClient.ListClusters(context.Background(), projectId).Execute()
36+
getClustersResp, err := skeClient.ListClusters(context.Background(), projectId, region).Execute()
3737
if err != nil {
3838
fmt.Fprintf(os.Stderr, "Error when calling `GetClusters`: %v\n", err)
3939
} else {
@@ -42,7 +42,7 @@ func main() {
4242

4343
var availableVersion string
4444
// Get the ske provider options
45-
getOptionsResp, err := skeClient.ListProviderOptions(context.Background()).Execute()
45+
getOptionsResp, err := skeClient.ListProviderOptions(context.Background(), region).Execute()
4646
if err != nil {
4747
fmt.Fprintf(os.Stderr, "Error when calling `GetOptions`: %v\n", err)
4848
} else {
@@ -77,47 +77,47 @@ func main() {
7777
},
7878
}
7979
clusterName := "cl-name"
80-
createClusterResp, err := skeClient.CreateOrUpdateCluster(context.Background(), projectId, clusterName).CreateOrUpdateClusterPayload(createInstancePayload).Execute()
80+
createClusterResp, err := skeClient.CreateOrUpdateCluster(context.Background(), projectId, region, clusterName).CreateOrUpdateClusterPayload(createInstancePayload).Execute()
8181
if err != nil {
8282
fmt.Fprintf(os.Stderr, "Error when calling `CreateCluster`: %v\n", err)
8383
} else {
8484
fmt.Printf("Triggered creation of cluster with name \"%s\".\n", *createClusterResp.Name)
8585
}
8686

8787
// Wait for cluster creation to complete
88-
_, err = wait.CreateOrUpdateClusterWaitHandler(context.Background(), skeClient, projectId, clusterName).WaitWithContext(context.Background())
88+
_, err = wait.CreateOrUpdateClusterWaitHandler(context.Background(), skeClient, projectId, region, clusterName).WaitWithContext(context.Background())
8989
if err != nil {
9090
fmt.Fprintf(os.Stderr, "Error when calling `CreateOrUpdateCluster`: %v\n", err)
9191
} else {
9292
fmt.Printf("Cluster created.\n")
9393
}
9494

9595
// Start cluster credential rotation
96-
_, err = skeClient.StartCredentialsRotationExecute(context.Background(), projectId, clusterName)
96+
_, err = skeClient.StartCredentialsRotationExecute(context.Background(), projectId, region, clusterName)
9797
if err != nil {
9898
fmt.Fprintf(os.Stderr, "Error when calling `StartCredentialsRotation`: %v\n", err)
9999
} else {
100100
fmt.Printf("Triggered start of cluster credentials rotation.\n")
101101
}
102102

103103
// Wait for cluster credential rotation to be prepared
104-
_, err = wait.StartCredentialsRotationWaitHandler(context.Background(), skeClient, projectId, clusterName).WaitWithContext(context.Background())
104+
_, err = wait.StartCredentialsRotationWaitHandler(context.Background(), skeClient, projectId, region, clusterName).WaitWithContext(context.Background())
105105
if err != nil {
106106
fmt.Fprintf(os.Stderr, "Error when calling `StartRotateCredentials`: %v\n", err)
107107
} else {
108108
fmt.Printf("Cluster credentials ready to rotate.\n")
109109
}
110110

111111
// Complete cluster credential rotation
112-
_, err = skeClient.CompleteCredentialsRotationExecute(context.Background(), projectId, clusterName)
112+
_, err = skeClient.CompleteCredentialsRotationExecute(context.Background(), projectId, region, clusterName)
113113
if err != nil {
114114
fmt.Fprintf(os.Stderr, "Error when calling `CompleteCredentialsRotation`: %v\n", err)
115115
} else {
116116
fmt.Printf("Triggered completion of cluster credentials rotation.\n")
117117
}
118118

119119
// Wait for cluster credential rotation to be completed
120-
_, err = wait.CompleteCredentialsRotationWaitHandler(context.Background(), skeClient, projectId, clusterName).WaitWithContext(context.Background())
120+
_, err = wait.CompleteCredentialsRotationWaitHandler(context.Background(), skeClient, projectId, region, clusterName).WaitWithContext(context.Background())
121121
if err != nil {
122122
fmt.Fprintf(os.Stderr, "Error when calling `CompleteRotateCredentials`: %v\n", err)
123123
} else {

services/ske/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v1.0.0
2+
- **Breaking Change:** The region is no longer specified within the client configuration. Instead, the region must be passed as a parameter to any region-specific request.
3+
14
## v0.27.0
25
- **Feature:** Add new `ClusterErrorCode` types: `CLUSTERERRORCODE_INFRA_SNA_NETWORK_NOT_FOUND`, `CLUSTERERRORCODE_FETCHING_ERRORS_NOT_POSSIBLE`
36

services/ske/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.27.0
1+
v1.0.0

0 commit comments

Comments
 (0)