Skip to content

Commit b0ed6ea

Browse files
committed
feat(alb): add missing delete confirmation
1 parent df0449e commit b0ed6ea

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

internal/cmd/beta/alb/delete/delete.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/stackitcloud/stackit-cli/internal/pkg/examples"
99
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1010
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
11+
"github.com/stackitcloud/stackit-cli/internal/pkg/projectname"
1112
"github.com/stackitcloud/stackit-cli/internal/pkg/services/alb/client"
1213

1314
"github.com/spf13/cobra"
@@ -48,6 +49,20 @@ func NewCmd(p *print.Printer) *cobra.Command {
4849
return err
4950
}
5051

52+
projectLabel, err := projectname.GetProjectName(ctx, p, cmd)
53+
if err != nil {
54+
p.Debug(print.ErrorLevel, "get project name: %v", err)
55+
projectLabel = model.ProjectId
56+
}
57+
58+
if !model.AssumeYes {
59+
prompt := fmt.Sprintf("Are you sure you want to delete the application loadbalancer %q for project %q?", model.Name, projectLabel)
60+
err = p.PromptForConfirmation(prompt)
61+
if err != nil {
62+
return err
63+
}
64+
}
65+
5166
// Call API
5267
req := buildRequest(ctx, model, apiClient)
5368
_, err = req.Execute()

0 commit comments

Comments
 (0)