Skip to content

Commit 12ee670

Browse files
feat(kms): add multi API version support (#5507)
relates to STACKITSDK-337 Co-authored-by: Ruben Hoenle <Ruben.Hoenle@stackit.cloud>
1 parent c8f4327 commit 12ee670

File tree

111 files changed

+27220
-88
lines changed

Some content is hidden

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

111 files changed

+27220
-88
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@
9393
- `v1api`: New package which should be used for communication with the STACKIT redis API in the future
9494
- **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.
9595
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
96+
- `kms`: [v1.4.0](services/kms/CHANGELOG.md#v140)
97+
- **Feature:** Introduction of multi API version support for the kms SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062
98+
- `v1api`: New package which can be used for communication with the kms v1 API
99+
- `v1betaapi`: New package which can be used for communication with the kms v1 beta API
100+
- **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.
101+
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
96102

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

examples/kms/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/kms
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/kms => ../../services/kms
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/kms v1.3.2
811
)
912

examples/kms/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/kms v1.3.2 h1:2ulSL2IkIAKND59eAjbEhVkOoBMyvm48ojwz1a3t0U0=
10-
github.com/stackitcloud/stackit-sdk-go/services/kms v1.3.2/go.mod h1:cuIaMMiHeHQsbvy7BOFMutoV3QtN+ZBx7Tg3GmYUw7s=
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/kms/kms.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"os"
77

88
"github.com/stackitcloud/stackit-sdk-go/core/utils"
9-
"github.com/stackitcloud/stackit-sdk-go/services/kms"
10-
"github.com/stackitcloud/stackit-sdk-go/services/kms/wait"
9+
kms "github.com/stackitcloud/stackit-sdk-go/services/kms/v1api"
10+
"github.com/stackitcloud/stackit-sdk-go/services/kms/v1api/wait"
1111
)
1212

1313
func main() {
@@ -23,11 +23,11 @@ func main() {
2323

2424
ctx := context.Background()
2525

26-
keyRing, err := kmsClient.CreateKeyRing(ctx, projectId, region).
26+
keyRing, err := kmsClient.DefaultAPI.CreateKeyRing(ctx, projectId, region).
2727
CreateKeyRingPayload(
2828
kms.CreateKeyRingPayload{
2929
Description: utils.Ptr("a test keyring"),
30-
DisplayName: utils.Ptr("test-keyring"),
30+
DisplayName: "test-keyring",
3131
},
3232
).Execute()
3333
if err != nil {
@@ -36,47 +36,47 @@ func main() {
3636
}
3737

3838
// Create a key
39-
key, err := kmsClient.CreateKey(ctx, projectId, region, *keyRing.Id).
39+
key, err := kmsClient.DefaultAPI.CreateKey(ctx, projectId, region, keyRing.Id).
4040
CreateKeyPayload(
4141
kms.CreateKeyPayload{
42-
Algorithm: kms.ALGORITHM_AES_256_GCM.Ptr(),
42+
Algorithm: kms.ALGORITHM_AES_256_GCM,
4343
Description: utils.Ptr("A test key"),
44-
DisplayName: utils.Ptr("test-key"),
45-
Purpose: kms.PURPOSE_SYMMETRIC_ENCRYPT_DECRYPT.Ptr(),
44+
DisplayName: "test-key",
45+
Purpose: kms.PURPOSE_SYMMETRIC_ENCRYPT_DECRYPT,
4646
}).Execute()
4747
if err != nil {
4848
fmt.Fprintf(os.Stderr, "[kms API] Cannot create key: %v\n", err)
4949
os.Exit(1)
5050
}
51-
fmt.Printf("[kms API] Triggered creation of key: %v\n", *key.Id)
51+
fmt.Printf("[kms API] Triggered creation of key: %v\n", key.Id)
5252

5353
// Wait for creation of key
54-
key, err = wait.CreateOrUpdateKeyWaitHandler(ctx, kmsClient, projectId, region, *key.KeyRingId, *key.Id).WaitWithContext(ctx)
54+
key, err = wait.CreateOrUpdateKeyWaitHandler(ctx, kmsClient.DefaultAPI, projectId, region, key.KeyRingId, key.Id).WaitWithContext(ctx)
5555
if err != nil {
5656
fmt.Fprintf(os.Stderr, "[kms API] Error when waiting for creation: %v\n", err)
5757
os.Exit(1)
5858
}
59-
fmt.Printf("[kms API] Created key %s\n", *key.Id)
59+
fmt.Printf("[kms API] Created key %s\n", key.Id)
6060

6161
// List key rings
62-
keyRings, err := kmsClient.ListKeyRingsExecute(ctx, projectId, region)
62+
keyRings, err := kmsClient.DefaultAPI.ListKeyRings(ctx, projectId, region).Execute()
6363
if err != nil {
6464
fmt.Fprintf(os.Stderr, "[kms API] Cannot list keyrings: %v\n", err)
6565
os.Exit(1)
6666
}
6767

6868
if keyrings := keyRings.KeyRings; keyrings != nil {
69-
fmt.Printf("[kms API] Number of keyrings: %v\n", len(*keyrings))
69+
fmt.Printf("[kms API] Number of keyrings: %v\n", len(keyrings))
7070

71-
for _, keyring := range *keyrings {
72-
keylist, err := kmsClient.ListKeysExecute(ctx, projectId, region, *keyring.Id)
71+
for _, keyring := range keyrings {
72+
keylist, err := kmsClient.DefaultAPI.ListKeys(ctx, projectId, region, keyring.Id).Execute()
7373
if err != nil {
7474
fmt.Fprintf(os.Stderr, "[kms API] Cannot list keys: %v\n", err)
7575
os.Exit(1)
7676
}
7777

7878
if keys := keylist.Keys; keys != nil {
79-
fmt.Printf("[kms API] Keys in Keyring %s: %v\n", *keyring.Id, len(*keys))
79+
fmt.Printf("[kms API] Keys in Keyring %s: %v\n", keyring.Id, len(keys))
8080
}
8181
}
8282
}

services/kms/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## v1.4.0
2+
- **Feature:** Introduction of multi API version support for the kms 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 kms v1 API
4+
- `v1betaapi`: New package which can be used for communication with the kms v1 beta 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.3.2
29
- Bump STACKIT SDK core module from `v0.21.0` to `v0.21.1`
310

services/kms/VERSION

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

0 commit comments

Comments
 (0)