Skip to content

Commit 888eaab

Browse files
Merge branch 'main' into feat/stackit-curl-add-debug-option
2 parents 648268c + 4cafb60 commit 888eaab

76 files changed

Lines changed: 534 additions & 418 deletions

File tree

Some content is hidden

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

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
uses: actions/checkout@v6
5151

5252
- name: Check GoReleaser
53-
uses: goreleaser/goreleaser-action@v7.2.1
53+
uses: goreleaser/goreleaser-action@v7.2.2
5454
with:
5555
args: check
5656

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
uses: samuelmeuli/action-snapcraft@v3
7575

7676
- name: Run GoReleaser
77-
uses: goreleaser/goreleaser-action@v7.2.1
77+
uses: goreleaser/goreleaser-action@v7.2.2
7878
with:
7979
args: release --clean
8080
env:

.github/workflows/stale.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
timeout-minutes: 10
2525
steps:
2626
- name: "Mark old PRs as stale"
27-
uses: actions/stale@v10
27+
uses: actions/stale@v10.2.0
2828
with:
2929
repo-token: ${{ secrets.GITHUB_TOKEN }}
3030
stale-pr-message: "This PR was marked as stale after ${{ env.DAYS_BEFORE_PR_STALE }} days of inactivity and will be closed after another ${{ env.DAYS_BEFORE_PR_CLOSE }} days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it."

INSTALLATION.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44

55
[![Packaging status](https://repology.org/badge/vertical-allrepos/stackit-cli.svg?columns=1)](https://repology.org/project/stackit-cli/versions)
66

7+
### Platform independent
8+
9+
#### mise
10+
11+
The STACKIT CLI is available on all major platforms via [mise](https://mise.jdx.dev/):
12+
13+
```shell
14+
mise u -g github:/stackitcloud/stackit-cli
15+
```
16+
717
### macOS
818

919
The STACKIT CLI can be installed through the [Homebrew](https://brew.sh/) package manager.

docs/stackit_beta_alb_pool_update.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ stackit beta alb pool update [flags]
1414

1515
```
1616
Update an application target pool from a configuration file (the name of the pool is read from the file)
17-
$ stackit beta alb update --configuration my-target-pool.json --name my-load-balancer
17+
$ stackit beta alb pool update --configuration my-target-pool.json --name my-load-balancer
1818
```
1919

2020
### Options
2121

2222
```
2323
-c, --configuration string Filename of the input configuration file
2424
-h, --help Help for "stackit beta alb pool update"
25-
-n, --name string Name of the target pool name to update
25+
-n, --name string Name of the application load balancer
2626
```
2727

2828
### Options inherited from parent commands

docs/stackit_security-group_list.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,25 @@ stackit security-group list [flags]
1313
### Examples
1414

1515
```
16-
List all groups
16+
Lists all security groups
1717
$ stackit security-group list
1818
19-
List groups with labels
19+
Lists security groups with labels
2020
$ stackit security-group list --label-selector label1=value1,label2=value2
21+
22+
Lists all security groups in JSON format
23+
$ stackit security-group list --output-format json
24+
25+
Lists up to 10 security groups
26+
$ stackit security-group list --limit 10
2127
```
2228

2329
### Options
2430

2531
```
2632
-h, --help Help for "stackit security-group list"
2733
--label-selector string Filter by label
34+
--limit int Maximum number of entries to list
2835
```
2936

3037
### Options inherited from parent commands

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ require (
99
github.com/google/go-cmp v0.7.0
1010
github.com/google/uuid v1.6.0
1111
github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf
12-
github.com/jedib0t/go-pretty/v6 v6.7.8
12+
github.com/jedib0t/go-pretty/v6 v6.7.10
1313
github.com/lmittmann/tint v1.1.3
1414
github.com/mattn/go-colorable v0.1.14
1515
github.com/spf13/cobra v1.10.2
1616
github.com/spf13/pflag v1.0.10
1717
github.com/spf13/viper v1.21.0
1818
github.com/stackitcloud/stackit-sdk-go/core v0.26.0
19-
github.com/stackitcloud/stackit-sdk-go/services/alb v0.10.0
19+
github.com/stackitcloud/stackit-sdk-go/services/alb v0.14.2
2020
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.12.0
2121
github.com/stackitcloud/stackit-sdk-go/services/cdn v1.10.0
2222
github.com/stackitcloud/stackit-sdk-go/services/dns v0.17.6

go.sum

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
371371
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
372372
github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf h1:FtEj8sfIcaaBfAKrE1Cwb61YDtYq9JxChK1c7AKce7s=
373373
github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf/go.mod h1:yrqSXGoD/4EKfF26AOGzscPOgTTJcyAwM2rpixWT+t4=
374-
github.com/jedib0t/go-pretty/v6 v6.7.8 h1:BVYrDy5DPBA3Qn9ICT+PokP9cvCv1KaHv2i+Hc8sr5o=
375-
github.com/jedib0t/go-pretty/v6 v6.7.8/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU=
374+
github.com/jedib0t/go-pretty/v6 v6.7.10 h1:B/2qW2Bkv2L6n14PP8o1kx75kWzHOQ3YTluWzg9icac=
375+
github.com/jedib0t/go-pretty/v6 v6.7.10/go.mod h1:YwC5CE4fJ1HFUDeivSV1r//AmANFHyqczZk+U6BDALU=
376376
github.com/jgautheron/goconst v1.8.2 h1:y0XF7X8CikZ93fSNT6WBTb/NElBu9IjaY7CCYQrCMX4=
377377
github.com/jgautheron/goconst v1.8.2/go.mod h1:A0oxgBCHy55NQn6sYpO7UdnA9p+h7cPtoOZUmvNIako=
378378
github.com/jingyugao/rowserrcheck v1.1.1 h1:zibz55j/MJtLsjP1OF4bSdgXxwL1b+Vn7Tjzq7gFzUs=
@@ -598,6 +598,8 @@ github.com/stackitcloud/stackit-sdk-go/core v0.26.0 h1:jQEb9gkehfp6VCP6TcYk7BI10
598598
github.com/stackitcloud/stackit-sdk-go/core v0.26.0/go.mod h1:WU1hhxnjXw2EV7CYa1nlEvNpMiRY6CvmIOaHuL3pOaA=
599599
github.com/stackitcloud/stackit-sdk-go/services/alb v0.10.0 h1:V9+885qkSv621rZZatg1YE5ENM1ElALxQDJsh+hDIUg=
600600
github.com/stackitcloud/stackit-sdk-go/services/alb v0.10.0/go.mod h1:V6+MolxM/M2FWyWZA+FRFKEzzUe10MU9eEVfMvxHGi8=
601+
github.com/stackitcloud/stackit-sdk-go/services/alb v0.14.2 h1:hGzfOJjlCRoFpri5eYIiwhE27qu02pKZLprKvbsTC/w=
602+
github.com/stackitcloud/stackit-sdk-go/services/alb v0.14.2/go.mod h1:eK6oRB5Tmpt6KbXQ4UYBGg2LgW5bPtVoncL9E8JSRww=
601603
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.12.0 h1:HxPgBu04j5tj6nfZ2r0l6v4VXC0/tYOGe4sA5Addra8=
602604
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.12.0/go.mod h1:uYI9pHAA2g84jJN25ejFUxa0/JtfpPZqMDkctQ1BzJk=
603605
github.com/stackitcloud/stackit-sdk-go/services/cdn v1.10.0 h1:YALzjYAApyQMKyt4C2LKhPRZHa6brmbFeKuuwl+KOTs=

internal/cmd/affinity-groups/list/list.go

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/stackitcloud/stackit-cli/internal/pkg/flags"
1919
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
2020
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
21+
"github.com/stackitcloud/stackit-cli/internal/pkg/projectname"
2122
"github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/client"
2223
)
2324

@@ -63,16 +64,19 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
6364
if err != nil {
6465
return fmt.Errorf("list affinity groups: %w", err)
6566
}
67+
items := result.GetItems()
6668

67-
if items := result.Items; items != nil {
68-
if model.Limit != nil && len(*items) > int(*model.Limit) {
69-
*items = (*items)[:*model.Limit]
70-
}
71-
return outputResult(params.Printer, *model, *items)
69+
projectLabel, err := projectname.GetProjectName(ctx, params.Printer, params.CliVersion, cmd)
70+
if err != nil {
71+
params.Printer.Debug(print.ErrorLevel, "get project name: %v", err)
72+
projectLabel = model.ProjectId
7273
}
7374

74-
params.Printer.Outputln("No affinity groups found")
75-
return nil
75+
// Truncate Output
76+
if model.Limit != nil && len(items) > int(*model.Limit) {
77+
items = items[:*model.Limit]
78+
}
79+
return outputResult(params.Printer, model.OutputFormat, projectLabel, items)
7680
},
7781
}
7882
configureFlags(cmd)
@@ -110,13 +114,12 @@ func parseInput(p *print.Printer, cmd *cobra.Command, _ []string) (*inputModel,
110114
return &model, nil
111115
}
112116

113-
func outputResult(p *print.Printer, model inputModel, items []iaas.AffinityGroup) error {
114-
var outputFormat string
115-
if model.GlobalFlagModel != nil {
116-
outputFormat = model.OutputFormat
117-
}
118-
117+
func outputResult(p *print.Printer, outputFormat, projectLabel string, items []iaas.AffinityGroup) error {
119118
return p.OutputResult(outputFormat, items, func() error {
119+
if len(items) == 0 {
120+
p.Outputf("No affinity groups found for project %q\n", projectLabel)
121+
return nil
122+
}
120123
table := tables.NewTable()
121124
table.SetHeader("ID", "NAME", "POLICY")
122125
for _, item := range items {

internal/cmd/affinity-groups/list/list_test.go

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,23 +141,40 @@ func TestBuildRequest(t *testing.T) {
141141
}
142142

143143
func TestOutputResult(t *testing.T) {
144+
type args struct {
145+
outputFormat string
146+
projectLabel string
147+
instances []iaas.AffinityGroup
148+
}
144149
tests := []struct {
145150
description string
146-
model inputModel
147-
response []iaas.AffinityGroup
151+
args args
148152
isValid bool
149153
}{
150154
{
151155
description: "empty",
152-
model: inputModel{},
153-
response: []iaas.AffinityGroup{},
156+
args: args{},
154157
isValid: true,
155158
},
159+
{
160+
description: "empty slice",
161+
args: args{
162+
instances: []iaas.AffinityGroup{},
163+
},
164+
isValid: true,
165+
},
166+
{
167+
description: "empty affinity group in slice",
168+
args: args{
169+
instances: []iaas.AffinityGroup{{}},
170+
},
171+
isValid: true,
172+
},
156173
}
157174
params := testparams.NewTestParams()
158175
for _, tt := range tests {
159176
t.Run(tt.description, func(t *testing.T) {
160-
err := outputResult(params.Printer, tt.model, tt.response)
177+
err := outputResult(params.Printer, tt.args.outputFormat, tt.args.projectLabel, tt.args.instances)
161178
if err != nil {
162179
if !tt.isValid {
163180
return

0 commit comments

Comments
 (0)