Skip to content

Commit

Permalink
Add confirmation prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrique Santos committed Nov 24, 2023
1 parent 45ecc39 commit 7c1c787
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/cmd/ske/credential/rotate/rotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"

"github.com/stackitcloud/stackit-cli/internal/pkg/confirm"
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
"github.com/stackitcloud/stackit-cli/internal/pkg/services/ske/client"
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
Expand Down Expand Up @@ -34,6 +35,14 @@ func NewCmd() *cobra.Command {
return err
}

if !model.AssumeYes {
prompt := fmt.Sprintf("Are you sure you want to rotate credentials for project %s? (The old credentials will be invalid after this operation)", model.ProjectId)
err = confirm.PromptForConfirmation(cmd, prompt)
if err != nil {
return err
}
}

// Configure API client
apiClient, err := client.ConfigureClient(cmd)
if err != nil {
Expand Down

0 comments on commit 7c1c787

Please sign in to comment.