Skip to content

Commit 8667066

Browse files
committed
fix review comments
1 parent 1638000 commit 8667066

9 files changed

Lines changed: 767 additions & 563 deletions

File tree

‎internal/cmd/alpha/vpc/routingtable/create/create.go‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import (
1414
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1515
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
1616
"github.com/stackitcloud/stackit-cli/internal/pkg/services/iaasalpha/client"
17+
iaasUtils "github.com/stackitcloud/stackit-cli/internal/pkg/services/iaasalpha/utils"
1718
"github.com/stackitcloud/stackit-cli/internal/pkg/types"
18-
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1919
)
2020

2121
const (
@@ -65,7 +65,15 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
6565
return err
6666
}
6767

68-
prompt := fmt.Sprintf("Are you sure you want to create the routing-table %q for VPC %q in region %q?", model.Name, model.VpcId, model.Region)
68+
vpcLabel, err := iaasUtils.GetVPCName(ctx, apiClient.DefaultAPI, model.ProjectId, model.VpcId)
69+
if err != nil {
70+
params.Printer.Debug(print.ErrorLevel, "get VPC name: %v", err)
71+
vpcLabel = model.VpcId
72+
} else if vpcLabel == "" {
73+
vpcLabel = model.VpcId
74+
}
75+
76+
prompt := fmt.Sprintf("Are you sure you want to create the routing-table %q for VPC %q in region %q?", model.Name, vpcLabel, model.Region)
6977
if err := params.Printer.PromptForConfirmation(prompt); err != nil {
7078
return err
7179
}
@@ -123,8 +131,8 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient iaas.Default
123131
Name: model.Name,
124132
Description: model.Description,
125133
Labels: model.Labels,
126-
DynamicRoutes: utils.Ptr(model.DynamicRoutes),
127-
SystemRoutes: utils.Ptr(model.SystemRoutes),
134+
DynamicRoutes: new(model.DynamicRoutes),
135+
SystemRoutes: new(model.SystemRoutes),
128136
}
129137

130138
return apiClient.AddVPCRoutingTable(ctx, model.ProjectId, model.VpcId, model.Region).AddVPCRoutingTablePayload(payload)

0 commit comments

Comments
 (0)