@@ -4,17 +4,16 @@ import (
44 "context"
55 "fmt"
66 "strings"
7- "time"
87
98 "github.com/spf13/cobra"
10- "github.com/stackitcloud/stackit-cli/internal/cmd/params"
119 "github.com/stackitcloud/stackit-cli/internal/pkg/args"
1210 "github.com/stackitcloud/stackit-cli/internal/pkg/examples"
1311 "github.com/stackitcloud/stackit-cli/internal/pkg/flags"
1412 "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1513 "github.com/stackitcloud/stackit-cli/internal/pkg/print"
1614 "github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/client"
1715 "github.com/stackitcloud/stackit-cli/internal/pkg/tables"
16+ "github.com/stackitcloud/stackit-cli/internal/pkg/types"
1817 "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1918 "github.com/stackitcloud/stackit-sdk-go/services/iaas"
2019)
@@ -40,7 +39,7 @@ type inputModel struct {
4039 OrganizationId string
4140}
4241
43- func NewCmd (params * params .CmdParams ) * cobra.Command {
42+ func NewCmd (params * types .CmdParams ) * cobra.Command {
4443 cmd := & cobra.Command {
4544 Use : "create" ,
4645 Short : "Creates a routing-table" ,
@@ -56,11 +55,11 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
5655 `stackit routing-table create --organization-id xxx --network-area-id yyy --name "rt" --description "some description"` ,
5756 ),
5857 examples .NewExample (
59- "Create a routing-table with name `rt` with system_routes disabled" ,
58+ "Create a routing-table with name `rt` with system routes disabled" ,
6059 `stackit routing-table create --organization-id xxx --network-area-id yyy --name "rt" --non-system-routes` ,
6160 ),
6261 examples .NewExample (
63- "Create a routing-table with name `rt` with dynamic_routes disabled" ,
62+ "Create a routing-table with name `rt` with dynamic routes disabled" ,
6463 `stackit routing-table create --organization-id xxx --network-area-id yyy --name "rt" --non-dynamic-routes` ,
6564 ),
6665 ),
@@ -175,28 +174,18 @@ func outputResult(p *print.Printer, outputFormat string, routingTable *iaas.Rout
175174 }
176175 }
177176
178- createdAt := ""
179- if routingTable .CreatedAt != nil {
180- createdAt = routingTable .CreatedAt .Format (time .RFC3339 )
181- }
182-
183- updatedAt := ""
184- if routingTable .UpdatedAt != nil {
185- updatedAt = routingTable .UpdatedAt .Format (time .RFC3339 )
186- }
187-
188177 table := tables .NewTable ()
189- table .SetHeader ("ID" , "NAME" , "DESCRIPTION" , "CREATED_AT " , "UPDATED_AT " , "DEFAULT " , "LABELS " , "SYSTEM_ROUTES " , "DYNAMIC_ROUTES " )
178+ table .SetHeader ("ID" , "NAME" , "DESCRIPTION" , "DEFAULT " , "LABELS " , "SYSTEM ROUTES " , "DYNAMIC ROUTES " , "CREATED AT " , "UPDATED AT " )
190179 table .AddRow (
191180 utils .PtrString (routingTable .Id ),
192181 utils .PtrString (routingTable .Name ),
193182 utils .PtrString (routingTable .Description ),
194- createdAt ,
195- updatedAt ,
196183 utils .PtrString (routingTable .Default ),
197184 strings .Join (labels , "\n " ),
198185 utils .PtrString (routingTable .SystemRoutes ),
199186 utils .PtrString (routingTable .DynamicRoutes ),
187+ utils .ConvertTimePToDateTimeString (routingTable .CreatedAt ),
188+ utils .ConvertTimePToDateTimeString (routingTable .UpdatedAt ),
200189 )
201190
202191 err := table .Display (p )
0 commit comments