Skip to content

Commit 1404604

Browse files
feat(resourcemanager): add multi API version support (#5123)
relates to STACKITSDK-351 Co-authored-by: Ruben Hoenle <Ruben.Hoenle@stackit.cloud>
1 parent 054d53b commit 1404604

File tree

66 files changed

+11781
-114
lines changed

Some content is hidden

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

66 files changed

+11781
-114
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
- **Breaking change:** Renamed `TargetPoolTlsConfig` to `TlsConfig`
99
- `loadbalancer`: [v1.8.0](services/loadbalancer/CHANGELOG.md#v180)
1010
- **Feature:** Add new fields `AltPort` and `HttpHealthCheck` to `ActiveHealthCheck`
11+
- `resourcemanager`: [v0.19.0](services/resourcemanager/CHANGELOG.md#v0190)
12+
- **Feature:** Introduction of multi API version support for the resourcemanager SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062
13+
- `v0api`: New package which should be used for communication with the STACKIT Resourcemanager API in the future
14+
- **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 `v0api` package instead.
15+
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
16+
- **Breaking Change:** Removal of deprecated constants `ActiveState` and `CreatingState` in `wait` package
1117

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

examples/resourcemanager/go.mod

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ module github.com/stackitcloud/stackit-sdk-go/examples/resourcemanager
22

33
go 1.21
44

5-
require (
6-
github.com/stackitcloud/stackit-sdk-go/core v0.21.1
7-
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.18.5
8-
)
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/resourcemanager => ../../services/resourcemanager
7+
8+
require github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.0.0-00010101000000-000000000000
99

1010
require (
1111
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
1212
github.com/google/uuid v1.6.0 // indirect
13+
github.com/stackitcloud/stackit-sdk-go/core v0.22.0 // indirect
1314
)

examples/resourcemanager/go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@ 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/resourcemanager v0.18.5 h1:MZ5aTO2NQ1Jecmi67ByGskve5nKXHl91fE+z+vFjxt4=
10-
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.18.5/go.mod h1:CJLmdqWvJm5/3+lXPDKu8k4WXs2UG8euGoqQX5xE79k=
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=

examples/resourcemanager/resourcemanager.go

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

8-
"github.com/stackitcloud/stackit-sdk-go/core/utils"
9-
"github.com/stackitcloud/stackit-sdk-go/services/resourcemanager"
8+
resourcemanager "github.com/stackitcloud/stackit-sdk-go/services/resourcemanager/v0api"
109
)
1110

1211
func main() {
@@ -21,28 +20,28 @@ func main() {
2120
}
2221

2322
// Get the projects under a specific resource (organization)
24-
getProjectsResp, err := client.ListProjects(context.Background()).ContainerParentId(parentOrganizationId).Execute()
23+
getProjectsResp, err := client.DefaultAPI.ListProjects(context.Background()).ContainerParentId(parentOrganizationId).Execute()
2524
if err != nil {
2625
fmt.Fprintf(os.Stderr, "Error when calling `GetProjects`: %v\n", err)
2726
} else {
28-
fmt.Printf("Number of projects: %v\n", len(*getProjectsResp.Items))
27+
fmt.Printf("Number of projects: %v\n", len(getProjectsResp.Items))
2928
}
3029

3130
// Create a project
3231
createProjectPayload := resourcemanager.CreateProjectPayload{
33-
ContainerParentId: utils.Ptr(parentOrganizationId),
34-
Name: utils.Ptr("my-project"),
35-
Members: &[]resourcemanager.Member{
32+
ContainerParentId: parentOrganizationId,
33+
Name: "my-project",
34+
Members: []resourcemanager.Member{
3635
{
37-
Role: utils.Ptr("project.owner"),
38-
Subject: utils.Ptr("owner-email@example.com"),
36+
Role: "project.owner",
37+
Subject: "owner-email@example.com",
3938
},
4039
},
4140
}
42-
createProjectResp, err := client.CreateProject(context.Background()).CreateProjectPayload(createProjectPayload).Execute()
41+
createProjectResp, err := client.DefaultAPI.CreateProject(context.Background()).CreateProjectPayload(createProjectPayload).Execute()
4342
if err != nil {
4443
fmt.Fprintf(os.Stderr, "Error when calling `CreateProject`: %v\n", err)
4544
} else {
46-
fmt.Printf("Created project with id \"%s\".\n", *createProjectResp.ProjectId)
45+
fmt.Printf("Created project with id \"%s\".\n", createProjectResp.ProjectId)
4746
}
4847
}

golang-ci.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,10 @@ linters:
9393
- unparam # false positives
9494
issues:
9595
exclude-use-default: false
96+
exclude-rules:
97+
# This ignores all deprecation warnings in the old wait packages while we have the compatibilty layer in place
98+
- path: ^wait/[^/]+\.go$
99+
linters:
100+
- staticcheck
101+
text: "SA1019:"
96102
go: 1.21

services/resourcemanager/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## v0.19.0
2+
- **Feature:** Introduction of multi API version support for the resourcemanager SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062
3+
- `v0api`: New package which should be used for communication with the STACKIT Resourcemanager API in the future
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 `v0api` package instead.
5+
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
6+
- **Breaking Change:** Removal of deprecated constants `ActiveState` and `CreatingState` in `wait` package
7+
18
## v0.18.5
29
- Bump STACKIT SDK core module from `v0.21.0` to `v0.21.1`
310

services/resourcemanager/VERSION

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

0 commit comments

Comments
 (0)