Skip to content

Commit 1c3cd90

Browse files
committed
use project name instead of project id
1 parent 13c0511 commit 1c3cd90

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

internal/cmd/ske/cluster/hibernate/hibernate.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/stackitcloud/stackit-cli/internal/pkg/examples"
1212
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1313
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
14+
"github.com/stackitcloud/stackit-cli/internal/pkg/projectname"
1415
"github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client"
1516
"github.com/stackitcloud/stackit-sdk-go/services/ske"
1617
)
@@ -47,8 +48,14 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
4748
return err
4849
}
4950

51+
projectLabel, err := projectname.GetProjectName(ctx, params.Printer, params.CliVersion, cmd)
52+
if err != nil {
53+
params.Printer.Debug(print.ErrorLevel, "get project name: %v", err)
54+
projectLabel = model.ProjectId
55+
}
56+
5057
if !model.AssumeYes {
51-
prompt := fmt.Sprintf("Are you sure you want to trigger hibernate for %q in project %q?", model.ClusterName, model.ProjectId)
58+
prompt := fmt.Sprintf("Are you sure you want to trigger hibernate for %q in project %q?", model.ClusterName, projectLabel)
5259
err = params.Printer.PromptForConfirmation(prompt)
5360
if err != nil {
5461
return err

internal/cmd/ske/cluster/maintenance/maintenance.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/stackitcloud/stackit-cli/internal/pkg/examples"
1212
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1313
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
14+
"github.com/stackitcloud/stackit-cli/internal/pkg/projectname"
1415
"github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client"
1516
"github.com/stackitcloud/stackit-sdk-go/services/ske"
1617
)
@@ -47,8 +48,14 @@ func NewCmd(params *params.CmdParams) *cobra.Command {
4748
return err
4849
}
4950

51+
projectLabel, err := projectname.GetProjectName(ctx, params.Printer, params.CliVersion, cmd)
52+
if err != nil {
53+
params.Printer.Debug(print.ErrorLevel, "get project name: %v", err)
54+
projectLabel = model.ProjectId
55+
}
56+
5057
if !model.AssumeYes {
51-
prompt := fmt.Sprintf("Are you sure you want to trigger maintenance for %q in project %q?", model.ClusterName, model.ProjectId)
58+
prompt := fmt.Sprintf("Are you sure you want to trigger maintenance for %q in project %q?", model.ClusterName, projectLabel)
5259
err = params.Printer.PromptForConfirmation(prompt)
5360
if err != nil {
5461
return err

0 commit comments

Comments
 (0)