Skip to content

Commit 69a996c

Browse files
committed
examples
1 parent 90e7d09 commit 69a996c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

examples/auditlog/auditlog.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"time"
1010

1111
"github.com/stackitcloud/stackit-sdk-go/core/oapierror"
12-
"github.com/stackitcloud/stackit-sdk-go/services/auditlog"
12+
auditlog "github.com/stackitcloud/stackit-sdk-go/services/auditlog/v2api"
1313
)
1414

1515
func main() {
@@ -26,7 +26,7 @@ func main() {
2626
}
2727

2828
// List all audit logs of a project
29-
listProjectLogsReq := auditlogClient.ListProjectAuditLogEntries(context.Background(), projectId).
29+
listProjectLogsReq := auditlogClient.DefaultAPI.ListProjectAuditLogEntries(context.Background(), projectId).
3030
StartTimeRange(startTime).
3131
EndTimeRange(endTime).
3232
Limit(limit)
@@ -54,12 +54,12 @@ func main() {
5454
os.Exit(1)
5555
}
5656
// Break loop when response has no items
57-
if result == nil || result.Items == nil || len(*result.Items) == 0 {
57+
if result == nil || result.Items == nil || len(result.Items) == 0 {
5858
break
5959
}
6060

6161
// Append items to allItems
62-
allItems = append(allItems, *result.Items...)
62+
allItems = append(allItems, result.Items...)
6363

6464
// If cursor is not set, end of logs is reached
6565
if result.Cursor == nil {

examples/auditlog/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ module auditlog
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/auditlog => ../../services/auditlog
7+
58
require (
69
github.com/stackitcloud/stackit-sdk-go/core v0.21.1
710
github.com/stackitcloud/stackit-sdk-go/services/auditlog v0.1.5

0 commit comments

Comments
 (0)