Skip to content

Commit f539282

Browse files
feat(serviceenablement): add multi API version support (#5779)
relates to STACKITSDK-358 Co-authored-by: Ruben Hoenle <Ruben.Hoenle@stackit.cloud>
1 parent f619dad commit f539282

Some content is hidden

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

54 files changed

+8212
-33
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@
181181
- `v2api`: New package which should be used for communication with the STACKIT serviceaccount API in the future
182182
- **Deprecation:** The contents in the root of this SDK module are marked as deprecated and will be removed after 2026-09-30. Switch to the new `v2api` package instead.
183183
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
184+
- `serviceenablement`: [v1.3.0](services/serviceenablement/CHANGELOG.md#v130)
185+
- **Feature:** Introduction of multi API version support for the serviceenablement SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062
186+
- `v1api`: New package which can be used for communication with the serviceenablement v1 API
187+
- `v2api`: New package which can be used for communication with the serviceenablement v2 API
188+
- **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.
189+
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
184190

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

examples/serviceenablement/go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ module github.com/stackitcloud/stackit-sdk-go/examples/serviceenablement
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/serviceenablement => ../../services/serviceenablement
7+
58
require github.com/stackitcloud/stackit-sdk-go/services/serviceenablement v1.2.7
69

710
require (
811
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
912
github.com/google/uuid v1.6.0 // indirect
10-
github.com/stackitcloud/stackit-sdk-go/core v0.21.1 // indirect
13+
github.com/stackitcloud/stackit-sdk-go/core v0.22.0 // indirect
1114
)

examples/serviceenablement/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/serviceenablement v1.2.7 h1:M2PYLF8k3zmAwYWSKfUiCTNTXr7ROGuJganVVEQA3YI=
10-
github.com/stackitcloud/stackit-sdk-go/services/serviceenablement v1.2.7/go.mod h1:jitkQuP2K/SH63Qor0C4pcqz1GDCy/lK2H4t8/VDse4=
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/serviceenablement/serviceenablement.go

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

8-
"github.com/stackitcloud/stackit-sdk-go/services/serviceenablement"
9-
"github.com/stackitcloud/stackit-sdk-go/services/serviceenablement/wait"
8+
serviceenablement "github.com/stackitcloud/stackit-sdk-go/services/serviceenablement/v2api"
9+
"github.com/stackitcloud/stackit-sdk-go/services/serviceenablement/v2api/wait"
1010
)
1111

1212
func main() {
@@ -21,43 +21,43 @@ func main() {
2121
region := "eu01"
2222

2323
// List Services
24-
listServicesResp, err := client.ListServiceStatusRegionalExecute(context.Background(), region, projectId)
24+
listServicesResp, err := client.DefaultAPI.ListServiceStatusRegional(context.Background(), region, projectId).Execute()
2525
if err != nil {
2626
fmt.Fprintf(os.Stderr, "Error when calling `ListServices`: %v\n", err)
2727
} else {
28-
fmt.Printf("Number of services: %v\n", len(*listServicesResp.Items))
28+
fmt.Printf("Number of services: %v\n", len(listServicesResp.Items))
2929
}
3030

3131
// Get Service Id from the list of services
32-
serviceId := (*listServicesResp.Items)[0].ServiceId
32+
serviceId := listServicesResp.Items[0].ServiceId
3333

34-
getServiceStatusResp, err := client.GetServiceStatusRegional(context.Background(), region, projectId, *serviceId).Execute()
34+
getServiceStatusResp, err := client.DefaultAPI.GetServiceStatusRegional(context.Background(), region, projectId, *serviceId).Execute()
3535
if err != nil {
3636
fmt.Fprintf(os.Stderr, "Error when calling `GetServiceStatus`: %v\n", err)
3737
} else {
3838
fmt.Printf("Service state: %s\n", *getServiceStatusResp.State)
3939
}
4040

4141
// Enable Service
42-
err = client.EnableServiceRegional(context.Background(), region, projectId, *serviceId).Execute()
42+
err = client.DefaultAPI.EnableServiceRegional(context.Background(), region, projectId, *serviceId).Execute()
4343
if err != nil {
4444
fmt.Fprintf(os.Stderr, "Error when calling `EnableService`: %v\n", err)
4545
}
4646
// Wait for the service to be enabled
47-
status, err := wait.EnableServiceWaitHandler(context.Background(), client, region, projectId, *serviceId).WaitWithContext(context.Background())
47+
status, err := wait.EnableServiceWaitHandler(context.Background(), client.DefaultAPI, region, projectId, *serviceId).WaitWithContext(context.Background())
4848
if err != nil {
4949
fmt.Fprintf(os.Stderr, "Error when waiting for service to be enabled: %v\n", err)
5050
} else {
5151
fmt.Printf("Service %q is now enabled\n", *status.ServiceId)
5252
}
5353

5454
// Disable Service
55-
err = client.DisableServiceRegional(context.Background(), region, projectId, *serviceId).Execute()
55+
err = client.DefaultAPI.DisableServiceRegional(context.Background(), region, projectId, *serviceId).Execute()
5656
if err != nil {
5757
fmt.Fprintf(os.Stderr, "Error when calling `DisableService`: %v\n", err)
5858
}
5959
// Wait for the service to be disabled
60-
status, err = wait.DisableServiceWaitHandler(context.Background(), client, region, projectId, *serviceId).WaitWithContext(context.Background())
60+
status, err = wait.DisableServiceWaitHandler(context.Background(), client.DefaultAPI, region, projectId, *serviceId).WaitWithContext(context.Background())
6161
if err != nil {
6262
fmt.Fprintf(os.Stderr, "Error when waiting for service to be disabled: %v\n", err)
6363
} else {

services/serviceenablement/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## v1.3.0
2+
- **Feature:** Introduction of multi API version support for the serviceenablement SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062
3+
- `v1api`: New package which can be used for communication with the serviceenablement v1 API
4+
- `v2api`: New package which can be used for communication with the serviceenablement v2 API
5+
- **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.
6+
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
7+
18
## v1.2.7
29
- Bump STACKIT SDK core module from `v0.21.0` to `v0.21.1`
310

services/serviceenablement/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.2.7
1+
v1.3.0

services/serviceenablement/api_default.go

Lines changed: 41 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)