@@ -11,6 +11,7 @@ import (
1111 "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1212 "github.com/stackitcloud/stackit-cli/internal/pkg/print"
1313 "github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/client"
14+ iaasUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/utils"
1415 "github.com/stackitcloud/stackit-cli/internal/pkg/types"
1516 "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1617 "github.com/stackitcloud/stackit-sdk-go/services/iaas"
@@ -31,8 +32,8 @@ type inputModel struct {
3132 * globalflags.GlobalFlagModel
3233 OrganizationId string
3334 NetworkAreaId string
34- DynamicRoutes bool
35- SystemRoutes bool
35+ DynamicRoutes * bool
36+ SystemRoutes * bool
3637 RoutingTableId string
3738 Description * string
3839 Labels * map [string ]string
@@ -80,7 +81,15 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
8081 return err
8182 }
8283
83- prompt := fmt .Sprintf ("Are you sure you want to update routing-table %q?" , model .RoutingTableId )
84+ routingTableLabel , err := iaasUtils .GetRoutingTableOfAreaName (ctx , apiClient , model .OrganizationId , model .NetworkAreaId , model .Region , model .RoutingTableId )
85+ if err != nil {
86+ params .Printer .Debug (print .ErrorLevel , "get routing-table name: %v" , err )
87+ routingTableLabel = model .RoutingTableId
88+ } else if routingTableLabel == "" {
89+ routingTableLabel = model .RoutingTableId
90+ }
91+
92+ prompt := fmt .Sprintf ("Are you sure you want to update the routing-table %q?" , routingTableLabel )
8493 err = params .Printer .PromptForConfirmation (prompt )
8594 if err != nil {
8695 return err
@@ -104,11 +113,11 @@ func configureFlags(cmd *cobra.Command) {
104113 cmd .Flags ().String (nameFlag , "" , "Name of the routing-table" )
105114 cmd .Flags ().StringToString (labelFlag , nil , "Key=value labels" )
106115 cmd .Flags ().Var (flags .UUIDFlag (), networkAreaIdFlag , "Network-Area ID" )
107- cmd .Flags ().Bool (dynamicRoutesFlag , true , "If set to false, prevents dynamic routes from propagating to the routing table." )
108- cmd .Flags ().Bool (systemRoutesFlag , true , "If set to false, disables routes for project-to-project communication." )
116+ cmd .Flags ().Bool (dynamicRoutesFlag , false , "If set to false, prevents dynamic routes from propagating to the routing table." )
117+ cmd .Flags ().Bool (systemRoutesFlag , false , "If set to false, disables routes for project-to-project communication." )
109118 cmd .Flags ().Var (flags .UUIDFlag (), organizationIdFlag , "Organization ID" )
110119
111- err := flags .MarkFlagsRequired (cmd , organizationIdFlag , networkAreaIdFlag )
120+ err := flags .MarkFlagsRequired (cmd , organizationIdFlag , networkAreaIdFlag , dynamicRoutesFlag , systemRoutesFlag , nameFlag )
112121 cobra .CheckErr (err )
113122}
114123
@@ -123,8 +132,8 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
123132 Labels : flags .FlagToStringToStringPointer (p , cmd , labelFlag ),
124133 Name : flags .FlagToStringPointer (p , cmd , nameFlag ),
125134 NetworkAreaId : flags .FlagToStringValue (p , cmd , networkAreaIdFlag ),
126- SystemRoutes : flags .FlagToBoolValue (p , cmd , systemRoutesFlag ),
127- DynamicRoutes : flags .FlagToBoolValue (p , cmd , dynamicRoutesFlag ),
135+ SystemRoutes : flags .FlagToBoolPointer (p , cmd , systemRoutesFlag ),
136+ DynamicRoutes : flags .FlagToBoolPointer (p , cmd , dynamicRoutesFlag ),
128137 OrganizationId : flags .FlagToStringValue (p , cmd , organizationIdFlag ),
129138 RoutingTableId : routeTableId ,
130139 }
@@ -161,8 +170,8 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *iaas.APICli
161170 Labels : utils .ConvertStringMapToInterfaceMap (model .Labels ),
162171 Name : model .Name ,
163172 Description : model .Description ,
164- DynamicRoutes : & model .DynamicRoutes ,
165- SystemRoutes : & model .SystemRoutes ,
173+ DynamicRoutes : model .DynamicRoutes ,
174+ SystemRoutes : model .SystemRoutes ,
166175 }
167176
168177 return req .UpdateRoutingTableOfAreaPayload (payload )
0 commit comments