@@ -13,6 +13,7 @@ import (
1313 "github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1414 "github.com/stackitcloud/stackit-cli/internal/pkg/print"
1515 "github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/client"
16+ iaasUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/iaas/utils"
1617 "github.com/stackitcloud/stackit-cli/internal/pkg/types"
1718 "github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1819 "github.com/stackitcloud/stackit-sdk-go/services/iaas"
@@ -59,22 +60,13 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
5960 Args : args .NoArgs ,
6061 Example : examples .Build (
6162 examples .NewExample ("Create a route with CIDRv4 destination and IPv4 nexthop" ,
62- `stackit network-area routing-table route create \
63- --routing-table-id xxx --organization-id yyy --network-area-id zzz \
64- --destination-type cidrv4 --destination-value <ipv4-cidr> \
65- --nexthop-type ipv4 --nexthop-value <ipv4-address>` ),
63+ `$ stackit network-area routing-table route create --routing-table-id xxx --organization-id yyy --network-area-id zzz --destination-type cidrv4 --destination-value <ipv4-cidr> --nexthop-type ipv4 --nexthop-value <ipv4-address>` ),
6664
6765 examples .NewExample ("Create a route with CIDRv6 destination and IPv6 nexthop" ,
68- `stackit network-area routing-table route create \
69- --routing-table-id xxx --organization-id yyy --network-area-id zzz \
70- --destination-type cidrv6 --destination-value <ipv6-cidr> \
71- --nexthop-type ipv6 --nexthop-value <ipv6-address>` ),
66+ `$ stackit network-area routing-table route create --routing-table-id xxx --organization-id yyy --network-area-id zzz --destination-type cidrv6 --destination-value <ipv6-cidr> --nexthop-type ipv6 --nexthop-value <ipv6-address>` ),
7267
7368 examples .NewExample ("Create a route with CIDRv6 destination and Nexthop Internet" ,
74- `stackit network-area routing-table route create \
75- --routing-table-id xxx --organization-id yyy --network-area-id zzz \
76- --destination-type cidrv6 --destination-value <ipv6-cidr> \
77- --nexthop-type internet` ),
69+ `$ stackit network-area routing-table route create --routing-table-id xxx --organization-id yyy --network-area-id zzz --destination-type cidrv6 --destination-value <ipv6-cidr> --nexthop-type internet` ),
7870 ),
7971 RunE : func (cmd * cobra.Command , _ []string ) error {
8072 ctx := context .Background ()
@@ -88,7 +80,15 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
8880 return err
8981 }
9082
91- prompt := fmt .Sprintf ("Are you sure you want to create a route for routing-table with id %q?" , model .RoutingTableId )
83+ routingTableLabel , err := iaasUtils .GetRoutingTableOfAreaName (ctx , apiClient , model .OrganizationId , model .NetworkAreaId , model .Region , model .RoutingTableId )
84+ if err != nil {
85+ params .Printer .Debug (print .ErrorLevel , "get routing-table name: %v" , err )
86+ routingTableLabel = model .RoutingTableId
87+ } else if routingTableLabel == "" {
88+ routingTableLabel = model .RoutingTableId
89+ }
90+
91+ prompt := fmt .Sprintf ("Are you sure you want to create a route for routing-table with id %q?" , routingTableLabel )
9292 err = params .Printer .PromptForConfirmation (prompt )
9393 if err != nil {
9494 return err
0 commit comments