mygithub.libinneed.workers.dev/stackitcloud/stackit-cli
Advanced tools
@@ -97,3 +97,3 @@ # STACKIT CLI release workflow. | ||
| - name: Download artifacts from workflow | ||
| uses: actions/download-artifact@v4 | ||
| uses: actions/download-artifact@v5 | ||
| with: | ||
@@ -100,0 +100,0 @@ name: goreleaser-dist-temp |
@@ -16,5 +16,5 @@ name: Renovate | ||
| - name: Self-hosted Renovate | ||
| uses: renovatebot/github-action@v43.0.10 | ||
| uses: renovatebot/github-action@v43.0.11 | ||
| with: | ||
| configurationFile: .github/renovate.json | ||
| token: ${{ secrets.RENOVATE_TOKEN }} |
+9
-12
@@ -51,21 +51,18 @@ version: 2 | ||
| # Completion files | ||
| - cmd: mkdir -p dist/macos-builds_{{.Target}}/completions | ||
| - cmd: sh -c './dist/macos-builds_{{.Target}}/{{.Name}} completion zsh > ./dist/macos-builds_{{.Target}}/completions/stackit.zsh' | ||
| - cmd: sh -c './dist/macos-builds_{{.Target}}/{{.Name}} completion bash > ./dist/macos-builds_{{.Target}}/completions/stackit.bash' | ||
| - cmd: sh -c './dist/macos-builds_{{.Target}}/{{.Name}} completion fish > ./dist/macos-builds_{{.Target}}/completions/stackit.fish' | ||
| - cmd: mkdir -p dist/completions | ||
| - cmd: sh -c 'go run main.go completion zsh > ./dist/completions/stackit.zsh' | ||
| - cmd: sh -c 'go run main.go completion bash > ./dist/completions/stackit.bash' | ||
| - cmd: sh -c 'go run main.go completion fish > ./dist/completions/stackit.fish' | ||
| archives: | ||
| - id: windows-archives | ||
| ids: | ||
| - windows-builds | ||
| formats: [ 'zip' ] | ||
| - ids: | ||
| - linux-builds | ||
| - windows-builds | ||
| formats: [ 'tar.gz' ] | ||
| format_overrides: | ||
| - goos: windows | ||
| formats: [ 'zip' ] | ||
| - id: macos-archives | ||
| ids: | ||
| - macos-builds | ||
| formats: [ 'tar.gz' ] | ||
| files: | ||
| - src: ./dist/macos-builds_{{.Target}}/completions/* | ||
| - src: ./dist/completions/* | ||
| dst: completions | ||
@@ -72,0 +69,0 @@ - LICENSE.md |
+4
-0
@@ -62,2 +62,6 @@ # Contribute to the STACKIT CLI | ||
| You may also have to register the `bar` command as a new sub-command: | ||
| https://github.com/stackitcloud/stackit-cli/blob/a5438f4cac3a794cb95d04891a83252aa9ae1f1e/internal/cmd/root.go#L162-L195 | ||
| #### Outputs, prints and debug logs | ||
@@ -64,0 +68,0 @@ |
+13
-12
@@ -17,3 +17,3 @@ module github.com/stackitcloud/stackit-cli | ||
| github.com/spf13/pflag v1.0.10 | ||
| github.com/spf13/viper v1.20.1 | ||
| github.com/spf13/viper v1.21.0 | ||
| github.com/stackitcloud/stackit-sdk-go/core v0.17.3 | ||
@@ -33,5 +33,5 @@ github.com/stackitcloud/stackit-sdk-go/services/alb v0.6.1 | ||
| github.com/stackitcloud/stackit-sdk-go/services/serverupdate v1.2.1 | ||
| github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.11.0 | ||
| github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.11.1 | ||
| github.com/stackitcloud/stackit-sdk-go/services/serviceenablement v1.2.2 | ||
| github.com/stackitcloud/stackit-sdk-go/services/ske v1.3.0 | ||
| github.com/stackitcloud/stackit-sdk-go/services/ske v1.4.0 | ||
| github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.3.1 | ||
@@ -107,3 +107,3 @@ github.com/zalando/go-keyring v0.2.6 | ||
| github.com/go-toolsmith/typep v1.1.0 // indirect | ||
| github.com/go-viper/mapstructure/v2 v2.2.1 // indirect | ||
| github.com/go-viper/mapstructure/v2 v2.4.0 // indirect | ||
| github.com/go-xmlfmt/xmlfmt v1.1.3 // indirect | ||
@@ -189,3 +189,3 @@ github.com/gobwas/glob v0.2.3 // indirect | ||
| github.com/stretchr/objx v0.5.2 // indirect | ||
| github.com/stretchr/testify v1.10.0 // indirect | ||
| github.com/stretchr/testify v1.11.1 // indirect | ||
| github.com/tdakkota/asciicheck v0.4.1 // indirect | ||
@@ -212,2 +212,3 @@ github.com/tetafro/godot v1.5.1 // indirect | ||
| go.uber.org/zap v1.24.0 // indirect | ||
| go.yaml.in/yaml/v3 v3.0.4 // indirect | ||
| golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac // indirect | ||
@@ -229,3 +230,3 @@ golang.org/x/sync v0.16.0 // indirect | ||
| github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect | ||
| github.com/fsnotify/fsnotify v1.8.0 // indirect | ||
| github.com/fsnotify/fsnotify v1.9.0 // indirect | ||
| github.com/go-logr/logr v1.4.2 // indirect | ||
@@ -243,11 +244,11 @@ github.com/godbus/dbus/v5 v5.1.0 // indirect | ||
| github.com/russross/blackfriday/v2 v2.1.0 // indirect | ||
| github.com/sagikazarmark/locafero v0.7.0 // indirect | ||
| github.com/sourcegraph/conc v0.3.0 // indirect | ||
| github.com/spf13/afero v1.14.0 // indirect | ||
| github.com/spf13/cast v1.7.1 // indirect | ||
| github.com/sagikazarmark/locafero v0.11.0 // indirect | ||
| github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect | ||
| github.com/spf13/afero v1.15.0 // indirect | ||
| github.com/spf13/cast v1.10.0 // indirect | ||
| github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v1.5.1 | ||
| github.com/stackitcloud/stackit-sdk-go/services/logme v0.25.1 | ||
| github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.25.1 | ||
| github.com/stackitcloud/stackit-sdk-go/services/objectstorage v1.3.1 | ||
| github.com/stackitcloud/stackit-sdk-go/services/observability v0.13.0 | ||
| github.com/stackitcloud/stackit-sdk-go/services/objectstorage v1.4.0 | ||
| github.com/stackitcloud/stackit-sdk-go/services/observability v0.14.0 | ||
| github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.25.1 | ||
@@ -254,0 +255,0 @@ github.com/stackitcloud/stackit-sdk-go/services/redis v0.25.1 |
@@ -165,4 +165,4 @@ package create | ||
| expireDate := "Never" | ||
| if resp.Expires != nil && *resp.Expires != "" { | ||
| expireDate = *resp.Expires | ||
| if resp.Expires != nil && resp.Expires.IsSet() && *resp.Expires.Get() != "" { | ||
| expireDate = *resp.Expires.Get() | ||
| } | ||
@@ -169,0 +169,0 @@ |
@@ -241,3 +241,3 @@ package list | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| if err := outputResult(p, tt.args.outputFormat, tt.args.credentials); (err != nil) != tt.wantErr { | ||
| if err := outputResult(p, tt.args.outputFormat, "dummy-instance-label", tt.args.credentials); (err != nil) != tt.wantErr { | ||
| t.Errorf("outputResult() error = %v, wantErr %v", err, tt.wantErr) | ||
@@ -244,0 +244,0 @@ } |
@@ -72,17 +72,17 @@ package list | ||
| credentials := *resp.CredentialsList | ||
| // Truncate output | ||
| if model.Limit != nil && len(credentials) > int(*model.Limit) { | ||
| credentials = credentials[:*model.Limit] | ||
| } | ||
| instanceLabel := model.InstanceId | ||
| if len(credentials) == 0 { | ||
| instanceLabel, err := redisUtils.GetInstanceName(ctx, apiClient, model.ProjectId, model.InstanceId) | ||
| instanceLabel, err = redisUtils.GetInstanceName(ctx, apiClient, model.ProjectId, model.InstanceId) | ||
| if err != nil { | ||
| params.Printer.Debug(print.ErrorLevel, "get instance name: %v", err) | ||
| instanceLabel = model.InstanceId | ||
| } | ||
| params.Printer.Info("No credentials found for instance %q\n", instanceLabel) | ||
| return nil | ||
| } | ||
| // Truncate output | ||
| if model.Limit != nil && len(credentials) > int(*model.Limit) { | ||
| credentials = credentials[:*model.Limit] | ||
| } | ||
| return outputResult(params.Printer, model.OutputFormat, credentials) | ||
| return outputResult(params.Printer, model.OutputFormat, instanceLabel, credentials) | ||
| }, | ||
@@ -139,3 +139,3 @@ } | ||
| func outputResult(p *print.Printer, outputFormat string, credentials []redis.CredentialsListItem) error { | ||
| func outputResult(p *print.Printer, outputFormat, instanceLabel string, credentials []redis.CredentialsListItem) error { | ||
| switch outputFormat { | ||
@@ -159,2 +159,7 @@ case print.JSONOutputFormat: | ||
| default: | ||
| if len(credentials) == 0 { | ||
| p.Outputf("No credentials found for instance %q\n", instanceLabel) | ||
| return nil | ||
| } | ||
| table := tables.NewTable() | ||
@@ -161,0 +166,0 @@ table.SetHeader("ID") |
@@ -219,3 +219,3 @@ package list | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| if err := outputResult(p, tt.args.outputFormat, tt.args.instances); (err != nil) != tt.wantErr { | ||
| if err := outputResult(p, tt.args.outputFormat, "dummy-project-label", tt.args.instances); (err != nil) != tt.wantErr { | ||
| t.Errorf("outputResult() error = %v, wantErr %v", err, tt.wantErr) | ||
@@ -222,0 +222,0 @@ } |
@@ -70,18 +70,17 @@ package list | ||
| instances := *resp.Instances | ||
| // Truncate output | ||
| if model.Limit != nil && len(instances) > int(*model.Limit) { | ||
| instances = instances[:*model.Limit] | ||
| } | ||
| projectLabel := model.ProjectId | ||
| if len(instances) == 0 { | ||
| projectLabel, err := projectname.GetProjectName(ctx, params.Printer, params.CliVersion, cmd) | ||
| projectLabel, err = projectname.GetProjectName(ctx, params.Printer, params.CliVersion, cmd) | ||
| if err != nil { | ||
| params.Printer.Debug(print.ErrorLevel, "get project name: %v", err) | ||
| projectLabel = model.ProjectId | ||
| } | ||
| params.Printer.Info("No instances found for project %q\n", projectLabel) | ||
| return nil | ||
| } | ||
| // Truncate output | ||
| if model.Limit != nil && len(instances) > int(*model.Limit) { | ||
| instances = instances[:*model.Limit] | ||
| } | ||
| return outputResult(params.Printer, model.OutputFormat, instances) | ||
| return outputResult(params.Printer, model.OutputFormat, projectLabel, instances) | ||
| }, | ||
@@ -134,3 +133,3 @@ } | ||
| func outputResult(p *print.Printer, outputFormat string, instances []redis.Instance) error { | ||
| func outputResult(p *print.Printer, outputFormat, projectLabel string, instances []redis.Instance) error { | ||
| switch outputFormat { | ||
@@ -154,2 +153,7 @@ case print.JSONOutputFormat: | ||
| default: | ||
| if len(instances) == 0 { | ||
| p.Outputf("No instances found for project %q\n", projectLabel) | ||
| return nil | ||
| } | ||
| table := tables.NewTable() | ||
@@ -156,0 +160,0 @@ table.SetHeader("ID", "NAME", "LAST OPERATION TYPE", "LAST OPERATION STATE") |
Sorry, the diff of this file is too big to display