Skip to content

Commit 741daf8

Browse files
committed
review changes
1 parent f74f28d commit 741daf8

File tree

7 files changed

+37
-37
lines changed

7 files changed

+37
-37
lines changed

docs/stackit_public-ip.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ stackit public-ip [flags]
3535
* [stackit public-ip delete](./stackit_public-ip_delete.md) - Deletes a Public IP
3636
* [stackit public-ip describe](./stackit_public-ip_describe.md) - Shows details of a Public IP
3737
* [stackit public-ip disassociate](./stackit_public-ip_disassociate.md) - Disassociates a Public IP from a network interface or a virtual IP
38-
* [stackit public-ip ip-ranges](./stackit_public-ip_ip-ranges.md) - Provides functionality for STACKIT Cloud public ip-ranges
3938
* [stackit public-ip list](./stackit_public-ip_list.md) - Lists all Public IPs of a project
39+
* [stackit public-ip ranges](./stackit_public-ip_ranges.md) - Provides functionality for STACKIT public ip-ranges
4040
* [stackit public-ip update](./stackit_public-ip_update.md) - Updates a Public IP
4141

docs/stackit_public-ip_ip-ranges.md renamed to docs/stackit_public-ip_ranges.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
## stackit public-ip ip-ranges
1+
## stackit public-ip ranges
22

3-
Provides functionality for STACKIT Cloud public ip-ranges
3+
Provides functionality for STACKIT public ip-ranges
44

55
### Synopsis
66

7-
Provides functionality for STACKIT Cloud public ip-ranges
7+
Provides functionality for STACKIT public ip-ranges
88

99
```
10-
stackit public-ip ip-ranges [flags]
10+
stackit public-ip ranges [flags]
1111
```
1212

1313
### Options
1414

1515
```
16-
-h, --help Help for "stackit public-ip ip-ranges"
16+
-h, --help Help for "stackit public-ip ranges"
1717
```
1818

1919
### Options inherited from parent commands
@@ -30,5 +30,5 @@ stackit public-ip ip-ranges [flags]
3030
### SEE ALSO
3131

3232
* [stackit public-ip](./stackit_public-ip.md) - Provides functionality for public IPs
33-
* [stackit public-ip ip-ranges list](./stackit_public-ip_ip-ranges_list.md) - Lists all STACKIT cloud public IP ranges.
33+
* [stackit public-ip ranges list](./stackit_public-ip_ranges_list.md) - Lists all STACKIT public-ip ranges
3434

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
## stackit public-ip ip-ranges list
1+
## stackit public-ip ranges list
22

3-
Lists all STACKIT cloud public IP ranges.
3+
Lists all STACKIT public-ip ranges
44

55
### Synopsis
66

7-
Lists all STACKIT cloud public IP ranges.
7+
Lists all STACKIT public-ip ranges.
88

99
```
10-
stackit public-ip ip-ranges list [flags]
10+
stackit public-ip ranges list [flags]
1111
```
1212

1313
### Examples
1414

1515
```
16-
Lists all STACKIT cloud public IP ranges
16+
Lists all STACKIT public-ip ranges
1717
$ stackit public-ip ranges list
1818
19-
Lists all STACKIT cloud public IP ranges, piping to a tool like fzf for interactive selection
20-
$ stackit public-ip ip-ranges list -o pretty | fzf
19+
Lists all STACKIT public-ip ranges, piping to a tool like fzf for interactive selection
20+
$ stackit public-ip ranges list -o pretty | fzf
2121
```
2222

2323
### Options
2424

2525
```
26-
-h, --help Help for "stackit public-ip ip-ranges list"
26+
-h, --help Help for "stackit public-ip ranges list"
2727
```
2828

2929
### Options inherited from parent commands
@@ -39,5 +39,5 @@ stackit public-ip ip-ranges list [flags]
3939

4040
### SEE ALSO
4141

42-
* [stackit public-ip ip-ranges](./stackit_public-ip_ip-ranges.md) - Provides functionality for STACKIT Cloud public ip-ranges
42+
* [stackit public-ip ranges](./stackit_public-ip_ranges.md) - Provides functionality for STACKIT public ip-ranges
4343

internal/cmd/public-ip/public-ip.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"github.com/stackitcloud/stackit-cli/internal/cmd/public-ip/delete"
88
"github.com/stackitcloud/stackit-cli/internal/cmd/public-ip/describe"
99
"github.com/stackitcloud/stackit-cli/internal/cmd/public-ip/disassociate"
10-
ipranges "github.com/stackitcloud/stackit-cli/internal/cmd/public-ip/ip-ranges"
1110
"github.com/stackitcloud/stackit-cli/internal/cmd/public-ip/list"
11+
"github.com/stackitcloud/stackit-cli/internal/cmd/public-ip/ranges"
1212
"github.com/stackitcloud/stackit-cli/internal/cmd/public-ip/update"
1313
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
1414
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
@@ -36,5 +36,5 @@ func addSubcommands(cmd *cobra.Command, params *params.CmdParams) {
3636
cmd.AddCommand(update.NewCmd(params))
3737
cmd.AddCommand(associate.NewCmd(params))
3838
cmd.AddCommand(disassociate.NewCmd(params))
39-
cmd.AddCommand(ipranges.NewCmd(params))
39+
cmd.AddCommand(ranges.NewCmd(params))
4040
}

internal/cmd/public-ip/ip-ranges/ip-ranges.go renamed to internal/cmd/public-ip/ranges/ip-ranges.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
package ipranges
1+
package ranges
22

33
import (
44
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
5-
"github.com/stackitcloud/stackit-cli/internal/cmd/public-ip/ip-ranges/list"
5+
"github.com/stackitcloud/stackit-cli/internal/cmd/public-ip/ranges/list"
66
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
77
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
88

@@ -11,9 +11,9 @@ import (
1111

1212
func NewCmd(params *params.CmdParams) *cobra.Command {
1313
cmd := &cobra.Command{
14-
Use: "ip-ranges",
15-
Short: "Provides functionality for STACKIT Cloud public ip-ranges",
16-
Long: "Provides functionality for STACKIT Cloud public ip-ranges",
14+
Use: "ranges",
15+
Short: "Provides functionality for STACKIT public ip-ranges",
16+
Long: "Provides functionality for STACKIT public ip-ranges",
1717
Args: args.NoArgs,
1818
Run: utils.CmdHelp,
1919
}

internal/cmd/public-ip/ip-ranges/list/list.go renamed to internal/cmd/public-ip/ranges/list/list.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/spf13/cobra"
1111
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
1212
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
13-
"github.com/stackitcloud/stackit-cli/internal/pkg/errors"
1413
"github.com/stackitcloud/stackit-cli/internal/pkg/examples"
1514
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1615
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
@@ -25,17 +24,17 @@ type inputModel struct {
2524
func NewCmd(params *params.CmdParams) *cobra.Command {
2625
cmd := &cobra.Command{
2726
Use: "list",
28-
Short: "Lists all STACKIT cloud public IP ranges.",
29-
Long: "Lists all STACKIT cloud public IP ranges.",
27+
Short: "Lists all STACKIT public-ip ranges",
28+
Long: "Lists all STACKIT public-ip ranges.",
3029
Args: args.NoArgs,
3130
Example: examples.Build(
3231
examples.NewExample(
33-
`Lists all STACKIT cloud public IP ranges`,
32+
`Lists all STACKIT public-ip ranges`,
3433
"$ stackit public-ip ranges list",
3534
),
3635
examples.NewExample(
37-
`Lists all STACKIT cloud public IP ranges, piping to a tool like fzf for interactive selection`,
38-
"$ stackit public-ip ip-ranges list -o pretty | fzf",
36+
`Lists all STACKIT public-ip ranges, piping to a tool like fzf for interactive selection`,
37+
"$ stackit public-ip ranges list -o pretty | fzf",
3938
),
4039
),
4140
RunE: func(cmd *cobra.Command, _ []string) error {
@@ -72,9 +71,6 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
7271

7372
func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
7473
globalFlags := globalflags.Parse(p, cmd)
75-
if globalFlags.ProjectId == "" {
76-
return nil, &errors.ProjectIdError{}
77-
}
7874

7975
model := inputModel{GlobalFlagModel: globalFlags}
8076

@@ -111,7 +107,7 @@ func outputResult(p *print.Printer, outputFormat string, networkListResponse iaa
111107
default:
112108
var publicIps []string
113109
for _, item := range *networkListResponse.Items {
114-
if item.Cidr != nil || *item.Cidr != "" {
110+
if item.Cidr != nil && *item.Cidr != "" {
115111
publicIps = append(publicIps, *item.Cidr)
116112
}
117113
}

internal/cmd/public-ip/ip-ranges/list/list_test.go renamed to internal/cmd/public-ip/ranges/list/list_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ func TestParseInput(t *testing.T) {
3434
isValid: true,
3535
},
3636
{
37-
description: "missing project id",
38-
globalFlags: map[string]string{},
39-
expectedModel: nil,
40-
isValid: false,
37+
description: "missing project id does not lead into error",
38+
globalFlags: map[string]string{},
39+
expectedModel: &inputModel{
40+
GlobalFlagModel: &globalflags.GlobalFlagModel{
41+
Verbosity: globalflags.InfoVerbosity,
42+
},
43+
},
44+
isValid: true,
4145
},
4246
}
4347

0 commit comments

Comments
 (0)