Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
122d9b6
chore(logs): bump version
j1n-o9r Jun 22, 2026
ad721d5
chore(logs): substitute imports
j1n-o9r Jun 22, 2026
c68936c
chore(logs): refactor instance create
j1n-o9r Jun 22, 2026
b271cf2
chore(logs): refactor utils
j1n-o9r Jun 22, 2026
e48021a
chore(logs): refactor delete
j1n-o9r Jun 22, 2026
c3be008
chore(logs): refactor client
j1n-o9r Jun 22, 2026
3285784
chore(logs): refactor instance describe
j1n-o9r Jun 22, 2026
bec313a
chore(logs): refactor instance list
j1n-o9r Jun 22, 2026
585621a
chore(logs): refactored instance create and update and reworked Reten…
j1n-o9r Jun 22, 2026
fe2fbe3
chore(logs): refactored access token create
j1n-o9r Jun 22, 2026
7136360
chore(logs): redo using highest level testutils func
j1n-o9r Jun 22, 2026
9f9e018
chore(logs): refactor access token delete
j1n-o9r Jun 22, 2026
6278f64
chore(logs): refactor access token delete all
j1n-o9r Jun 22, 2026
210b751
chore(logs): refactor access token delete all expired
j1n-o9r Jun 22, 2026
8498340
chore(logs): refactor access token describe
j1n-o9r Jun 22, 2026
9be1693
chore(logs): refactor access token list
j1n-o9r Jun 22, 2026
242e574
chore(logs): refactor access token update
j1n-o9r Jun 22, 2026
4fcb427
chore(logs): generate docs
j1n-o9r Jun 22, 2026
10da3ea
chore(logs): remove unnecessary check
j1n-o9r Jun 22, 2026
55b1292
chore(logs): fix test
j1n-o9r Jun 22, 2026
3319100
chore(logs): remove fragment from test
j1n-o9r Jun 22, 2026
d09321e
chore(logs): rework cmpopts.EquateComparabl
j1n-o9r Jun 24, 2026
c44b722
chore(logs): copy utils func
j1n-o9r Jun 24, 2026
e89d03c
chore(logs): further improvements
j1n-o9r Jun 24, 2026
c06c694
chore(logs): further improvements
j1n-o9r Jun 24, 2026
4bcb802
chore(logs): further improvements
j1n-o9r Jun 24, 2026
1ac8572
chore(logs): fix errors
j1n-o9r Jun 24, 2026
e4881ee
chore(logs): fix errors
j1n-o9r Jun 24, 2026
c90023d
chore(logs): make acl desired type in model (like in logme syslog)
j1n-o9r Jul 6, 2026
2b70d17
chore(logs): go mod tidy
j1n-o9r Jul 22, 2026
664594b
chore(logs): remove unnecessary equate empty
j1n-o9r Jul 22, 2026
f335d15
chore(logs): align acl type with create command
j1n-o9r Jul 22, 2026
538e1c1
Merge branch 'main' into chore/STACKITCLI-367-SDK-migration-Logs
j1n-o9r Jul 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/stackit_logs_access-token_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ stackit logs access-token create [flags]
--display-name string Display name for the access token
-h, --help Help for "stackit logs access-token create"
--instance-id string ID of the Logs instance
--lifetime int Lifetime of the access token in days [1 - 180]
--lifetime int32 Lifetime of the access token in days [1 - 180]
--permissions strings Permissions of the access token ["read" "write"]
```

Expand Down
10 changes: 5 additions & 5 deletions docs/stackit_logs_instance_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ stackit logs instance create [flags]
### Options

```
--acl strings Access control list
--description string Description
--display-name string Display name
-h, --help Help for "stackit logs instance create"
--retention-days int The days for how long the logs should be stored before being cleaned up
--acl strings Access control list
--description string Description
--display-name string Display name
-h, --help Help for "stackit logs instance create"
--retention-days int32 The days for how long the logs should be stored before being cleaned up
```

### Options inherited from parent commands
Expand Down
10 changes: 5 additions & 5 deletions docs/stackit_logs_instance_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ stackit logs instance update INSTANCE_ID [flags]
### Options

```
--acl strings Access control list
--description string Description
--display-name string Display name
-h, --help Help for "stackit logs instance update"
--retention-days int The days for how long the logs should be stored before being cleaned up
--acl strings Access control list
--description string Description
--display-name string Display name
-h, --help Help for "stackit logs instance update"
--retention-days int32 The days for how long the logs should be stored before being cleaned up
```

### Options inherited from parent commands
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/stackitcloud/stackit-sdk-go/services/git v0.14.0
github.com/stackitcloud/stackit-sdk-go/services/iaas v1.13.0
github.com/stackitcloud/stackit-sdk-go/services/intake v0.7.1
github.com/stackitcloud/stackit-sdk-go/services/logs v0.5.2
github.com/stackitcloud/stackit-sdk-go/services/logs v0.10.0
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v1.12.0
github.com/stackitcloud/stackit-sdk-go/services/opensearch v1.1.0
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v1.11.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,8 @@ github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.14.0 h1:1dvL7tX9
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.14.0/go.mod h1:+Ld3dn648I+YKcBV3fEkYpDSr3fel421+LurJGywSBs=
github.com/stackitcloud/stackit-sdk-go/services/logme v1.0.1 h1:iteL61eMMPWT6872nF4Ko/tBU1IXemvS++XR09pj6NA=
github.com/stackitcloud/stackit-sdk-go/services/logme v1.0.1/go.mod h1:JDOOYaGgcBts2x52nKPRMFgSZe7qqOFmfz1xIXCQgRY=
github.com/stackitcloud/stackit-sdk-go/services/logs v0.5.2 h1:vr4atxFRT+EL+DqONMT5R44f7AzEMbePa9U7PEE0THU=
github.com/stackitcloud/stackit-sdk-go/services/logs v0.5.2/go.mod h1:CAPsiTX7osAImfrG5RnIjaJ/Iz3QpoBKuH2fS346wuQ=
github.com/stackitcloud/stackit-sdk-go/services/logs v0.10.0 h1:g7zpfQFFq3UhAWrMK9rPaZY6dLMAuMJf5g6+r7VRTXc=
github.com/stackitcloud/stackit-sdk-go/services/logs v0.10.0/go.mod h1:tvRejL8w5KpGBbLFPQ+dXOJURgZ3OMbZmwxlKQrGMuA=
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.30.0 h1:LFIH1wAp633ZAJw/7H3F4nq1DZe0Qu3rlDeXhobZEZA=
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.30.0/go.mod h1:joa89Y1dyn0j22FstRcIKfW2ada3FDxNfttxSvq27uY=
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v1.12.0 h1:SVd3WMmLAE0Jxk2SaRuM85DTOOXHycyMpZGx9vzqNkI=
Expand Down
21 changes: 11 additions & 10 deletions internal/cmd/logs/access_token/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"

"github.com/stackitcloud/stackit-sdk-go/services/logs"
logs "github.com/stackitcloud/stackit-sdk-go/services/logs/v1api"

"github.com/stackitcloud/stackit-cli/internal/pkg/args"
cliErr "github.com/stackitcloud/stackit-cli/internal/pkg/errors"
Expand Down Expand Up @@ -35,7 +35,7 @@ type inputModel struct {
InstanceId string
Description *string
DisplayName string
Lifetime *int64
Lifetime *int32
Permissions []string
}

Expand Down Expand Up @@ -80,7 +80,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
projectLabel = model.ProjectId
}

instanceLabel, err := logsUtils.GetInstanceName(ctx, apiClient, model.ProjectId, model.Region, model.InstanceId)
instanceLabel, err := logsUtils.GetInstanceName(ctx, apiClient.DefaultAPI, model.ProjectId, model.Region, model.InstanceId)
if err != nil {
params.Printer.Debug(print.ErrorLevel, "get instance name: %v", err)
instanceLabel = model.InstanceId
Expand Down Expand Up @@ -110,7 +110,7 @@ func configureFlags(cmd *cobra.Command) {
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "ID of the Logs instance")
cmd.Flags().String(displayNameFlag, "", "Display name for the access token")
cmd.Flags().String(descriptionFlag, "", "Description of the access token")
cmd.Flags().Int64(lifetimeFlag, 0, "Lifetime of the access token in days [1 - 180]")
cmd.Flags().Int32(lifetimeFlag, 0, "Lifetime of the access token in days [1 - 180]")
cmd.Flags().StringSlice(permissionsFlag, []string{}, `Permissions of the access token ["read" "write"]`)

err := flags.MarkFlagsRequired(cmd, instanceIdFlag, displayNameFlag, permissionsFlag)
Expand All @@ -128,7 +128,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, _ []string) (*inputModel,
DisplayName: flags.FlagToStringValue(p, cmd, displayNameFlag),
InstanceId: flags.FlagToStringValue(p, cmd, instanceIdFlag),
Description: flags.FlagToStringPointer(p, cmd, descriptionFlag),
Lifetime: flags.FlagToInt64Pointer(p, cmd, lifetimeFlag),
Lifetime: flags.FlagToInt32Pointer(p, cmd, lifetimeFlag),
Permissions: flags.FlagToStringSliceValue(p, cmd, permissionsFlag),
}

Expand All @@ -137,13 +137,14 @@ func parseInput(p *print.Printer, cmd *cobra.Command, _ []string) (*inputModel,
}

func buildRequest(ctx context.Context, model *inputModel, apiClient *logs.APIClient) logs.ApiCreateAccessTokenRequest {
req := apiClient.CreateAccessToken(ctx, model.ProjectId, model.Region, model.InstanceId)

req := apiClient.DefaultAPI.CreateAccessToken(ctx, model.ProjectId, model.Region, model.InstanceId)
return req.CreateAccessTokenPayload(logs.CreateAccessTokenPayload{
Description: model.Description,
DisplayName: &model.DisplayName,
DisplayName: model.DisplayName,
Lifetime: model.Lifetime,
Permissions: &model.Permissions,
Permissions: utils.Map(model.Permissions, func(t string) logs.PermissionsInner {
return logs.PermissionsInner(t)
}),
})
}

Expand All @@ -152,7 +153,7 @@ func outputResult(p *print.Printer, outputFormat, instanceLabel string, accessTo
return fmt.Errorf("access token cannot be nil")
}
return p.OutputResult(outputFormat, accessToken, func() error {
p.Outputf("Created access token for Logs instance %q.\n\nID: %s\nToken: %s\n", instanceLabel, utils.PtrValue(accessToken.Id), utils.PtrValue(accessToken.AccessToken))
p.Outputf("Created access token for Logs instance %q.\n\nID: %s\nToken: %s\n", instanceLabel, accessToken.Id, utils.PtrValue(accessToken.AccessToken))
return nil
})
}
40 changes: 20 additions & 20 deletions internal/cmd/logs/access_token/create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/google/uuid"
"github.com/stackitcloud/stackit-sdk-go/services/logs"
logs "github.com/stackitcloud/stackit-sdk-go/services/logs/v1api"
)

const (
Expand All @@ -26,7 +26,7 @@ type testCtxKey struct{}

var (
testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
testClient = &logs.APIClient{}
testClient = &logs.APIClient{DefaultAPI: &logs.DefaultAPIService{}}
testProjectId = uuid.NewString()
testInstanceId = uuid.NewString()
)
Expand Down Expand Up @@ -59,7 +59,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
InstanceId: testInstanceId,
Description: utils.Ptr(testDescription),
DisplayName: testDisplayName,
Lifetime: utils.Ptr(int64(0)),
Lifetime: utils.Ptr(int32(0)),
Permissions: []string{
"read",
"write",
Expand All @@ -72,7 +72,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
}

func fixtureRequest(mods ...func(request *logs.ApiCreateAccessTokenRequest)) logs.ApiCreateAccessTokenRequest {
request := testClient.CreateAccessToken(testCtx, testProjectId, testRegion, testInstanceId)
request := testClient.DefaultAPI.CreateAccessToken(testCtx, testProjectId, testRegion, testInstanceId)
request = request.CreateAccessTokenPayload(fixturePayload())
for _, mod := range mods {
mod(&request)
Expand All @@ -82,13 +82,13 @@ func fixtureRequest(mods ...func(request *logs.ApiCreateAccessTokenRequest)) log

func fixturePayload(mods ...func(payload *logs.CreateAccessTokenPayload)) logs.CreateAccessTokenPayload {
payload := logs.CreateAccessTokenPayload{
DisplayName: utils.Ptr(testDisplayName),
DisplayName: testDisplayName,
Description: utils.Ptr(testDescription),
Lifetime: utils.Ptr(int64(0)),
Permissions: utils.Ptr([]string{
"read",
"write",
}),
Lifetime: utils.Ptr(int32(0)),
Permissions: []logs.PermissionsInner{
logs.PERMISSIONSINNER_READ,
logs.PERMISSIONSINNER_WRITE,
},
}
for _, mod := range mods {
mod(&payload)
Expand Down Expand Up @@ -215,7 +215,7 @@ func TestBuildRequest(t *testing.T) {

diff := cmp.Diff(tt.expectedRequest, request,
cmp.AllowUnexported(tt.expectedRequest),
cmpopts.EquateComparable(testCtx),
cmpopts.EquateComparable(testCtx, logs.DefaultAPIService{}),
)
if diff != "" {
t.Fatalf("Data does not match: %s", diff)
Expand All @@ -240,16 +240,16 @@ func TestOutputResult(t *testing.T) {
args: args{
instanceLabel: "",
accessToken: utils.Ptr(logs.AccessToken{
Id: utils.Ptr(uuid.NewString()),
Permissions: utils.Ptr([]string{
"read",
"write",
}),
DisplayName: utils.Ptr("Token"),
Id: uuid.NewString(),
Permissions: []logs.PermissionsInner{
Comment thread
j1n-o9r marked this conversation as resolved.
logs.PERMISSIONSINNER_READ,
logs.PERMISSIONSINNER_WRITE,
},
DisplayName: "Token",
AccessToken: utils.Ptr("Secret access token"),
Creator: utils.Ptr(uuid.NewString()),
Expires: utils.Ptr(false),
Status: utils.Ptr(logs.ACCESSTOKENSTATUS_ACTIVE),
Creator: uuid.NewString(),
Expires: false,
Status: logs.ACCESSTOKENSTATUS_ACTIVE,
}),
},
wantErr: false,
Expand Down
6 changes: 3 additions & 3 deletions internal/cmd/logs/access_token/delete/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/stackitcloud/stackit-sdk-go/services/logs"
logs "github.com/stackitcloud/stackit-sdk-go/services/logs/v1api"

"github.com/stackitcloud/stackit-cli/internal/pkg/flags"
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
Expand Down Expand Up @@ -58,7 +58,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
}

// Get the display name for confirmation
accessTokenLabel, err := logUtils.GetAccessTokenName(ctx, apiClient, model.ProjectId, model.Region, model.InstanceId, model.AccessTokenId)
accessTokenLabel, err := logUtils.GetAccessTokenName(ctx, apiClient.DefaultAPI, model.ProjectId, model.Region, model.InstanceId, model.AccessTokenId)
if err != nil {
params.Printer.Debug(print.ErrorLevel, "get access token: %v", err)
}
Expand Down Expand Up @@ -113,5 +113,5 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
}

func buildRequest(ctx context.Context, model *inputModel, apiClient *logs.APIClient) logs.ApiDeleteAccessTokenRequest {
return apiClient.DeleteAccessToken(ctx, model.ProjectId, model.Region, model.InstanceId, model.AccessTokenId)
return apiClient.DefaultAPI.DeleteAccessToken(ctx, model.ProjectId, model.Region, model.InstanceId, model.AccessTokenId)
}
8 changes: 4 additions & 4 deletions internal/cmd/logs/access_token/delete/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/google/uuid"
"github.com/stackitcloud/stackit-sdk-go/services/logs"
logs "github.com/stackitcloud/stackit-sdk-go/services/logs/v1api"
)

const (
Expand All @@ -21,7 +21,7 @@ type testCtxKey struct{}

var (
testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
testClient = &logs.APIClient{}
testClient = &logs.APIClient{DefaultAPI: &logs.DefaultAPIService{}}

testProjectId = uuid.NewString()
testInstanceId = uuid.NewString()
Expand Down Expand Up @@ -69,7 +69,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
}

func fixtureRequest(mods ...func(request *logs.ApiDeleteAccessTokenRequest)) logs.ApiDeleteAccessTokenRequest {
request := testClient.DeleteAccessToken(testCtx, testProjectId, testRegion, testInstanceId, testAccessTokenId)
request := testClient.DefaultAPI.DeleteAccessToken(testCtx, testProjectId, testRegion, testInstanceId, testAccessTokenId)
for _, mod := range mods {
mod(&request)
}
Expand Down Expand Up @@ -197,7 +197,7 @@ func TestBuildRequest(t *testing.T) {

diff := cmp.Diff(request, tt.expectedRequest,
cmp.AllowUnexported(tt.expectedRequest),
cmpopts.EquateComparable(testCtx),
cmpopts.EquateComparable(testCtx, logs.DefaultAPIService{}),
)
if diff != "" {
t.Fatalf("Data does not match: %s", diff)
Expand Down
14 changes: 6 additions & 8 deletions internal/cmd/logs/access_token/delete_all/delete_all.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ import (
"context"
"fmt"

"github.com/stackitcloud/stackit-sdk-go/services/logs"
logs "github.com/stackitcloud/stackit-sdk-go/services/logs/v1api"

"github.com/stackitcloud/stackit-cli/internal/pkg/args"
"github.com/stackitcloud/stackit-cli/internal/pkg/flags"
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"

"github.com/stackitcloud/stackit-cli/internal/pkg/errors"
"github.com/stackitcloud/stackit-cli/internal/pkg/examples"
"github.com/stackitcloud/stackit-cli/internal/pkg/flags"
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
"github.com/stackitcloud/stackit-cli/internal/pkg/services/logs/client"
logUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/logs/utils"
"github.com/stackitcloud/stackit-cli/internal/pkg/types"

"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -55,7 +53,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
return err
}

instanceLabel, err := logUtils.GetInstanceName(ctx, apiClient, model.ProjectId, model.Region, model.InstanceId)
instanceLabel, err := logUtils.GetInstanceName(ctx, apiClient.DefaultAPI, model.ProjectId, model.Region, model.InstanceId)
if err != nil {
params.Printer.Debug(print.ErrorLevel, "get instance name: %v", err)
instanceLabel = model.InstanceId
Expand All @@ -77,7 +75,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
return fmt.Errorf("delete all access token: nil result")
}

params.Printer.Outputf("Deleted %d access token(s)\n", len(utils.PtrValue(items.Tokens)))
params.Printer.Outputf("Deleted %d access token(s)\n", len(items.Tokens))
return nil
},
}
Expand Down Expand Up @@ -108,5 +106,5 @@ func parseInput(p *print.Printer, cmd *cobra.Command, _ []string) (*inputModel,
}

func buildRequest(ctx context.Context, model *inputModel, apiClient *logs.APIClient) logs.ApiDeleteAllAccessTokensRequest {
return apiClient.DeleteAllAccessTokens(ctx, model.ProjectId, model.Region, model.InstanceId)
return apiClient.DefaultAPI.DeleteAllAccessTokens(ctx, model.ProjectId, model.Region, model.InstanceId)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/google/uuid"
"github.com/stackitcloud/stackit-sdk-go/services/logs"
logs "github.com/stackitcloud/stackit-sdk-go/services/logs/v1api"
)

const (
Expand All @@ -21,7 +21,7 @@ type testCtxKey struct{}

var (
testCtx = context.WithValue(context.Background(), testCtxKey{}, "foo")
testClient = &logs.APIClient{}
testClient = &logs.APIClient{DefaultAPI: &logs.DefaultAPIService{}}

testProjectId = uuid.NewString()
testInstanceId = uuid.NewString()
Expand Down Expand Up @@ -57,7 +57,7 @@ func fixtureInputModel(mods ...func(model *inputModel)) *inputModel {
}

func fixtureRequest(mods ...func(request *logs.ApiDeleteAllAccessTokensRequest)) logs.ApiDeleteAllAccessTokensRequest {
request := testClient.DeleteAllAccessTokens(testCtx, testProjectId, testRegion, testInstanceId)
request := testClient.DefaultAPI.DeleteAllAccessTokens(testCtx, testProjectId, testRegion, testInstanceId)
for _, mod := range mods {
mod(&request)
}
Expand Down Expand Up @@ -153,7 +153,7 @@ func TestBuildRequest(t *testing.T) {

diff := cmp.Diff(request, tt.expectedRequest,
cmp.AllowUnexported(tt.expectedRequest),
cmpopts.EquateComparable(testCtx),
cmpopts.EquateComparable(testCtx, logs.DefaultAPIService{}),
)
if diff != "" {
t.Fatalf("Data does not match: %s", diff)
Expand Down
Loading
Loading