Skip to content

Commit 7aa7243

Browse files
feat(logs): add multi API version support (#5149)
relates to STACKITSDK-341 Co-authored-by: Ruben Hoenle <Ruben.Hoenle@stackit.cloud>
1 parent 1404604 commit 7aa7243

File tree

67 files changed

+17275
-46
lines changed

Some content is hidden

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

67 files changed

+17275
-46
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
- **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.
1515
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
1616
- **Breaking Change:** Removal of deprecated constants `ActiveState` and `CreatingState` in `wait` package
17+
- `logs`: [v0.6.0](services/logs/CHANGELOG.md#v060)
18+
- **Feature:** Introduction of multi API version support for the logs SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062
19+
- `v1alphaapi`: New package which can be used for communication with the logs v1 alpha API
20+
- `v1betaapi`: New package which can be used for communication with the logs v1 beta API
21+
- `v1api`: New package which can be used for communication with the logs v1 API
22+
- **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.
23+
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
1724

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

examples/logs/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/logs
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/logs => ../../services/logs
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/logs v0.5.2
811
)
912

examples/logs/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/logs v0.5.2 h1:vr4atxFRT+EL+DqONMT5R44f7AzEMbePa9U7PEE0THU=
10-
github.com/stackitcloud/stackit-sdk-go/services/logs v0.5.2/go.mod h1:CAPsiTX7osAImfrG5RnIjaJ/Iz3QpoBKuH2fS346wuQ=
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/logs/logs.go

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"log"
66

77
"github.com/stackitcloud/stackit-sdk-go/core/utils"
8-
"github.com/stackitcloud/stackit-sdk-go/services/logs"
8+
logs "github.com/stackitcloud/stackit-sdk-go/services/logs/v1api"
99
)
1010

1111
func main() {
@@ -22,60 +22,59 @@ func main() {
2222
// Create a Logs Instance
2323
var createdInstance string
2424
createInstancePayload := logs.CreateLogsInstancePayload{
25-
DisplayName: utils.Ptr("my-logs-instance"),
26-
RetentionDays: utils.Ptr(int64(1)),
25+
DisplayName: "my-logs-instance",
26+
RetentionDays: int32(1),
2727
}
28-
createResp, err := client.CreateLogsInstance(ctx, projectId, regionId).
28+
createResp, err := client.DefaultAPI.CreateLogsInstance(ctx, projectId, regionId).
2929
CreateLogsInstancePayload(createInstancePayload).
3030
Execute()
3131
if err != nil {
3232
log.Fatalf("[Logs API] Error when calling `CreateLogsInstance`: %v\n", err)
3333
}
34-
createdInstance = *createResp.Id
35-
log.Printf("[Logs API] Created Logs Instance with ID \"%s\".\n", createdInstance)
34+
log.Printf("[Logs API] Created Logs Instance with ID \"%s\".\n", createResp.Id)
3635

3736
// List Logs Instances
38-
listResp, err := client.ListLogsInstances(ctx, projectId, regionId).Execute()
37+
listResp, err := client.DefaultAPI.ListLogsInstances(ctx, projectId, regionId).Execute()
3938
if err != nil {
4039
log.Fatalf("[Logs API] Error when calling `ListLogsInstances`: %v\n", err)
4140
}
42-
log.Printf("[Logs API] Retrieved %d Logs Instances.\n", len(*listResp.Instances))
41+
log.Printf("[Logs API] Retrieved %d Logs Instances.\n", len(listResp.Instances))
4342

4443
// Get the created Logs Instance
45-
getResp, err := client.GetLogsInstance(ctx, projectId, regionId, createdInstance).Execute()
44+
getResp, err := client.DefaultAPI.GetLogsInstance(ctx, projectId, regionId, createdInstance).Execute()
4645
if err != nil {
4746
log.Fatalf("[Logs API] Error when calling `GetLogsInstance`: %v\n", err)
4847
}
49-
log.Printf("[Logs API] Retrieved Logs Instance with ID \"%s\" and Display Name \"%s\".\n", *getResp.Id, *getResp.DisplayName)
48+
log.Printf("[Logs API] Retrieved Logs Instance with ID \"%s\" and Display Name \"%s\".\n", getResp.Id, getResp.DisplayName)
5049

5150
// Update the created Logs Instance
5251
updatePayload := logs.UpdateLogsInstancePayload{
5352
DisplayName: utils.Ptr("my-updated-logs-instance"),
54-
RetentionDays: utils.Ptr(int64(7)),
53+
RetentionDays: utils.Ptr(int32(7)),
5554
}
56-
updateResp, err := client.UpdateLogsInstance(ctx, projectId, regionId, createdInstance).
55+
updateResp, err := client.DefaultAPI.UpdateLogsInstance(ctx, projectId, regionId, createdInstance).
5756
UpdateLogsInstancePayload(updatePayload).
5857
Execute()
5958
if err != nil {
6059
log.Fatalf("[Logs API] Error when calling `UpdateLogsInstance`: %v\n", err)
6160
}
62-
log.Printf("[Logs API] Updated Logs Instance with ID \"%s\" to Display Name \"%s\".\n", *updateResp.Id, *updateResp.DisplayName)
61+
log.Printf("[Logs API] Updated Logs Instance with ID \"%s\" to Display Name \"%s\".\n", updateResp.Id, updateResp.DisplayName)
6362

6463
// Create an Access Token
6564
createTokenPayload := logs.CreateAccessTokenPayload{
66-
DisplayName: utils.Ptr("my-access-token"),
67-
Permissions: &[]string{"read"},
65+
DisplayName: "my-access-token",
66+
Permissions: []string{"read"},
6867
}
69-
createTokenResp, err := client.CreateAccessToken(ctx, projectId, regionId, createdInstance).
68+
createTokenResp, err := client.DefaultAPI.CreateAccessToken(ctx, projectId, regionId, createdInstance).
7069
CreateAccessTokenPayload(createTokenPayload).
7170
Execute()
7271
if err != nil {
7372
log.Fatalf("[Logs API] Error when calling `CreateAccessToken`: %v\n", err)
7473
}
75-
log.Printf("[Logs API] Created Access Token with ID \"%s\".\n", *createTokenResp.Id)
74+
log.Printf("[Logs API] Created Access Token with ID \"%s\".\n", createTokenResp.Id)
7675

7776
// Add Access Token to Logs Instance
78-
err = client.UpdateAccessToken(ctx, projectId, regionId, createdInstance, *createTokenResp.Id).
77+
err = client.DefaultAPI.UpdateAccessToken(ctx, projectId, regionId, createdInstance, createTokenResp.Id).
7978
// needs at least an empty payload
8079
UpdateAccessTokenPayload(logs.UpdateAccessTokenPayload{}).
8180
Execute()
@@ -84,14 +83,14 @@ func main() {
8483
}
8584

8685
// Delete all Access Tokens from Logs Instance
87-
tokenList, err := client.DeleteAllAccessTokens(ctx, projectId, regionId, createdInstance).Execute()
86+
tokenList, err := client.DefaultAPI.DeleteAllAccessTokens(ctx, projectId, regionId, createdInstance).Execute()
8887
if err != nil {
8988
log.Fatalf("[Logs API] Error when calling `DeleteAllAccessTokens`: %v\n", err)
9089
}
91-
log.Printf("[Logs API] Deleted %d Access Tokens from Logs Instance with ID \"%s\".\n", len(*tokenList.Tokens), createdInstance)
90+
log.Printf("[Logs API] Deleted %d Access Tokens from Logs Instance with ID \"%s\".\n", len(tokenList.Tokens), createdInstance)
9291

9392
// Delete the created Logs Instance
94-
err = client.DeleteLogsInstance(ctx, projectId, regionId, createdInstance).Execute()
93+
err = client.DefaultAPI.DeleteLogsInstance(ctx, projectId, regionId, createdInstance).Execute()
9594
if err != nil {
9695
log.Fatalf("[Logs API] Error when calling `DeleteLogsInstance`: %v\n", err)
9796
}

services/logs/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## v0.6.0
2+
- **Feature:** Introduction of multi API version support for the logs SDK module. For more details please see the announcement on GitHub: https://github.com/stackitcloud/stackit-sdk-go/discussions/5062
3+
- `v1alphaapi`: New package which can be used for communication with the logs v1 alpha API
4+
- `v1betaapi`: New package which can be used for communication with the logs v1 beta API
5+
- `v1api`: New package which can be used for communication with the logs v1 API
6+
- **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.
7+
- **Dependencies:** Bump STACKIT SDK core module from `v0.21.1` to `v0.22.0`
8+
19
## v0.5.2
210
- Bump STACKIT SDK core module from `v0.21.0` to `v0.21.1`
311

services/logs/VERSION

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

0 commit comments

Comments
 (0)