Skip to content

Commit 1373b54

Browse files
committed
fix rebase
1 parent bbb6b78 commit 1373b54

File tree

20 files changed

+61
-121
lines changed

20 files changed

+61
-121
lines changed

internal/cmd/routingtable/create/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import (
66
"strings"
77

88
"github.com/spf13/cobra"
9-
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
109
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
1110
"github.com/stackitcloud/stackit-cli/internal/pkg/examples"
1211
"github.com/stackitcloud/stackit-cli/internal/pkg/flags"
1312
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1413
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
1514
"github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/client"
1615
"github.com/stackitcloud/stackit-cli/internal/pkg/tables"
16+
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
1717
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1818
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
1919
)
@@ -39,7 +39,7 @@ type inputModel struct {
3939
OrganizationId string
4040
}
4141

42-
func NewCmd(params *params.CmdParams) *cobra.Command {
42+
func NewCmd(params *types.CmdParams) *cobra.Command {
4343
cmd := &cobra.Command{
4444
Use: "create",
4545
Short: "Creates a routing-table",

internal/cmd/routingtable/create/create_test.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99
"github.com/google/go-cmp/cmp"
1010
"github.com/google/go-cmp/cmp/cmpopts"
1111
"github.com/google/uuid"
12-
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
1312
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1413
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
1514
"github.com/stackitcloud/stackit-cli/internal/pkg/testutils"
15+
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
1616
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1717
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
1818
)
@@ -124,7 +124,7 @@ func TestParseInput(t *testing.T) {
124124
expectedModel: fixtureInputModel(),
125125
},
126126
{
127-
description: "dynamic_routes disabled",
127+
description: "dynamic routes disabled",
128128
flagValues: fixtureFlagValues(func(flagValues map[string]string) {
129129
flagValues[nonDynamicRoutesFlag] = "true"
130130
}),
@@ -314,18 +314,12 @@ func TestOutputResult(t *testing.T) {
314314
},
315315
{
316316
name: "empty routing-table",
317-
outputFormat: "",
317+
outputFormat: print.PrettyOutputFormat,
318318
routingTable: &iaas.RoutingTable{},
319319
wantErr: true,
320320
},
321321
{
322-
name: "default output routing-table",
323-
outputFormat: "",
324-
routingTable: &dummyRoutingTable,
325-
wantErr: false,
326-
},
327-
{
328-
name: "table output routing-table",
322+
name: "pretty output routing-table",
329323
outputFormat: print.PrettyOutputFormat,
330324
routingTable: &dummyRoutingTable,
331325
wantErr: false,
@@ -345,7 +339,7 @@ func TestOutputResult(t *testing.T) {
345339
}
346340

347341
p := print.NewPrinter()
348-
p.Cmd = NewCmd(&params.CmdParams{Printer: p})
342+
p.Cmd = NewCmd(&types.CmdParams{Printer: p})
349343
for _, tt := range tests {
350344
t.Run(tt.name, func(t *testing.T) {
351345
if err := outputResult(p, tt.outputFormat, tt.routingTable); (err != nil) != tt.wantErr {

internal/cmd/routingtable/delete/delete.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import (
55
"fmt"
66

77
"github.com/spf13/cobra"
8-
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
98
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
109
"github.com/stackitcloud/stackit-cli/internal/pkg/examples"
1110
"github.com/stackitcloud/stackit-cli/internal/pkg/flags"
1211
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1312
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
1413
"github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/client"
14+
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
1515
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1616
)
1717

@@ -28,7 +28,7 @@ type inputModel struct {
2828
RoutingTableId string
2929
}
3030

31-
func NewCmd(params *params.CmdParams) *cobra.Command {
31+
func NewCmd(params *types.CmdParams) *cobra.Command {
3232
cmd := &cobra.Command{
3333
Use: fmt.Sprintf("delete %s", routingTableIdArg),
3434
Short: "Deletes a routing-table",

internal/cmd/routingtable/describe/describe.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import (
66
"strings"
77

88
"github.com/spf13/cobra"
9-
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
109
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
1110
"github.com/stackitcloud/stackit-cli/internal/pkg/examples"
1211
"github.com/stackitcloud/stackit-cli/internal/pkg/flags"
1312
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1413
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
1514
"github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/client"
1615
"github.com/stackitcloud/stackit-cli/internal/pkg/tables"
16+
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
1717
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1818
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
1919
)
@@ -31,7 +31,7 @@ type inputModel struct {
3131
RoutingTableId string
3232
}
3333

34-
func NewCmd(params *params.CmdParams) *cobra.Command {
34+
func NewCmd(params *types.CmdParams) *cobra.Command {
3535
cmd := &cobra.Command{
3636
Use: fmt.Sprintf("describe %s", routingTableIdArg),
3737
Short: "Describes a routing-table",

internal/cmd/routingtable/describe/describe_test.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import (
55
"time"
66

77
"github.com/google/uuid"
8-
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
98
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
109
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
1110
"github.com/stackitcloud/stackit-cli/internal/pkg/testutils"
11+
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
1212
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1313
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
1414
)
@@ -186,8 +186,8 @@ func TestOutputResult(t *testing.T) {
186186
wantErr: true,
187187
},
188188
{
189-
name: "default empty routing table",
190-
outputFormat: "",
189+
name: "empty routing table",
190+
outputFormat: print.PrettyOutputFormat,
191191
routingTable: &iaas.RoutingTable{},
192192
wantErr: false,
193193
},
@@ -197,12 +197,6 @@ func TestOutputResult(t *testing.T) {
197197
routingTable: &iaas.RoutingTable{},
198198
wantErr: false,
199199
},
200-
{
201-
name: "default output one route",
202-
outputFormat: "",
203-
routingTable: &dummyRouteTable,
204-
wantErr: false,
205-
},
206200
{
207201
name: "pretty output one route",
208202
outputFormat: print.PrettyOutputFormat,
@@ -224,7 +218,7 @@ func TestOutputResult(t *testing.T) {
224218
}
225219

226220
p := print.NewPrinter()
227-
p.Cmd = NewCmd(&params.CmdParams{Printer: p})
221+
p.Cmd = NewCmd(&types.CmdParams{Printer: p})
228222
for _, tt := range tests {
229223
t.Run(tt.name, func(t *testing.T) {
230224
if err := outputResult(p, tt.outputFormat, tt.routingTable); (err != nil) != tt.wantErr {

internal/cmd/routingtable/list/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"strings"
77

88
"github.com/spf13/cobra"
9-
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
109
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
1110
"github.com/stackitcloud/stackit-cli/internal/pkg/errors"
1211
"github.com/stackitcloud/stackit-cli/internal/pkg/examples"
@@ -17,6 +16,7 @@ import (
1716
rmClient "github.com/stackitcloud/stackit-cli/internal/pkg/services/resourcemanager/client"
1817
rmUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/resourcemanager/utils"
1918
"github.com/stackitcloud/stackit-cli/internal/pkg/tables"
19+
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
2020
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
2121
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
2222
)
@@ -36,7 +36,7 @@ type inputModel struct {
3636
OrganizationId string
3737
}
3838

39-
func NewCmd(params *params.CmdParams) *cobra.Command {
39+
func NewCmd(params *types.CmdParams) *cobra.Command {
4040
cmd := &cobra.Command{
4141
Use: "list",
4242
Short: "Lists all routing-tables",

internal/cmd/routingtable/list/list_test.go

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import (
66
"time"
77

88
"github.com/google/uuid"
9-
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
109
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1110
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
1211
"github.com/stackitcloud/stackit-cli/internal/pkg/testutils"
12+
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
1313
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1414
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
1515
)
@@ -161,8 +161,8 @@ func TestOutputResult(t *testing.T) {
161161
wantErr: true,
162162
},
163163
{
164-
name: "default empty routing table",
165-
outputFormat: "",
164+
name: "pretty empty routing table",
165+
outputFormat: print.PrettyOutputFormat,
166166
routingTable: []iaas.RoutingTable{},
167167
wantErr: false,
168168
},
@@ -179,8 +179,8 @@ func TestOutputResult(t *testing.T) {
179179
wantErr: false,
180180
},
181181
{
182-
name: "default empty routing table in slice",
183-
outputFormat: "",
182+
name: "pretty empty routing table in slice",
183+
outputFormat: print.PrettyOutputFormat,
184184
routingTable: []iaas.RoutingTable{{}},
185185
wantErr: false,
186186
},
@@ -190,18 +190,6 @@ func TestOutputResult(t *testing.T) {
190190
routingTable: []iaas.RoutingTable{{}},
191191
wantErr: false,
192192
},
193-
{
194-
name: "default output with one route",
195-
outputFormat: "",
196-
routingTable: []iaas.RoutingTable{dummyRouteTable},
197-
wantErr: false,
198-
},
199-
{
200-
name: "default output with multiple routes",
201-
outputFormat: "",
202-
routingTable: []iaas.RoutingTable{dummyRouteTable, dummyRouteTable, dummyRouteTable},
203-
wantErr: false,
204-
},
205193
{
206194
name: "pretty output with one route",
207195
outputFormat: print.PrettyOutputFormat,
@@ -229,7 +217,7 @@ func TestOutputResult(t *testing.T) {
229217
}
230218

231219
p := print.NewPrinter()
232-
p.Cmd = NewCmd(&params.CmdParams{Printer: p})
220+
p.Cmd = NewCmd(&types.CmdParams{Printer: p})
233221
for _, tt := range tests {
234222
t.Run(tt.name, func(t *testing.T) {
235223
if err := outputResult(p, tt.outputFormat, tt.routingTable); (err != nil) != tt.wantErr {

internal/cmd/routingtable/route/create/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"strings"
88

99
"github.com/spf13/cobra"
10-
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
1110
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
1211
"github.com/stackitcloud/stackit-cli/internal/pkg/examples"
1312
"github.com/stackitcloud/stackit-cli/internal/pkg/flags"
@@ -16,6 +15,7 @@ import (
1615
"github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/client"
1716
routeUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/routing-table/utils"
1817
"github.com/stackitcloud/stackit-cli/internal/pkg/tables"
18+
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
1919
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
2020
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
2121
)
@@ -43,7 +43,7 @@ type inputModel struct {
4343
RoutingTableId string
4444
}
4545

46-
func NewCmd(params *params.CmdParams) *cobra.Command {
46+
func NewCmd(params *types.CmdParams) *cobra.Command {
4747
cmd := &cobra.Command{
4848
Use: "create",
4949
Short: "Creates a route in a routing-table",

internal/cmd/routingtable/route/create/create_test.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import (
88
"github.com/google/go-cmp/cmp"
99
"github.com/google/go-cmp/cmp/cmpopts"
1010
"github.com/google/uuid"
11-
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
1211
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1312
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
1413
"github.com/stackitcloud/stackit-cli/internal/pkg/testutils"
14+
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
1515
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1616
"github.com/stackitcloud/stackit-sdk-go/services/iaas"
1717
)
@@ -653,22 +653,16 @@ func TestOutputResult(t *testing.T) {
653653
},
654654
{
655655
name: "empty routes list",
656-
outputFormat: "",
656+
outputFormat: print.PrettyOutputFormat,
657657
routes: []iaas.Route{},
658658
wantErr: true,
659659
},
660660
{
661-
name: "Route list with empty struct",
662-
outputFormat: "",
661+
name: "route list with empty struct",
662+
outputFormat: print.PrettyOutputFormat,
663663
routes: []iaas.Route{{}},
664664
wantErr: false,
665665
},
666-
{
667-
name: "default output with one route",
668-
outputFormat: "",
669-
routes: []iaas.Route{dummyRoute},
670-
wantErr: false,
671-
},
672666
{
673667
name: "pretty output with one route",
674668
outputFormat: print.PrettyOutputFormat,
@@ -696,7 +690,7 @@ func TestOutputResult(t *testing.T) {
696690
}
697691

698692
p := print.NewPrinter()
699-
p.Cmd = NewCmd(&params.CmdParams{Printer: p})
693+
p.Cmd = NewCmd(&types.CmdParams{Printer: p})
700694
for _, tt := range tests {
701695
t.Run(tt.name, func(t *testing.T) {
702696
if err := outputResult(p, tt.outputFormat, tt.routes); (err != nil) != tt.wantErr {

internal/cmd/routingtable/route/delete/delete.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import (
55
"fmt"
66

77
"github.com/spf13/cobra"
8-
"github.com/stackitcloud/stackit-cli/internal/cmd/params"
98
"github.com/stackitcloud/stackit-cli/internal/pkg/args"
109
"github.com/stackitcloud/stackit-cli/internal/pkg/examples"
1110
"github.com/stackitcloud/stackit-cli/internal/pkg/flags"
1211
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1312
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
1413
"github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/client"
14+
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
1515
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1616
)
1717

@@ -30,7 +30,7 @@ type inputModel struct {
3030
RoutingTableId string
3131
}
3232

33-
func NewCmd(params *params.CmdParams) *cobra.Command {
33+
func NewCmd(params *types.CmdParams) *cobra.Command {
3434
cmd := &cobra.Command{
3535
Use: fmt.Sprintf("delete %s", routingTableIdFlag),
3636
Short: "Deletes a route within a routing-table",

0 commit comments

Comments
 (0)