Skip to content

Commit 2290bad

Browse files
feat(edge): add multi API version support (#5395)
relates to STACKITSDK-334 Co-authored-by: Ruben Hoenle <Ruben.Hoenle@stackit.cloud>
1 parent 8ed1361 commit 2290bad

Some content is hidden

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

46 files changed

+7362
-46
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
- `v3alpha1api`: New package which can be used for communication with the postgresflex v3 alpha1 API
4040
- **Deprecation:** The contents in the root of this SDK module including the `wait` package are marked as deprecated and will be removed after 2026-09-30. Switch to the new packages for the available API versions instead.
4141
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
42+
- `edge`: [v0.5.0](services/edge/CHANGELOG.md#v050)
43+
- **Feature:** Introduction of multi API version support for the edge SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062
44+
- `v1beta1api`: New package which can be used for communication with the edge v1 beta1 API
45+
- **Deprecation:** The contents in the root of this SDK module including the `wait` package are marked as deprecated and will be removed after 2026-09-30. Switch to the new packages for the available API versions instead.
46+
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
4247

4348
## Release (2026-02-20)
4449
- `core`: [v0.21.1](core/CHANGELOG.md#v0211)

examples/edge/edge.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"time"
88

99
"github.com/stackitcloud/stackit-sdk-go/core/utils"
10-
"github.com/stackitcloud/stackit-sdk-go/services/edge"
11-
"github.com/stackitcloud/stackit-sdk-go/services/edge/wait"
10+
edge "github.com/stackitcloud/stackit-sdk-go/services/edge/v1beta1api"
11+
"github.com/stackitcloud/stackit-sdk-go/services/edge/v1beta1api/wait"
1212
"gopkg.in/yaml.v3"
1313
)
1414

@@ -30,8 +30,8 @@ func main() {
3030
instance *edge.Instance
3131
ctx = context.Background()
3232
)
33-
payload.DisplayName = utils.Ptr("example")
34-
instance, err = client.CreateInstance(ctx, projectId, region).CreateInstancePayload(*payload).Execute()
33+
payload.DisplayName = "example"
34+
instance, err = client.DefaultAPI.CreateInstance(ctx, projectId, region).CreateInstancePayload(*payload).Execute()
3535
if err != nil {
3636
fmt.Fprintf(os.Stderr, "[Edge API] Failed to create Instance: %v\n", err)
3737
os.Exit(1)
@@ -41,7 +41,7 @@ func main() {
4141
// Wait for Edge Instance to become active
4242
waitResult, err := wait.CreateOrUpdateInstanceWaitHandler(
4343
ctx,
44-
client,
44+
client.DefaultAPI,
4545
projectId,
4646
region,
4747
instance.GetId(),
@@ -55,7 +55,7 @@ func main() {
5555
// Create a service token to login to the instance UI and wait for the instance to become ready
5656
token, err := wait.TokenWaitHandler(
5757
ctx,
58-
client,
58+
client.DefaultAPI,
5959
projectId,
6060
region,
6161
instance.GetId(),
@@ -65,14 +65,14 @@ func main() {
6565
fmt.Fprintf(os.Stderr, "[Edge API] Failed wait for token creation: %v\n", err)
6666
os.Exit(1)
6767
}
68-
if token != nil && token.Token != nil {
69-
fmt.Printf("Token: %s\n", *token.Token)
68+
if token != nil {
69+
fmt.Printf("Token: %s\n", token.Token)
7070
}
7171

7272
// Create a kubeconfig to interact with the instances kubernetes API and wait for the instance to become ready
7373
kubeconfig, err := wait.KubeconfigWaitHandler(
7474
ctx,
75-
client,
75+
client.DefaultAPI,
7676
projectId,
7777
region,
7878
instance.GetId(),
@@ -94,15 +94,15 @@ func main() {
9494
}
9595

9696
// Delete Edge Instance
97-
err = client.DeleteInstance(ctx, projectId, region, instance.GetId()).Execute()
97+
err = client.DefaultAPI.DeleteInstance(ctx, projectId, region, instance.GetId()).Execute()
9898
if err != nil {
9999
fmt.Fprintf(os.Stderr, "[Edge API] Failed to delete instance: %v\n", err)
100100
os.Exit(1)
101101
}
102102
fmt.Printf("[Edge API] Instance deletion started, Id: %s\n", instance.GetId())
103103

104104
// Wait for Edge instance deletion
105-
_, err = wait.DeleteInstanceWaitHandler(ctx, client, projectId, region, instance.GetId()).SetTimeout(10 * time.Minute).WaitWithContext(ctx)
105+
_, err = wait.DeleteInstanceWaitHandler(ctx, client.DefaultAPI, projectId, region, instance.GetId()).SetTimeout(10 * time.Minute).WaitWithContext(ctx)
106106
if err != nil {
107107
fmt.Fprintf(os.Stderr, "[Edge API] Failed wait for Instance deletion: %v\n", err)
108108
os.Exit(1)

examples/edge/go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ module github.com/stackitcloud/stackit-sdk-go/examples/edge
22

33
go 1.21
44

5+
// This is not needed in production. This is only here to point the golangci linter to the local version instead of the last release on GitHub.
6+
replace github.com/stackitcloud/stackit-sdk-go/services/edge => ../../services/edge
7+
58
require (
6-
github.com/stackitcloud/stackit-sdk-go/core v0.21.1
9+
github.com/stackitcloud/stackit-sdk-go/core v0.22.0
710
github.com/stackitcloud/stackit-sdk-go/services/edge v0.4.3
811
gopkg.in/yaml.v3 v3.0.1
912
)

examples/edge/go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
44
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
55
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
66
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
7-
github.com/stackitcloud/stackit-sdk-go/core v0.21.1 h1:Y/PcAgM7DPYMNqum0MLv4n1mF9ieuevzcCIZYQfm3Ts=
8-
github.com/stackitcloud/stackit-sdk-go/core v0.21.1/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI=
9-
github.com/stackitcloud/stackit-sdk-go/services/edge v0.4.3 h1:TxChb2qbO82JiQEBYClSSD5HZxqKeKJ6dIvkEUCJmbs=
10-
github.com/stackitcloud/stackit-sdk-go/services/edge v0.4.3/go.mod h1:KVWvQHb7CQLD9DzA4Np3WmakiCCsrHaCXvFEnOQ7nPk=
7+
github.com/stackitcloud/stackit-sdk-go/core v0.22.0 h1:6rViz7GnNwXSh51Lur5xuDzO8EWSZfN9J0HvEkBKq6c=
8+
github.com/stackitcloud/stackit-sdk-go/core v0.22.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI=
119
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
1210
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
1311
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

services/edge/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v0.5.0
2+
- **Feature:** Introduction of multi API version support for the edge SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062
3+
- `v1beta1api`: New package which can be used for communication with the edge v1 beta1 API
4+
- **Deprecation:** The contents in the root of this SDK module including the `wait` package are marked as deprecated and will be removed after 2026-09-30. Switch to the new packages for the available API versions instead.
5+
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
6+
17
## v0.4.3
28
- Bump STACKIT SDK core module from `v0.21.0` to `v0.21.1`
39

services/edge/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.4.3
1+
v0.5.0

0 commit comments

Comments
 (0)