diff --git a/internal/cmd/affinity-groups/create/create.go b/internal/cmd/affinity-groups/create/create.go index ca5332eb8..d8b0d5a1b 100644 --- a/internal/cmd/affinity-groups/create/create.go +++ b/internal/cmd/affinity-groups/create/create.go @@ -54,12 +54,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create the affinity group %q?", model.Name) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create the affinity group %q?", model.Name) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/affinity-groups/delete/delete.go b/internal/cmd/affinity-groups/delete/delete.go index 31df4cb18..ba3f83efc 100644 --- a/internal/cmd/affinity-groups/delete/delete.go +++ b/internal/cmd/affinity-groups/delete/delete.go @@ -65,12 +65,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { affinityGroupLabel = model.AffinityGroupId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete affinity group %q?", affinityGroupLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete affinity group %q?", affinityGroupLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/alb/create/create.go b/internal/cmd/beta/alb/create/create.go index cf8429d10..2232d7aad 100644 --- a/internal/cmd/beta/alb/create/create.go +++ b/internal/cmd/beta/alb/create/create.go @@ -66,12 +66,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create an application loadbalancer for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create an application loadbalancer for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/alb/delete/delete.go b/internal/cmd/beta/alb/delete/delete.go index 5d0c23ec5..94b8163ee 100644 --- a/internal/cmd/beta/alb/delete/delete.go +++ b/internal/cmd/beta/alb/delete/delete.go @@ -57,12 +57,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete the application loadbalancer %q for project %q?", model.Name, projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete the application loadbalancer %q for project %q?", model.Name, projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/alb/observability-credentials/add/add.go b/internal/cmd/beta/alb/observability-credentials/add/add.go index 039a76ebe..69d21973b 100644 --- a/internal/cmd/beta/alb/observability-credentials/add/add.go +++ b/internal/cmd/beta/alb/observability-credentials/add/add.go @@ -55,12 +55,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := "Are your sure you want to add credentials?" - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := "Are your sure you want to add credentials?" + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/alb/observability-credentials/delete/delete.go b/internal/cmd/beta/alb/observability-credentials/delete/delete.go index d27de6d3e..274f977f2 100644 --- a/internal/cmd/beta/alb/observability-credentials/delete/delete.go +++ b/internal/cmd/beta/alb/observability-credentials/delete/delete.go @@ -50,12 +50,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete credentials %q?", model.CredentialsRef) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete credentials %q?", model.CredentialsRef) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/alb/observability-credentials/update/update.go b/internal/cmd/beta/alb/observability-credentials/update/update.go index 222c94559..18cbf8eb2 100644 --- a/internal/cmd/beta/alb/observability-credentials/update/update.go +++ b/internal/cmd/beta/alb/observability-credentials/update/update.go @@ -64,12 +64,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { params.Printer.Debug(print.ErrorLevel, "get project name: %v", err) projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update credential %q for %q?", *model.CredentialsRef, projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return fmt.Errorf("update credential: %w", err) - } + prompt := fmt.Sprintf("Are you sure you want to update credential %q for %q?", *model.CredentialsRef, projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return fmt.Errorf("update credential: %w", err) } // Call API diff --git a/internal/cmd/beta/alb/pool/update/update.go b/internal/cmd/beta/alb/pool/update/update.go index dcc51b7c6..a98d5f822 100644 --- a/internal/cmd/beta/alb/pool/update/update.go +++ b/internal/cmd/beta/alb/pool/update/update.go @@ -66,12 +66,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update an application target pool for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update an application target pool for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/alb/update/update.go b/internal/cmd/beta/alb/update/update.go index 5b34fea74..1221cba4f 100644 --- a/internal/cmd/beta/alb/update/update.go +++ b/internal/cmd/beta/alb/update/update.go @@ -67,12 +67,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update an application loadbalancer for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update an application loadbalancer for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // for updates of an existing ALB the current version must be passed to the request diff --git a/internal/cmd/beta/intake/runner/create/create.go b/internal/cmd/beta/intake/runner/create/create.go index 95b6b4211..72cff3b29 100644 --- a/internal/cmd/beta/intake/runner/create/create.go +++ b/internal/cmd/beta/intake/runner/create/create.go @@ -73,12 +73,10 @@ func NewCmd(p *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create an Intake Runner for project %q?", projectLabel) - err = p.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create an Intake Runner for project %q?", projectLabel) + err = p.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/intake/runner/delete/delete.go b/internal/cmd/beta/intake/runner/delete/delete.go index fcb4ae69d..92d5b1acf 100644 --- a/internal/cmd/beta/intake/runner/delete/delete.go +++ b/internal/cmd/beta/intake/runner/delete/delete.go @@ -54,12 +54,10 @@ func NewCmd(p *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete Intake Runner %q?", model.RunnerId) - err = p.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete Intake Runner %q?", model.RunnerId) + err = p.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/kms/key/create/create.go b/internal/cmd/beta/kms/key/create/create.go index 91c6ab3c9..de64af6a7 100644 --- a/internal/cmd/beta/kms/key/create/create.go +++ b/internal/cmd/beta/kms/key/create/create.go @@ -85,11 +85,9 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - err = params.Printer.PromptForConfirmation("Are you sure you want to create a KMS Key?") - if err != nil { - return err - } + err = params.Printer.PromptForConfirmation("Are you sure you want to create a KMS Key?") + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/kms/key/delete/delete.go b/internal/cmd/beta/kms/key/delete/delete.go index 5ead9aca5..d7a6e02f6 100644 --- a/internal/cmd/beta/kms/key/delete/delete.go +++ b/internal/cmd/beta/kms/key/delete/delete.go @@ -64,12 +64,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { keyName = model.KeyId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete key %q? (This cannot be undone)", keyName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete key %q? (This cannot be undone)", keyName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/kms/key/importKey/importKey.go b/internal/cmd/beta/kms/key/importKey/importKey.go index 78c70270e..38010860e 100644 --- a/internal/cmd/beta/kms/key/importKey/importKey.go +++ b/internal/cmd/beta/kms/key/importKey/importKey.go @@ -79,12 +79,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { keyRingName = model.KeyRingId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to import a new version for the KMS Key %q inside the key ring %q?", keyName, keyRingName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to import a new version for the KMS Key %q inside the key ring %q?", keyName, keyRingName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/kms/key/restore/restore.go b/internal/cmd/beta/kms/key/restore/restore.go index 43164aa89..c4fc71173 100644 --- a/internal/cmd/beta/kms/key/restore/restore.go +++ b/internal/cmd/beta/kms/key/restore/restore.go @@ -64,12 +64,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { keyName = model.KeyId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to restore key %q? (This cannot be undone)", keyName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to restore key %q? (This cannot be undone)", keyName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/kms/key/rotate/rotate.go b/internal/cmd/beta/kms/key/rotate/rotate.go index 0761554df..972234e7e 100644 --- a/internal/cmd/beta/kms/key/rotate/rotate.go +++ b/internal/cmd/beta/kms/key/rotate/rotate.go @@ -64,12 +64,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { keyName = model.KeyId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to rotate the key %q? (this cannot be undone)", keyName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to rotate the key %q? (this cannot be undone)", keyName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/kms/keyring/create/create.go b/internal/cmd/beta/kms/keyring/create/create.go index 6a44529ed..0e773b364 100644 --- a/internal/cmd/beta/kms/keyring/create/create.go +++ b/internal/cmd/beta/kms/keyring/create/create.go @@ -64,11 +64,9 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - err = params.Printer.PromptForConfirmation("Are you sure you want to create a KMS key ring?") - if err != nil { - return err - } + err = params.Printer.PromptForConfirmation("Are you sure you want to create a KMS key ring?") + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/kms/keyring/delete/delete.go b/internal/cmd/beta/kms/keyring/delete/delete.go index 79c7316ea..6e028c75b 100644 --- a/internal/cmd/beta/kms/keyring/delete/delete.go +++ b/internal/cmd/beta/kms/keyring/delete/delete.go @@ -58,12 +58,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { keyRingLabel = model.KeyRingId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete key ring %q? (this cannot be undone)", keyRingLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete key ring %q? (this cannot be undone)", keyRingLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/kms/wrappingkey/create/create.go b/internal/cmd/beta/kms/wrappingkey/create/create.go index d652da5ac..885c3b3e2 100644 --- a/internal/cmd/beta/kms/wrappingkey/create/create.go +++ b/internal/cmd/beta/kms/wrappingkey/create/create.go @@ -71,11 +71,9 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - err = params.Printer.PromptForConfirmation("Are you sure you want to create a KMS wrapping key?") - if err != nil { - return err - } + err = params.Printer.PromptForConfirmation("Are you sure you want to create a KMS wrapping key?") + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/kms/wrappingkey/delete/delete.go b/internal/cmd/beta/kms/wrappingkey/delete/delete.go index 38b659cdf..75ce76a05 100644 --- a/internal/cmd/beta/kms/wrappingkey/delete/delete.go +++ b/internal/cmd/beta/kms/wrappingkey/delete/delete.go @@ -62,12 +62,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { wrappingKeyName = model.WrappingKeyId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete the wrapping key %q? (this cannot be undone)", wrappingKeyName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete the wrapping key %q? (this cannot be undone)", wrappingKeyName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sfs/export-policy/create/create.go b/internal/cmd/beta/sfs/export-policy/create/create.go index 3f3ecf864..8732825aa 100644 --- a/internal/cmd/beta/sfs/export-policy/create/create.go +++ b/internal/cmd/beta/sfs/export-policy/create/create.go @@ -67,12 +67,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a export policy for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a export policy for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sfs/export-policy/delete/delete.go b/internal/cmd/beta/sfs/export-policy/delete/delete.go index b93807b5c..8ae903d23 100644 --- a/internal/cmd/beta/sfs/export-policy/delete/delete.go +++ b/internal/cmd/beta/sfs/export-policy/delete/delete.go @@ -56,12 +56,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { exportPolicyLabel = model.ExportPolicyId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete export policy %q? (This cannot be undone)", exportPolicyLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete export policy %q? (This cannot be undone)", exportPolicyLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sfs/export-policy/update/update.go b/internal/cmd/beta/sfs/export-policy/update/update.go index cbe394459..a0ab0a6dc 100644 --- a/internal/cmd/beta/sfs/export-policy/update/update.go +++ b/internal/cmd/beta/sfs/export-policy/update/update.go @@ -78,12 +78,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update export policy %q for project %q?", exportPolicyLabel, projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update export policy %q for project %q?", exportPolicyLabel, projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sfs/resource-pool/create/create.go b/internal/cmd/beta/sfs/resource-pool/create/create.go index 69093d471..4b97f16bb 100644 --- a/internal/cmd/beta/sfs/resource-pool/create/create.go +++ b/internal/cmd/beta/sfs/resource-pool/create/create.go @@ -82,12 +82,10 @@ The available performance class values can be obtained by running: projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a resource-pool for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a resource-pool for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sfs/resource-pool/delete/delete.go b/internal/cmd/beta/sfs/resource-pool/delete/delete.go index acd38ae4d..6883c3987 100644 --- a/internal/cmd/beta/sfs/resource-pool/delete/delete.go +++ b/internal/cmd/beta/sfs/resource-pool/delete/delete.go @@ -59,12 +59,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { resourcePoolName = model.ResourcePoolId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete resource pool %q? (This cannot be undone)", resourcePoolName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete resource pool %q? (This cannot be undone)", resourcePoolName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sfs/resource-pool/update/update.go b/internal/cmd/beta/sfs/resource-pool/update/update.go index 267f68939..a276fb91e 100644 --- a/internal/cmd/beta/sfs/resource-pool/update/update.go +++ b/internal/cmd/beta/sfs/resource-pool/update/update.go @@ -87,12 +87,10 @@ The available performance class values can be obtained by running: resourcePoolName = model.ResourcePoolId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update resource-pool %q for project %q?", resourcePoolName, projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update resource-pool %q for project %q?", resourcePoolName, projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sfs/share/create/create.go b/internal/cmd/beta/sfs/share/create/create.go index 8fc5312bf..c2b2246b8 100644 --- a/internal/cmd/beta/sfs/share/create/create.go +++ b/internal/cmd/beta/sfs/share/create/create.go @@ -72,12 +72,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { resourcePoolLabel = model.ResourcePoolId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a SFS share for resource pool %q?", resourcePoolLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a SFS share for resource pool %q?", resourcePoolLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sfs/share/delete/delete.go b/internal/cmd/beta/sfs/share/delete/delete.go index 7d5221cf7..aed603d52 100644 --- a/internal/cmd/beta/sfs/share/delete/delete.go +++ b/internal/cmd/beta/sfs/share/delete/delete.go @@ -65,12 +65,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { shareLabel = model.ShareId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete SFS share %q? (This cannot be undone)", shareLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete SFS share %q? (This cannot be undone)", shareLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sfs/share/update/update.go b/internal/cmd/beta/sfs/share/update/update.go index f6178e96a..7f368fa3d 100644 --- a/internal/cmd/beta/sfs/share/update/update.go +++ b/internal/cmd/beta/sfs/share/update/update.go @@ -81,12 +81,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { resourcePoolLabel = model.ResourcePoolId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update SFS share %q for resource pool %q?", shareLabel, resourcePoolLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update SFS share %q for resource pool %q?", shareLabel, resourcePoolLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sfs/snapshot/create/create.go b/internal/cmd/beta/sfs/snapshot/create/create.go index e55d902e9..c531009de 100644 --- a/internal/cmd/beta/sfs/snapshot/create/create.go +++ b/internal/cmd/beta/sfs/snapshot/create/create.go @@ -68,12 +68,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { resourcePoolLabel = model.ResourcePoolId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a snapshot for resource pool %q?", resourcePoolLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a snapshot for resource pool %q?", resourcePoolLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sfs/snapshot/delete/delete.go b/internal/cmd/beta/sfs/snapshot/delete/delete.go index 6ddfc4435..15e0cec17 100644 --- a/internal/cmd/beta/sfs/snapshot/delete/delete.go +++ b/internal/cmd/beta/sfs/snapshot/delete/delete.go @@ -61,12 +61,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { resourcePoolLabel = model.ResourcePoolId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete snapshot %q for resource pool %q?", model.SnapshotName, resourcePoolLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete snapshot %q for resource pool %q?", model.SnapshotName, resourcePoolLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sqlserverflex/database/create/create.go b/internal/cmd/beta/sqlserverflex/database/create/create.go index 072c3b91e..9a2b8c2e0 100644 --- a/internal/cmd/beta/sqlserverflex/database/create/create.go +++ b/internal/cmd/beta/sqlserverflex/database/create/create.go @@ -60,12 +60,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create database %q? (This cannot be undone)", model.DatabaseName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create database %q? (This cannot be undone)", model.DatabaseName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sqlserverflex/database/delete/delete.go b/internal/cmd/beta/sqlserverflex/database/delete/delete.go index edfd47f83..3408cc85d 100644 --- a/internal/cmd/beta/sqlserverflex/database/delete/delete.go +++ b/internal/cmd/beta/sqlserverflex/database/delete/delete.go @@ -58,12 +58,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete database %q? (This cannot be undone)", model.DatabaseName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete database %q? (This cannot be undone)", model.DatabaseName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sqlserverflex/instance/create/create.go b/internal/cmd/beta/sqlserverflex/instance/create/create.go index 04841a4c7..4cc0469e5 100644 --- a/internal/cmd/beta/sqlserverflex/instance/create/create.go +++ b/internal/cmd/beta/sqlserverflex/instance/create/create.go @@ -103,12 +103,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a SQLServer Flex instance for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a SQLServer Flex instance for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sqlserverflex/instance/delete/delete.go b/internal/cmd/beta/sqlserverflex/instance/delete/delete.go index 5e320f039..74840b4db 100644 --- a/internal/cmd/beta/sqlserverflex/instance/delete/delete.go +++ b/internal/cmd/beta/sqlserverflex/instance/delete/delete.go @@ -60,12 +60,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sqlserverflex/instance/update/update.go b/internal/cmd/beta/sqlserverflex/instance/update/update.go index 019826e3b..81a4b5008 100644 --- a/internal/cmd/beta/sqlserverflex/instance/update/update.go +++ b/internal/cmd/beta/sqlserverflex/instance/update/update.go @@ -94,12 +94,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sqlserverflex/user/create/create.go b/internal/cmd/beta/sqlserverflex/user/create/create.go index 5a818be70..1f3887390 100644 --- a/internal/cmd/beta/sqlserverflex/user/create/create.go +++ b/internal/cmd/beta/sqlserverflex/user/create/create.go @@ -75,12 +75,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a user for instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a user for instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sqlserverflex/user/delete/delete.go b/internal/cmd/beta/sqlserverflex/user/delete/delete.go index 0908a227f..c1dd038d0 100644 --- a/internal/cmd/beta/sqlserverflex/user/delete/delete.go +++ b/internal/cmd/beta/sqlserverflex/user/delete/delete.go @@ -71,12 +71,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { userLabel = model.UserId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete user %q of instance %q? (This cannot be undone)", userLabel, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete user %q of instance %q? (This cannot be undone)", userLabel, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/beta/sqlserverflex/user/reset-password/reset_password.go b/internal/cmd/beta/sqlserverflex/user/reset-password/reset_password.go index b27b6e923..f76922fc8 100644 --- a/internal/cmd/beta/sqlserverflex/user/reset-password/reset_password.go +++ b/internal/cmd/beta/sqlserverflex/user/reset-password/reset_password.go @@ -72,12 +72,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { userLabel = model.UserId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to reset the password of user %q of instance %q? (This cannot be undone)", userLabel, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to reset the password of user %q of instance %q? (This cannot be undone)", userLabel, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/config/profile/delete/delete.go b/internal/cmd/config/profile/delete/delete.go index 631374a84..a81bf7888 100644 --- a/internal/cmd/config/profile/delete/delete.go +++ b/internal/cmd/config/profile/delete/delete.go @@ -65,12 +65,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { params.Printer.Warn("The profile you are trying to delete is the active profile. The default profile will be set to active.\n") } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete profile %q? (This cannot be undone)", model.Profile) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete profile %q? (This cannot be undone)", model.Profile) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } err = config.DeleteProfile(params.Printer, model.Profile) diff --git a/internal/cmd/dns/record-set/create/create.go b/internal/cmd/dns/record-set/create/create.go index 3dcc666e9..2687b34da 100644 --- a/internal/cmd/dns/record-set/create/create.go +++ b/internal/cmd/dns/record-set/create/create.go @@ -73,12 +73,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { zoneLabel = model.ZoneId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a record set for zone %s?", zoneLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a record set for zone %s?", zoneLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/dns/record-set/delete/delete.go b/internal/cmd/dns/record-set/delete/delete.go index dcfa6d300..09337b89e 100644 --- a/internal/cmd/dns/record-set/delete/delete.go +++ b/internal/cmd/dns/record-set/delete/delete.go @@ -70,12 +70,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { recordSetLabel = model.RecordSetId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete record set %s of zone %s? (This cannot be undone)", recordSetLabel, zoneLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete record set %s of zone %s? (This cannot be undone)", recordSetLabel, zoneLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/dns/record-set/update/update.go b/internal/cmd/dns/record-set/update/update.go index e3df19d91..b9fb0e942 100644 --- a/internal/cmd/dns/record-set/update/update.go +++ b/internal/cmd/dns/record-set/update/update.go @@ -93,12 +93,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { } } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update record set %s of zone %s?", recordSetLabel, zoneLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update record set %s of zone %s?", recordSetLabel, zoneLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/dns/zone/clone/clone.go b/internal/cmd/dns/zone/clone/clone.go index 0611348f9..6bc02546d 100644 --- a/internal/cmd/dns/zone/clone/clone.go +++ b/internal/cmd/dns/zone/clone/clone.go @@ -75,12 +75,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { zoneLabel = model.ZoneId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to clone the zone %q?", zoneLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to clone the zone %q?", zoneLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/dns/zone/create/create.go b/internal/cmd/dns/zone/create/create.go index 3454e654d..75ef0a3e5 100644 --- a/internal/cmd/dns/zone/create/create.go +++ b/internal/cmd/dns/zone/create/create.go @@ -88,12 +88,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a zone for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a zone for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/dns/zone/delete/delete.go b/internal/cmd/dns/zone/delete/delete.go index 499ba920a..a204a5dbe 100644 --- a/internal/cmd/dns/zone/delete/delete.go +++ b/internal/cmd/dns/zone/delete/delete.go @@ -59,12 +59,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { params.Printer.Debug(print.ErrorLevel, "get zone name: %v", err) zoneLabel = model.ZoneId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete zone %q? (This cannot be undone)", zoneLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete zone %q? (This cannot be undone)", zoneLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/dns/zone/update/update.go b/internal/cmd/dns/zone/update/update.go index 128f1c3f0..a3c31b097 100644 --- a/internal/cmd/dns/zone/update/update.go +++ b/internal/cmd/dns/zone/update/update.go @@ -82,12 +82,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { zoneLabel = model.ZoneId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update zone %s?", zoneLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update zone %s?", zoneLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/git/instance/create/create.go b/internal/cmd/git/instance/create/create.go index f1323fb49..b11bb16a6 100644 --- a/internal/cmd/git/instance/create/create.go +++ b/internal/cmd/git/instance/create/create.go @@ -67,12 +67,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create the instance %q?", model.Name) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create the instance %q?", model.Name) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/git/instance/delete/delete.go b/internal/cmd/git/instance/delete/delete.go index ae9394c83..7c056829a 100644 --- a/internal/cmd/git/instance/delete/delete.go +++ b/internal/cmd/git/instance/delete/delete.go @@ -65,12 +65,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceName = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete the stackit git instance %q for %q?", instanceName, projectName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete the stackit git instance %q for %q?", instanceName, projectName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/image/create/create.go b/internal/cmd/image/create/create.go index 784c4389f..e463bf41e 100644 --- a/internal/cmd/image/create/create.go +++ b/internal/cmd/image/create/create.go @@ -127,12 +127,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { } }() - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create the image %q?", model.Name) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create the image %q?", model.Name) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/image/delete/delete.go b/internal/cmd/image/delete/delete.go index ffbbf8714..c41746f58 100644 --- a/internal/cmd/image/delete/delete.go +++ b/internal/cmd/image/delete/delete.go @@ -60,12 +60,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { imageName = model.ImageId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete the image %q for %q?", imageName, projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete the image %q for %q?", imageName, projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/image/update/update.go b/internal/cmd/image/update/update.go index 7aa3851c0..26d8ca088 100644 --- a/internal/cmd/image/update/update.go +++ b/internal/cmd/image/update/update.go @@ -139,12 +139,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { imageLabel = model.Id } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update the image %q?", imageLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update the image %q?", imageLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/key-pair/create/create.go b/internal/cmd/key-pair/create/create.go index 4ce01cfdf..5bb18ef2e 100644 --- a/internal/cmd/key-pair/create/create.go +++ b/internal/cmd/key-pair/create/create.go @@ -67,12 +67,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := "Are your sure you want to create a key pair?" - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := "Are your sure you want to create a key pair?" + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/key-pair/delete/delete.go b/internal/cmd/key-pair/delete/delete.go index 70d7e9a8f..17984e936 100644 --- a/internal/cmd/key-pair/delete/delete.go +++ b/internal/cmd/key-pair/delete/delete.go @@ -50,12 +50,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete key pair %q?", model.KeyPairName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete key pair %q?", model.KeyPairName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/key-pair/update/update.go b/internal/cmd/key-pair/update/update.go index 450329082..14988bf28 100644 --- a/internal/cmd/key-pair/update/update.go +++ b/internal/cmd/key-pair/update/update.go @@ -51,12 +51,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update key pair %q?", *model.KeyPairName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return fmt.Errorf("update key pair: %w", err) - } + prompt := fmt.Sprintf("Are you sure you want to update key pair %q?", *model.KeyPairName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return fmt.Errorf("update key pair: %w", err) } // Call API diff --git a/internal/cmd/load-balancer/create/create.go b/internal/cmd/load-balancer/create/create.go index 0ebaaee16..31e74d9ba 100644 --- a/internal/cmd/load-balancer/create/create.go +++ b/internal/cmd/load-balancer/create/create.go @@ -78,12 +78,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a load balancer for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a load balancer for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/load-balancer/delete/delete.go b/internal/cmd/load-balancer/delete/delete.go index 0c43431f1..e1c3a33af 100644 --- a/internal/cmd/load-balancer/delete/delete.go +++ b/internal/cmd/load-balancer/delete/delete.go @@ -51,12 +51,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete load balancer %q? (This cannot be undone)", model.LoadBalancerName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete load balancer %q? (This cannot be undone)", model.LoadBalancerName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/load-balancer/observability-credentials/add/add.go b/internal/cmd/load-balancer/observability-credentials/add/add.go index 0aa0c8532..edb3f447e 100644 --- a/internal/cmd/load-balancer/observability-credentials/add/add.go +++ b/internal/cmd/load-balancer/observability-credentials/add/add.go @@ -76,12 +76,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { model.Password = utils.Ptr(pwd) } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to add observability credentials for Load Balancer on project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to add observability credentials for Load Balancer on project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/load-balancer/observability-credentials/cleanup/cleanup.go b/internal/cmd/load-balancer/observability-credentials/cleanup/cleanup.go index ce2df7311..35e123ee3 100644 --- a/internal/cmd/load-balancer/observability-credentials/cleanup/cleanup.go +++ b/internal/cmd/load-balancer/observability-credentials/cleanup/cleanup.go @@ -72,21 +72,19 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return nil } - if !model.AssumeYes { - prompt := "Will delete the following unused observability credentials: \n" - for _, credential := range credentials { - if credential.DisplayName == nil || credential.Username == nil { - return fmt.Errorf("list unused Load Balancer observability credentials: credentials %q missing display name or username", *credential.CredentialsRef) - } - name := *credential.DisplayName - username := *credential.Username - prompt += fmt.Sprintf(" - %s (username: %q)\n", name, username) - } - prompt += fmt.Sprintf("Are you sure you want to delete unused observability credentials on project %q? (This cannot be undone)", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err + prompt := "Will delete the following unused observability credentials: \n" + for _, credential := range credentials { + if credential.DisplayName == nil || credential.Username == nil { + return fmt.Errorf("list unused Load Balancer observability credentials: credentials %q missing display name or username", *credential.CredentialsRef) } + name := *credential.DisplayName + username := *credential.Username + prompt += fmt.Sprintf(" - %s (username: %q)\n", name, username) + } + prompt += fmt.Sprintf("Are you sure you want to delete unused observability credentials on project %q? (This cannot be undone)", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } for _, credential := range credentials { diff --git a/internal/cmd/load-balancer/observability-credentials/delete/delete.go b/internal/cmd/load-balancer/observability-credentials/delete/delete.go index 238a9fcfb..4139f56db 100644 --- a/internal/cmd/load-balancer/observability-credentials/delete/delete.go +++ b/internal/cmd/load-balancer/observability-credentials/delete/delete.go @@ -64,12 +64,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { credentialsLabel = model.CredentialsRef } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete observability credentials %q on project %q?(This cannot be undone)", credentialsLabel, projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete observability credentials %q on project %q?(This cannot be undone)", credentialsLabel, projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/load-balancer/observability-credentials/update/update.go b/internal/cmd/load-balancer/observability-credentials/update/update.go index dfa4e6f1a..f19afb714 100644 --- a/internal/cmd/load-balancer/observability-credentials/update/update.go +++ b/internal/cmd/load-balancer/observability-credentials/update/update.go @@ -95,12 +95,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { model.Password = utils.Ptr(pwd) } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update observability credentials %q for Load Balancer on project %q?", credentialsLabel, projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update observability credentials %q for Load Balancer on project %q?", credentialsLabel, projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/load-balancer/target-pool/add-target/add_target.go b/internal/cmd/load-balancer/target-pool/add-target/add_target.go index 8bd1032ea..4cc41d4ef 100644 --- a/internal/cmd/load-balancer/target-pool/add-target/add_target.go +++ b/internal/cmd/load-balancer/target-pool/add-target/add_target.go @@ -62,12 +62,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to add a target with IP %q to target pool %q of load balancer %q?", model.IP, model.TargetPoolName, model.LBName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to add a target with IP %q to target pool %q of load balancer %q?", model.IP, model.TargetPoolName, model.LBName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/load-balancer/target-pool/remove-target/remove_target.go b/internal/cmd/load-balancer/target-pool/remove-target/remove_target.go index c0550ade6..4cb053eff 100644 --- a/internal/cmd/load-balancer/target-pool/remove-target/remove_target.go +++ b/internal/cmd/load-balancer/target-pool/remove-target/remove_target.go @@ -64,12 +64,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { targetLabel = model.IP } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to remove target %q from target pool %q of load balancer %q?", targetLabel, model.TargetPoolName, model.LBName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to remove target %q from target pool %q of load balancer %q?", targetLabel, model.TargetPoolName, model.LBName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/load-balancer/update/update.go b/internal/cmd/load-balancer/update/update.go index 7a3184e1c..5e55a414b 100644 --- a/internal/cmd/load-balancer/update/update.go +++ b/internal/cmd/load-balancer/update/update.go @@ -66,12 +66,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update load balancer %q?", model.LoadBalancerName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update load balancer %q?", model.LoadBalancerName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/logme/credentials/create/create.go b/internal/cmd/logme/credentials/create/create.go index 5c2451e73..79d5577c4 100644 --- a/internal/cmd/logme/credentials/create/create.go +++ b/internal/cmd/logme/credentials/create/create.go @@ -63,12 +63,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create credentials for instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create credentials for instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/logme/credentials/delete/delete.go b/internal/cmd/logme/credentials/delete/delete.go index 3254e6f32..26d2750fd 100644 --- a/internal/cmd/logme/credentials/delete/delete.go +++ b/internal/cmd/logme/credentials/delete/delete.go @@ -68,12 +68,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { credentialsLabel = model.CredentialsId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete credentials %s of instance %q? (This cannot be undone)", credentialsLabel, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete credentials %s of instance %q? (This cannot be undone)", credentialsLabel, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/logme/instance/create/create.go b/internal/cmd/logme/instance/create/create.go index f3b1118c1..c0b1fcd48 100644 --- a/internal/cmd/logme/instance/create/create.go +++ b/internal/cmd/logme/instance/create/create.go @@ -91,12 +91,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a LogMe instance for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a LogMe instance for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/logme/instance/delete/delete.go b/internal/cmd/logme/instance/delete/delete.go index f804e3b6d..9cdfac9d0 100644 --- a/internal/cmd/logme/instance/delete/delete.go +++ b/internal/cmd/logme/instance/delete/delete.go @@ -60,12 +60,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/logme/instance/update/update.go b/internal/cmd/logme/instance/update/update.go index 6d503a394..4cefddf26 100644 --- a/internal/cmd/logme/instance/update/update.go +++ b/internal/cmd/logme/instance/update/update.go @@ -90,12 +90,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/mariadb/credentials/create/create.go b/internal/cmd/mariadb/credentials/create/create.go index 9ac022e6f..f3d9e1155 100644 --- a/internal/cmd/mariadb/credentials/create/create.go +++ b/internal/cmd/mariadb/credentials/create/create.go @@ -64,12 +64,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create credentials for instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create credentials for instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/mariadb/credentials/delete/delete.go b/internal/cmd/mariadb/credentials/delete/delete.go index 830ebd840..7fd89c4e9 100644 --- a/internal/cmd/mariadb/credentials/delete/delete.go +++ b/internal/cmd/mariadb/credentials/delete/delete.go @@ -68,12 +68,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { credentialsLabel = model.CredentialsId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete credentials %s of instance %q? (This cannot be undone)", credentialsLabel, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete credentials %s of instance %q? (This cannot be undone)", credentialsLabel, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/mariadb/instance/create/create.go b/internal/cmd/mariadb/instance/create/create.go index 2793da086..22a8a2b91 100644 --- a/internal/cmd/mariadb/instance/create/create.go +++ b/internal/cmd/mariadb/instance/create/create.go @@ -91,12 +91,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a MariaDB instance for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a MariaDB instance for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/mariadb/instance/delete/delete.go b/internal/cmd/mariadb/instance/delete/delete.go index 3e59476f6..1cd809204 100644 --- a/internal/cmd/mariadb/instance/delete/delete.go +++ b/internal/cmd/mariadb/instance/delete/delete.go @@ -60,12 +60,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/mariadb/instance/update/update.go b/internal/cmd/mariadb/instance/update/update.go index 6aa6f701d..ebb48e315 100644 --- a/internal/cmd/mariadb/instance/update/update.go +++ b/internal/cmd/mariadb/instance/update/update.go @@ -88,12 +88,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/mongodbflex/backup/restore/restore.go b/internal/cmd/mongodbflex/backup/restore/restore.go index f7e5feb79..a4b6e5ca9 100644 --- a/internal/cmd/mongodbflex/backup/restore/restore.go +++ b/internal/cmd/mongodbflex/backup/restore/restore.go @@ -77,12 +77,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to restore MongoDB Flex instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to restore MongoDB Flex instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // If backupInstanceId is not provided, the target is the same instance as the backup diff --git a/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go b/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go index ce4dce055..6934fb862 100644 --- a/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go +++ b/internal/cmd/mongodbflex/backup/update-schedule/update_schedule.go @@ -88,12 +88,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = *model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update backup schedule of instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update backup schedule of instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Get current instance diff --git a/internal/cmd/mongodbflex/instance/create/create.go b/internal/cmd/mongodbflex/instance/create/create.go index 6a7c181e6..e0239d2f5 100644 --- a/internal/cmd/mongodbflex/instance/create/create.go +++ b/internal/cmd/mongodbflex/instance/create/create.go @@ -93,12 +93,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a MongoDB Flex instance for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a MongoDB Flex instance for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Fill in version, if needed diff --git a/internal/cmd/mongodbflex/instance/delete/delete.go b/internal/cmd/mongodbflex/instance/delete/delete.go index f5316c8fe..cb4a2be9c 100644 --- a/internal/cmd/mongodbflex/instance/delete/delete.go +++ b/internal/cmd/mongodbflex/instance/delete/delete.go @@ -60,12 +60,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/mongodbflex/instance/update/update.go b/internal/cmd/mongodbflex/instance/update/update.go index fa160df07..bcd4bb894 100644 --- a/internal/cmd/mongodbflex/instance/update/update.go +++ b/internal/cmd/mongodbflex/instance/update/update.go @@ -88,12 +88,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/mongodbflex/user/create/create.go b/internal/cmd/mongodbflex/user/create/create.go index b1d32aed9..9fc9def6d 100644 --- a/internal/cmd/mongodbflex/user/create/create.go +++ b/internal/cmd/mongodbflex/user/create/create.go @@ -77,12 +77,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a user for instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a user for instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/mongodbflex/user/delete/delete.go b/internal/cmd/mongodbflex/user/delete/delete.go index 54f28cdc2..823f43d65 100644 --- a/internal/cmd/mongodbflex/user/delete/delete.go +++ b/internal/cmd/mongodbflex/user/delete/delete.go @@ -72,12 +72,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { userLabel = model.UserId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete user %q of instance %q? (This cannot be undone)", userLabel, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete user %q of instance %q? (This cannot be undone)", userLabel, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/mongodbflex/user/reset-password/reset_password.go b/internal/cmd/mongodbflex/user/reset-password/reset_password.go index e92c189db..749b8f9d0 100644 --- a/internal/cmd/mongodbflex/user/reset-password/reset_password.go +++ b/internal/cmd/mongodbflex/user/reset-password/reset_password.go @@ -72,12 +72,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { userLabel = model.UserId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to reset the password of user %q of instance %q? (This cannot be undone)", userLabel, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to reset the password of user %q of instance %q? (This cannot be undone)", userLabel, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/mongodbflex/user/update/update.go b/internal/cmd/mongodbflex/user/update/update.go index caa91c059..200873a77 100644 --- a/internal/cmd/mongodbflex/user/update/update.go +++ b/internal/cmd/mongodbflex/user/update/update.go @@ -73,12 +73,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { userLabel = model.UserId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update user %q of instance %q?", userLabel, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update user %q of instance %q?", userLabel, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/network-area/create/create.go b/internal/cmd/network-area/create/create.go index 15e9b8192..078a6568c 100644 --- a/internal/cmd/network-area/create/create.go +++ b/internal/cmd/network-area/create/create.go @@ -114,12 +114,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { params.Printer.Debug(print.ErrorLevel, "configure resource manager client: %v", err) } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a network area for organization %q?", orgLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a network area for organization %q?", orgLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API @@ -147,7 +145,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command { if err != nil { return fmt.Errorf("create network area region: %w", err) } - if !model.AssumeYes { + if !model.Async { s := spinner.New(params.Printer) s.Start("Create network area region") _, err = wait.CreateNetworkAreaRegionWaitHandler(ctx, apiClient, model.OrganizationId, *resp.Id, model.Region).WaitWithContext(ctx) diff --git a/internal/cmd/network-area/delete/delete.go b/internal/cmd/network-area/delete/delete.go index becf4524c..e1dbca35e 100644 --- a/internal/cmd/network-area/delete/delete.go +++ b/internal/cmd/network-area/delete/delete.go @@ -69,12 +69,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { networkAreaLabel = model.AreaId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete network area %q?", networkAreaLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete network area %q?", networkAreaLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Check if the network area has a regional configuration diff --git a/internal/cmd/network-area/network-range/create/create.go b/internal/cmd/network-area/network-range/create/create.go index a77852fb3..0502663d8 100644 --- a/internal/cmd/network-area/network-range/create/create.go +++ b/internal/cmd/network-area/network-range/create/create.go @@ -64,12 +64,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { networkAreaLabel = *model.NetworkAreaId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a network range for STACKIT Network Area (SNA) %q?", networkAreaLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a network range for STACKIT Network Area (SNA) %q?", networkAreaLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/network-area/network-range/delete/delete.go b/internal/cmd/network-area/network-range/delete/delete.go index 82e697109..84ceb85c7 100644 --- a/internal/cmd/network-area/network-range/delete/delete.go +++ b/internal/cmd/network-area/network-range/delete/delete.go @@ -71,12 +71,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { networkRangeLabel = model.NetworkRangeId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete network range %q on STACKIT Network Area (SNA) %q?", networkRangeLabel, networkAreaLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete network range %q on STACKIT Network Area (SNA) %q?", networkRangeLabel, networkAreaLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/network-area/region/create/create.go b/internal/cmd/network-area/region/create/create.go index 4adf5cee9..63a8c6348 100644 --- a/internal/cmd/network-area/region/create/create.go +++ b/internal/cmd/network-area/region/create/create.go @@ -90,12 +90,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { networkAreaLabel = model.NetworkAreaId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create the regional configuration %q for STACKIT Network Area (SNA) %q?", model.Region, networkAreaLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create the regional configuration %q for STACKIT Network Area (SNA) %q?", model.Region, networkAreaLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/network-area/region/delete/delete.go b/internal/cmd/network-area/region/delete/delete.go index ff31aeaa2..bbbd44262 100644 --- a/internal/cmd/network-area/region/delete/delete.go +++ b/internal/cmd/network-area/region/delete/delete.go @@ -68,12 +68,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { networkAreaName = model.NetworkAreaId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete the regional configuration %q for STACKIT Network Area (SNA) %q?", model.Region, networkAreaName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete the regional configuration %q for STACKIT Network Area (SNA) %q?", model.Region, networkAreaName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/network-area/region/update/update.go b/internal/cmd/network-area/region/update/update.go index 1d1f64bf7..8b68195ff 100644 --- a/internal/cmd/network-area/region/update/update.go +++ b/internal/cmd/network-area/region/update/update.go @@ -83,12 +83,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { networkAreaLabel = model.NetworkAreaId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update the regional configuration %q for STACKIT Network Area (SNA) %q?", model.Region, networkAreaLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update the regional configuration %q for STACKIT Network Area (SNA) %q?", model.Region, networkAreaLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/network-area/route/create/create.go b/internal/cmd/network-area/route/create/create.go index d0ad72a2b..72c9fe006 100644 --- a/internal/cmd/network-area/route/create/create.go +++ b/internal/cmd/network-area/route/create/create.go @@ -98,12 +98,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { networkAreaLabel = *model.NetworkAreaId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a static route for STACKIT Network Area (SNA) %q?", networkAreaLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a static route for STACKIT Network Area (SNA) %q?", networkAreaLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/network-area/route/delete/delete.go b/internal/cmd/network-area/route/delete/delete.go index 6292f3cd7..dbad67c03 100644 --- a/internal/cmd/network-area/route/delete/delete.go +++ b/internal/cmd/network-area/route/delete/delete.go @@ -64,12 +64,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { networkAreaLabel = *model.NetworkAreaId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete static route %q on STACKIT Network Area (SNA) %q?", model.RouteId, networkAreaLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete static route %q on STACKIT Network Area (SNA) %q?", model.RouteId, networkAreaLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/network-area/update/update.go b/internal/cmd/network-area/update/update.go index 71d9bd899..98f778bc3 100644 --- a/internal/cmd/network-area/update/update.go +++ b/internal/cmd/network-area/update/update.go @@ -103,12 +103,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { params.Printer.Debug(print.ErrorLevel, "configure resource manager client: %v", err) } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update a network area for organization %q?", orgLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update a network area for organization %q?", orgLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/network-interface/create/create.go b/internal/cmd/network-interface/create/create.go index c660bb561..5939d712d 100644 --- a/internal/cmd/network-interface/create/create.go +++ b/internal/cmd/network-interface/create/create.go @@ -86,12 +86,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a network interface for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a network interface for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/network-interface/delete/delete.go b/internal/cmd/network-interface/delete/delete.go index 8db2f2376..de6d972cb 100644 --- a/internal/cmd/network-interface/delete/delete.go +++ b/internal/cmd/network-interface/delete/delete.go @@ -54,12 +54,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete the network interface %q? (This cannot be undone)", model.NicId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete the network interface %q? (This cannot be undone)", model.NicId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/network-interface/update/update.go b/internal/cmd/network-interface/update/update.go index 283083698..eeae44774 100644 --- a/internal/cmd/network-interface/update/update.go +++ b/internal/cmd/network-interface/update/update.go @@ -80,12 +80,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update the network interface %q?", model.NicId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update the network interface %q?", model.NicId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/network/create/create.go b/internal/cmd/network/create/create.go index 4a2098191..fee9123ce 100644 --- a/internal/cmd/network/create/create.go +++ b/internal/cmd/network/create/create.go @@ -108,12 +108,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a network for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a network for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/network/delete/delete.go b/internal/cmd/network/delete/delete.go index 4cb4410be..1f3b00b95 100644 --- a/internal/cmd/network/delete/delete.go +++ b/internal/cmd/network/delete/delete.go @@ -66,12 +66,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { networkLabel = model.NetworkId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete network %q?", networkLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete network %q?", networkLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/network/update/update.go b/internal/cmd/network/update/update.go index 6a752b5e1..13e7e5acc 100644 --- a/internal/cmd/network/update/update.go +++ b/internal/cmd/network/update/update.go @@ -93,12 +93,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { networkLabel = model.NetworkId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update network %q?", networkLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update network %q?", networkLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/object-storage/bucket/create/create.go b/internal/cmd/object-storage/bucket/create/create.go index a3409a6a5..9b8aae9a3 100644 --- a/internal/cmd/object-storage/bucket/create/create.go +++ b/internal/cmd/object-storage/bucket/create/create.go @@ -53,12 +53,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create bucket %q? (This cannot be undone)", model.BucketName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create bucket %q? (This cannot be undone)", model.BucketName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Check if the project is enabled before trying to create diff --git a/internal/cmd/object-storage/bucket/delete/delete.go b/internal/cmd/object-storage/bucket/delete/delete.go index 010aa121e..c06e88718 100644 --- a/internal/cmd/object-storage/bucket/delete/delete.go +++ b/internal/cmd/object-storage/bucket/delete/delete.go @@ -52,12 +52,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete bucket %q? (This cannot be undone)", model.BucketName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete bucket %q? (This cannot be undone)", model.BucketName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/object-storage/credentials-group/create/create.go b/internal/cmd/object-storage/credentials-group/create/create.go index 2081d3550..9150b98fe 100644 --- a/internal/cmd/object-storage/credentials-group/create/create.go +++ b/internal/cmd/object-storage/credentials-group/create/create.go @@ -52,12 +52,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a credentials group with name %q?", model.CredentialsGroupName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a credentials group with name %q?", model.CredentialsGroupName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/object-storage/credentials-group/delete/delete.go b/internal/cmd/object-storage/credentials-group/delete/delete.go index aad80623e..79daa26b3 100644 --- a/internal/cmd/object-storage/credentials-group/delete/delete.go +++ b/internal/cmd/object-storage/credentials-group/delete/delete.go @@ -58,12 +58,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { credentialsGroupLabel = model.CredentialsGroupId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete credentials group %q? (This cannot be undone)", credentialsGroupLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete credentials group %q? (This cannot be undone)", credentialsGroupLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/object-storage/credentials/create/create.go b/internal/cmd/object-storage/credentials/create/create.go index ef75cac78..c970dcb21 100644 --- a/internal/cmd/object-storage/credentials/create/create.go +++ b/internal/cmd/object-storage/credentials/create/create.go @@ -66,12 +66,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { credentialsGroupLabel = model.CredentialsGroupId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create credentials in group %q?", credentialsGroupLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create credentials in group %q?", credentialsGroupLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/object-storage/credentials/delete/delete.go b/internal/cmd/object-storage/credentials/delete/delete.go index c8f1c63d8..84a3b363b 100644 --- a/internal/cmd/object-storage/credentials/delete/delete.go +++ b/internal/cmd/object-storage/credentials/delete/delete.go @@ -65,12 +65,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { credentialsLabel = model.CredentialsId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete credentials %q of credentials group %q? (This cannot be undone)", credentialsLabel, credentialsGroupLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete credentials %q of credentials group %q? (This cannot be undone)", credentialsLabel, credentialsGroupLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/object-storage/disable/disable.go b/internal/cmd/object-storage/disable/disable.go index 0272151f4..e7b0f501b 100644 --- a/internal/cmd/object-storage/disable/disable.go +++ b/internal/cmd/object-storage/disable/disable.go @@ -52,12 +52,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to disable Object Storage for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to disable Object Storage for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/object-storage/enable/enable.go b/internal/cmd/object-storage/enable/enable.go index c135a1212..bd5304493 100644 --- a/internal/cmd/object-storage/enable/enable.go +++ b/internal/cmd/object-storage/enable/enable.go @@ -52,12 +52,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to enable Object Storage for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to enable Object Storage for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/observability/credentials/create/create.go b/internal/cmd/observability/credentials/create/create.go index a3ef3f615..12ff53649 100644 --- a/internal/cmd/observability/credentials/create/create.go +++ b/internal/cmd/observability/credentials/create/create.go @@ -61,12 +61,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create credentials for instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create credentials for instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/observability/credentials/delete/delete.go b/internal/cmd/observability/credentials/delete/delete.go index 86617ab82..a28888dc9 100644 --- a/internal/cmd/observability/credentials/delete/delete.go +++ b/internal/cmd/observability/credentials/delete/delete.go @@ -61,12 +61,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete credentials for username %q of instance %q? (This cannot be undone)", model.Username, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete credentials for username %q of instance %q? (This cannot be undone)", model.Username, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/observability/grafana/public-read-access/disable/disable.go b/internal/cmd/observability/grafana/public-read-access/disable/disable.go index 4f63f776f..70a3ff85b 100644 --- a/internal/cmd/observability/grafana/public-read-access/disable/disable.go +++ b/internal/cmd/observability/grafana/public-read-access/disable/disable.go @@ -60,12 +60,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to disable Grafana public read access for instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to disable Grafana public read access for instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/observability/grafana/public-read-access/enable/enable.go b/internal/cmd/observability/grafana/public-read-access/enable/enable.go index 87a79cfd8..04f9eabf2 100644 --- a/internal/cmd/observability/grafana/public-read-access/enable/enable.go +++ b/internal/cmd/observability/grafana/public-read-access/enable/enable.go @@ -60,12 +60,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to enable Grafana public read access for instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to enable Grafana public read access for instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/observability/grafana/single-sign-on/disable/disable.go b/internal/cmd/observability/grafana/single-sign-on/disable/disable.go index 806bd02d0..57d7d7b8b 100644 --- a/internal/cmd/observability/grafana/single-sign-on/disable/disable.go +++ b/internal/cmd/observability/grafana/single-sign-on/disable/disable.go @@ -60,12 +60,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to disable single sign-on for Grafana for instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to disable single sign-on for Grafana for instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/observability/grafana/single-sign-on/enable/enable.go b/internal/cmd/observability/grafana/single-sign-on/enable/enable.go index fa8f7f6de..3aca5bbe8 100644 --- a/internal/cmd/observability/grafana/single-sign-on/enable/enable.go +++ b/internal/cmd/observability/grafana/single-sign-on/enable/enable.go @@ -60,12 +60,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to enable single sign-on for Grafana for instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to enable single sign-on for Grafana for instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/observability/instance/create/create.go b/internal/cmd/observability/instance/create/create.go index 23c4bc51a..c492902e5 100644 --- a/internal/cmd/observability/instance/create/create.go +++ b/internal/cmd/observability/instance/create/create.go @@ -71,12 +71,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create an Observability instance for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create an Observability instance for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/observability/instance/delete/delete.go b/internal/cmd/observability/instance/delete/delete.go index b06179e6c..0aec201da 100644 --- a/internal/cmd/observability/instance/delete/delete.go +++ b/internal/cmd/observability/instance/delete/delete.go @@ -60,12 +60,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/observability/instance/update/update.go b/internal/cmd/observability/instance/update/update.go index c97eb98ba..51d0b9f56 100644 --- a/internal/cmd/observability/instance/update/update.go +++ b/internal/cmd/observability/instance/update/update.go @@ -76,12 +76,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/observability/scrape-config/create/create.go b/internal/cmd/observability/scrape-config/create/create.go index c4e8a4dac..f3e9a0515 100644 --- a/internal/cmd/observability/scrape-config/create/create.go +++ b/internal/cmd/observability/scrape-config/create/create.go @@ -89,12 +89,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { model.Payload = &defaultPayload } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create scrape configuration %q on Observability instance %q?", *model.Payload.JobName, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create scrape configuration %q on Observability instance %q?", *model.Payload.JobName, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/observability/scrape-config/delete/delete.go b/internal/cmd/observability/scrape-config/delete/delete.go index ceae80ac5..4cd15229b 100644 --- a/internal/cmd/observability/scrape-config/delete/delete.go +++ b/internal/cmd/observability/scrape-config/delete/delete.go @@ -63,12 +63,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete scrape configuration %q on Observability instance %q? (This cannot be undone)", model.JobName, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete scrape configuration %q on Observability instance %q? (This cannot be undone)", model.JobName, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/observability/scrape-config/update/update.go b/internal/cmd/observability/scrape-config/update/update.go index 3556e6620..130199713 100644 --- a/internal/cmd/observability/scrape-config/update/update.go +++ b/internal/cmd/observability/scrape-config/update/update.go @@ -69,12 +69,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update scrape configuration %q?", model.JobName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update scrape configuration %q?", model.JobName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/opensearch/credentials/create/create.go b/internal/cmd/opensearch/credentials/create/create.go index f44215219..06c5b87dd 100644 --- a/internal/cmd/opensearch/credentials/create/create.go +++ b/internal/cmd/opensearch/credentials/create/create.go @@ -63,12 +63,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create credentials for instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create credentials for instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/opensearch/credentials/delete/delete.go b/internal/cmd/opensearch/credentials/delete/delete.go index d8b57c185..236b9c626 100644 --- a/internal/cmd/opensearch/credentials/delete/delete.go +++ b/internal/cmd/opensearch/credentials/delete/delete.go @@ -68,12 +68,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { credentialsLabel = model.CredentialsId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete credentials %s of instance %q? (This cannot be undone)", credentialsLabel, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete credentials %s of instance %q? (This cannot be undone)", credentialsLabel, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/opensearch/instance/create/create.go b/internal/cmd/opensearch/instance/create/create.go index 91fe825c8..bc03d82dd 100644 --- a/internal/cmd/opensearch/instance/create/create.go +++ b/internal/cmd/opensearch/instance/create/create.go @@ -93,12 +93,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create an OpenSearch instance for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create an OpenSearch instance for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/opensearch/instance/delete/delete.go b/internal/cmd/opensearch/instance/delete/delete.go index 31983b4a5..e1cc328fb 100644 --- a/internal/cmd/opensearch/instance/delete/delete.go +++ b/internal/cmd/opensearch/instance/delete/delete.go @@ -60,12 +60,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/opensearch/instance/update/update.go b/internal/cmd/opensearch/instance/update/update.go index fab2792f0..aa9b90eb5 100644 --- a/internal/cmd/opensearch/instance/update/update.go +++ b/internal/cmd/opensearch/instance/update/update.go @@ -91,12 +91,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/organization/member/add/add.go b/internal/cmd/organization/member/add/add.go index f41eaa06d..db8754c5f 100644 --- a/internal/cmd/organization/member/add/add.go +++ b/internal/cmd/organization/member/add/add.go @@ -58,12 +58,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to add the %s role to %s on organization with ID %q?", *model.Role, model.Subject, *model.OrganizationId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to add the %s role to %s on organization with ID %q?", *model.Role, model.Subject, *model.OrganizationId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Configure API client diff --git a/internal/cmd/organization/member/remove/remove.go b/internal/cmd/organization/member/remove/remove.go index f0d5ee13c..27e95be67 100644 --- a/internal/cmd/organization/member/remove/remove.go +++ b/internal/cmd/organization/member/remove/remove.go @@ -68,15 +68,13 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to remove the %s role from %s on organization with ID %q?", *model.Role, model.Subject, *model.OrganizationId) - if model.Force { - prompt = fmt.Sprintf("%s This will also remove other roles of the subject that would stop the removal of the requested role", prompt) - } - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to remove the %s role from %s on organization with ID %q?", *model.Role, model.Subject, *model.OrganizationId) + if model.Force { + prompt = fmt.Sprintf("%s This will also remove other roles of the subject that would stop the removal of the requested role", prompt) + } + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/postgresflex/backup/update-schedule/update_schedule.go b/internal/cmd/postgresflex/backup/update-schedule/update_schedule.go index 5e954322e..16bb967fe 100644 --- a/internal/cmd/postgresflex/backup/update-schedule/update_schedule.go +++ b/internal/cmd/postgresflex/backup/update-schedule/update_schedule.go @@ -62,12 +62,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = *model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update backup schedule of instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update backup schedule of instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/postgresflex/instance/clone/clone.go b/internal/cmd/postgresflex/instance/clone/clone.go index 9c72a9874..d9a784d2a 100644 --- a/internal/cmd/postgresflex/instance/clone/clone.go +++ b/internal/cmd/postgresflex/instance/clone/clone.go @@ -78,12 +78,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to clone instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to clone instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/postgresflex/instance/create/create.go b/internal/cmd/postgresflex/instance/create/create.go index de9106998..8359ad2f7 100644 --- a/internal/cmd/postgresflex/instance/create/create.go +++ b/internal/cmd/postgresflex/instance/create/create.go @@ -94,12 +94,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a PostgreSQL Flex instance for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a PostgreSQL Flex instance for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Fill in version, if needed diff --git a/internal/cmd/postgresflex/instance/delete/delete.go b/internal/cmd/postgresflex/instance/delete/delete.go index 56401d564..2108d31c3 100644 --- a/internal/cmd/postgresflex/instance/delete/delete.go +++ b/internal/cmd/postgresflex/instance/delete/delete.go @@ -71,12 +71,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } toDelete, toForceDelete, err := getNextOperations(ctx, model, apiClient) diff --git a/internal/cmd/postgresflex/instance/update/update.go b/internal/cmd/postgresflex/instance/update/update.go index 821d10b1c..8623a78f4 100644 --- a/internal/cmd/postgresflex/instance/update/update.go +++ b/internal/cmd/postgresflex/instance/update/update.go @@ -88,12 +88,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update instance %q? (This may cause downtime)", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update instance %q? (This may cause downtime)", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/postgresflex/user/create/create.go b/internal/cmd/postgresflex/user/create/create.go index 7623ba786..fc53b1f07 100644 --- a/internal/cmd/postgresflex/user/create/create.go +++ b/internal/cmd/postgresflex/user/create/create.go @@ -75,12 +75,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a user for instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a user for instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/postgresflex/user/delete/delete.go b/internal/cmd/postgresflex/user/delete/delete.go index 219798121..d3646805a 100644 --- a/internal/cmd/postgresflex/user/delete/delete.go +++ b/internal/cmd/postgresflex/user/delete/delete.go @@ -72,12 +72,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { userLabel = model.UserId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete user %q of instance %q? (This cannot be undone)", userLabel, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete user %q of instance %q? (This cannot be undone)", userLabel, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/postgresflex/user/reset-password/reset_password.go b/internal/cmd/postgresflex/user/reset-password/reset_password.go index 3c78d191f..c899b5659 100644 --- a/internal/cmd/postgresflex/user/reset-password/reset_password.go +++ b/internal/cmd/postgresflex/user/reset-password/reset_password.go @@ -71,12 +71,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { userLabel = model.UserId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to reset the password of user %q of instance %q? (This cannot be undone)", userLabel, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to reset the password of user %q of instance %q? (This cannot be undone)", userLabel, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/postgresflex/user/update/update.go b/internal/cmd/postgresflex/user/update/update.go index 3ebb2231f..fa8d8e445 100644 --- a/internal/cmd/postgresflex/user/update/update.go +++ b/internal/cmd/postgresflex/user/update/update.go @@ -70,12 +70,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { userLabel = model.UserId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update user %q of instance %q?", userLabel, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update user %q of instance %q?", userLabel, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/project/create/create.go b/internal/cmd/project/create/create.go index e00210b71..c18e083fc 100644 --- a/internal/cmd/project/create/create.go +++ b/internal/cmd/project/create/create.go @@ -77,12 +77,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a project under the parent with ID %q?", *model.ParentId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a project under the parent with ID %q?", *model.ParentId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/project/delete/delete.go b/internal/cmd/project/delete/delete.go index 314fb621e..14de5b63f 100644 --- a/internal/cmd/project/delete/delete.go +++ b/internal/cmd/project/delete/delete.go @@ -55,12 +55,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete the project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete the project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/project/member/add/add.go b/internal/cmd/project/member/add/add.go index d08437440..0901fba52 100644 --- a/internal/cmd/project/member/add/add.go +++ b/internal/cmd/project/member/add/add.go @@ -71,12 +71,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to add the role %q to %s on project %q?", *model.Role, model.Subject, projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to add the role %q to %s on project %q?", *model.Role, model.Subject, projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/project/member/remove/remove.go b/internal/cmd/project/member/remove/remove.go index 8b7089283..70a7c46d6 100644 --- a/internal/cmd/project/member/remove/remove.go +++ b/internal/cmd/project/member/remove/remove.go @@ -74,15 +74,13 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to remove the role %q from %s on project %q?", *model.Role, model.Subject, projectLabel) - if model.Force { - prompt = fmt.Sprintf("%s This will also remove other roles of the subject that would stop the removal of the requested role", prompt) - } - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to remove the role %q from %s on project %q?", *model.Role, model.Subject, projectLabel) + if model.Force { + prompt = fmt.Sprintf("%s This will also remove other roles of the subject that would stop the removal of the requested role", prompt) + } + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/project/update/update.go b/internal/cmd/project/update/update.go index 37e799a36..a0ee9ae4f 100644 --- a/internal/cmd/project/update/update.go +++ b/internal/cmd/project/update/update.go @@ -74,12 +74,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/public-ip/associate/associate.go b/internal/cmd/public-ip/associate/associate.go index a3ed8cc0e..357a6c87f 100644 --- a/internal/cmd/public-ip/associate/associate.go +++ b/internal/cmd/public-ip/associate/associate.go @@ -65,12 +65,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { publicIpLabel = model.PublicIpId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to associate public IP %q with resource %v?", publicIpLabel, *model.AssociatedResourceId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to associate public IP %q with resource %v?", publicIpLabel, *model.AssociatedResourceId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/public-ip/create/create.go b/internal/cmd/public-ip/create/create.go index a467529d9..a13574190 100644 --- a/internal/cmd/public-ip/create/create.go +++ b/internal/cmd/public-ip/create/create.go @@ -71,12 +71,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a public IP for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a public IP for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/public-ip/delete/delete.go b/internal/cmd/public-ip/delete/delete.go index 4cbcd1094..2bf9c234f 100644 --- a/internal/cmd/public-ip/delete/delete.go +++ b/internal/cmd/public-ip/delete/delete.go @@ -63,12 +63,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { publicIpLabel = model.PublicIpId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete public IP %q? (This cannot be undone)", publicIpLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete public IP %q? (This cannot be undone)", publicIpLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/public-ip/disassociate/disassociate.go b/internal/cmd/public-ip/disassociate/disassociate.go index 69a5dc77d..7df01b637 100644 --- a/internal/cmd/public-ip/disassociate/disassociate.go +++ b/internal/cmd/public-ip/disassociate/disassociate.go @@ -61,12 +61,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { publicIpLabel = model.PublicIpId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to disassociate public IP %q from the associated resource %q?", publicIpLabel, associatedResourceId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to disassociate public IP %q from the associated resource %q?", publicIpLabel, associatedResourceId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/public-ip/update/update.go b/internal/cmd/public-ip/update/update.go index df2687a76..8fb1d8a77 100644 --- a/internal/cmd/public-ip/update/update.go +++ b/internal/cmd/public-ip/update/update.go @@ -66,12 +66,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { publicIpLabel = model.PublicIpId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update public IP %q?", publicIpLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update public IP %q?", publicIpLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/rabbitmq/credentials/create/create.go b/internal/cmd/rabbitmq/credentials/create/create.go index 9c43e2ca1..3aeea6efe 100644 --- a/internal/cmd/rabbitmq/credentials/create/create.go +++ b/internal/cmd/rabbitmq/credentials/create/create.go @@ -63,12 +63,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create credentials for instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create credentials for instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/rabbitmq/credentials/delete/delete.go b/internal/cmd/rabbitmq/credentials/delete/delete.go index 7dcd75143..a30d2e9d0 100644 --- a/internal/cmd/rabbitmq/credentials/delete/delete.go +++ b/internal/cmd/rabbitmq/credentials/delete/delete.go @@ -68,12 +68,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { credentialsLabel = model.CredentialsId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete credentials %s of instance %q? (This cannot be undone)", credentialsLabel, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete credentials %s of instance %q? (This cannot be undone)", credentialsLabel, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/rabbitmq/instance/create/create.go b/internal/cmd/rabbitmq/instance/create/create.go index 2778e082a..1ac8e7cc2 100644 --- a/internal/cmd/rabbitmq/instance/create/create.go +++ b/internal/cmd/rabbitmq/instance/create/create.go @@ -93,12 +93,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create an RabbitMQ instance for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create an RabbitMQ instance for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/rabbitmq/instance/delete/delete.go b/internal/cmd/rabbitmq/instance/delete/delete.go index 8be4dacfb..766ced827 100644 --- a/internal/cmd/rabbitmq/instance/delete/delete.go +++ b/internal/cmd/rabbitmq/instance/delete/delete.go @@ -60,12 +60,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/rabbitmq/instance/update/update.go b/internal/cmd/rabbitmq/instance/update/update.go index f2a87e12b..d3cf53603 100644 --- a/internal/cmd/rabbitmq/instance/update/update.go +++ b/internal/cmd/rabbitmq/instance/update/update.go @@ -91,12 +91,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/redis/credentials/create/create.go b/internal/cmd/redis/credentials/create/create.go index c7793c1c7..a3e3e8e63 100644 --- a/internal/cmd/redis/credentials/create/create.go +++ b/internal/cmd/redis/credentials/create/create.go @@ -64,12 +64,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create credentials for instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create credentials for instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/redis/credentials/delete/delete.go b/internal/cmd/redis/credentials/delete/delete.go index 2209c45b1..496a43dd2 100644 --- a/internal/cmd/redis/credentials/delete/delete.go +++ b/internal/cmd/redis/credentials/delete/delete.go @@ -68,12 +68,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { credentialsLabel = model.CredentialsId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete credentials %s of instance %q? (This cannot be undone)", credentialsLabel, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete credentials %s of instance %q? (This cannot be undone)", credentialsLabel, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/redis/instance/create/create.go b/internal/cmd/redis/instance/create/create.go index f6b4d050c..8993b98ca 100644 --- a/internal/cmd/redis/instance/create/create.go +++ b/internal/cmd/redis/instance/create/create.go @@ -91,12 +91,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a Redis instance for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a Redis instance for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/redis/instance/delete/delete.go b/internal/cmd/redis/instance/delete/delete.go index 1b314ea33..0c8124906 100644 --- a/internal/cmd/redis/instance/delete/delete.go +++ b/internal/cmd/redis/instance/delete/delete.go @@ -60,12 +60,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/redis/instance/update/update.go b/internal/cmd/redis/instance/update/update.go index 98b192ad6..3fcc2e7b4 100644 --- a/internal/cmd/redis/instance/update/update.go +++ b/internal/cmd/redis/instance/update/update.go @@ -88,12 +88,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/root.go b/internal/cmd/root.go index 33b38ebfa..ccb1b9f5a 100644 --- a/internal/cmd/root.go +++ b/internal/cmd/root.go @@ -62,7 +62,9 @@ func NewRootCmd(version, date string, p *print.Printer) *cobra.Command { DisableAutoGenTag: true, PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { p.Cmd = cmd - p.Verbosity = print.Level(globalflags.Parse(p, cmd).Verbosity) + globalFlags := globalflags.Parse(p, cmd) + p.Verbosity = print.Level(globalFlags.Verbosity) + p.AssumeYes = globalFlags.AssumeYes argsString := print.BuildDebugStrFromSlice(os.Args) p.Debug(print.DebugLevel, "arguments: %s", argsString) @@ -209,6 +211,7 @@ func Execute(version, date string) { // We need to set the printer and verbosity here because the // PersistentPreRun is not called when the command is wrongly called + // In this case Printer.AssumeYes isn't set either, but `false` as default is acceptable p.Cmd = cmd p.Verbosity = print.InfoLevel diff --git a/internal/cmd/secrets-manager/instance/create/create.go b/internal/cmd/secrets-manager/instance/create/create.go index abc0bb5f2..0c6d8420b 100644 --- a/internal/cmd/secrets-manager/instance/create/create.go +++ b/internal/cmd/secrets-manager/instance/create/create.go @@ -66,12 +66,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a Secrets Manager instance for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a Secrets Manager instance for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API to create instance diff --git a/internal/cmd/secrets-manager/instance/delete/delete.go b/internal/cmd/secrets-manager/instance/delete/delete.go index ec8148e34..94ed3385a 100644 --- a/internal/cmd/secrets-manager/instance/delete/delete.go +++ b/internal/cmd/secrets-manager/instance/delete/delete.go @@ -57,12 +57,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete instance %q? (This cannot be undone)", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/secrets-manager/instance/update/update.go b/internal/cmd/secrets-manager/instance/update/update.go index c3cfb5956..58786ffd6 100644 --- a/internal/cmd/secrets-manager/instance/update/update.go +++ b/internal/cmd/secrets-manager/instance/update/update.go @@ -64,12 +64,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/secrets-manager/user/create/create.go b/internal/cmd/secrets-manager/user/create/create.go index eba0d736b..1584b5cf5 100644 --- a/internal/cmd/secrets-manager/user/create/create.go +++ b/internal/cmd/secrets-manager/user/create/create.go @@ -71,12 +71,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { instanceLabel = model.InstanceId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a user for instance %q?", instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a user for instance %q?", instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/secrets-manager/user/delete/delete.go b/internal/cmd/secrets-manager/user/delete/delete.go index e2ad75eb5..65193fac3 100644 --- a/internal/cmd/secrets-manager/user/delete/delete.go +++ b/internal/cmd/secrets-manager/user/delete/delete.go @@ -72,12 +72,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { userLabel = fmt.Sprintf("%q", model.UserId) } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete user %s of instance %q? (This cannot be undone)", userLabel, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete user %s of instance %q? (This cannot be undone)", userLabel, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/secrets-manager/user/update/update.go b/internal/cmd/secrets-manager/user/update/update.go index 31a8e5a6e..38507699b 100644 --- a/internal/cmd/secrets-manager/user/update/update.go +++ b/internal/cmd/secrets-manager/user/update/update.go @@ -76,12 +76,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { userLabel = fmt.Sprintf("%q", model.UserId) } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update user %s of instance %q?", userLabel, instanceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update user %s of instance %q?", userLabel, instanceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/security-group/create/create.go b/internal/cmd/security-group/create/create.go index b5e7143a2..5c52d133a 100644 --- a/internal/cmd/security-group/create/create.go +++ b/internal/cmd/security-group/create/create.go @@ -56,12 +56,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create the security group %q?", *model.Name) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create the security group %q?", *model.Name) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/security-group/delete/delete.go b/internal/cmd/security-group/delete/delete.go index 37c0b283c..1950d712b 100644 --- a/internal/cmd/security-group/delete/delete.go +++ b/internal/cmd/security-group/delete/delete.go @@ -60,12 +60,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { groupLabel = model.SecurityGroupId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete the security group %q for %q?", groupLabel, projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete the security group %q for %q?", groupLabel, projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/security-group/rule/create/create.go b/internal/cmd/security-group/rule/create/create.go index 5e08c09b0..b2f443ace 100644 --- a/internal/cmd/security-group/rule/create/create.go +++ b/internal/cmd/security-group/rule/create/create.go @@ -101,12 +101,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { securityGroupLabel = model.SecurityGroupId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a security group rule for security group %q for project %q?", securityGroupLabel, projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a security group rule for security group %q for project %q?", securityGroupLabel, projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/security-group/rule/delete/delete.go b/internal/cmd/security-group/rule/delete/delete.go index 722142f9d..388e3b0b7 100644 --- a/internal/cmd/security-group/rule/delete/delete.go +++ b/internal/cmd/security-group/rule/delete/delete.go @@ -71,12 +71,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { securityGroupRuleLabel = model.SecurityGroupRuleId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete security group rule %q from security group %q?", securityGroupRuleLabel, securityGroupLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete security group rule %q from security group %q?", securityGroupRuleLabel, securityGroupLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/security-group/update/update.go b/internal/cmd/security-group/update/update.go index 5a5039fa9..6f612f744 100644 --- a/internal/cmd/security-group/update/update.go +++ b/internal/cmd/security-group/update/update.go @@ -71,12 +71,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { groupLabel = model.SecurityGroupId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update the security group %q?", groupLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update the security group %q?", groupLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/backup/create/create.go b/internal/cmd/server/backup/create/create.go index c2ab4b028..50b36dce4 100644 --- a/internal/cmd/server/backup/create/create.go +++ b/internal/cmd/server/backup/create/create.go @@ -79,12 +79,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { } } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a Backup for server %s?", model.ServerId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a Backup for server %s?", model.ServerId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/backup/delete/delete.go b/internal/cmd/server/backup/delete/delete.go index e4cb8118d..5eedcde2d 100644 --- a/internal/cmd/server/backup/delete/delete.go +++ b/internal/cmd/server/backup/delete/delete.go @@ -54,12 +54,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete server backup %q? (This cannot be undone)", model.BackupId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete server backup %q? (This cannot be undone)", model.BackupId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/backup/disable/disable.go b/internal/cmd/server/backup/disable/disable.go index a9cc28ac4..4aecf6553 100644 --- a/internal/cmd/server/backup/disable/disable.go +++ b/internal/cmd/server/backup/disable/disable.go @@ -74,12 +74,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return nil } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to disable the backup service for server %s?", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to disable the backup service for server %s?", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/backup/enable/enable.go b/internal/cmd/server/backup/enable/enable.go index 419d54076..7f6854be3 100644 --- a/internal/cmd/server/backup/enable/enable.go +++ b/internal/cmd/server/backup/enable/enable.go @@ -65,12 +65,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { } } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to enable the Server Backup service for server %s?", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to enable the Server Backup service for server %s?", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/backup/restore/restore.go b/internal/cmd/server/backup/restore/restore.go index 8d3899dd5..b55b2b465 100644 --- a/internal/cmd/server/backup/restore/restore.go +++ b/internal/cmd/server/backup/restore/restore.go @@ -63,12 +63,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to restore server backup %q? (This cannot be undone)", model.BackupId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to restore server backup %q? (This cannot be undone)", model.BackupId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/backup/schedule/create/create.go b/internal/cmd/server/backup/schedule/create/create.go index 9f113f0e6..6b722c0b0 100644 --- a/internal/cmd/server/backup/schedule/create/create.go +++ b/internal/cmd/server/backup/schedule/create/create.go @@ -87,12 +87,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { } } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a Backup Schedule for server %s?", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a Backup Schedule for server %s?", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/backup/schedule/delete/delete.go b/internal/cmd/server/backup/schedule/delete/delete.go index 498f7cacd..42e4c07ef 100644 --- a/internal/cmd/server/backup/schedule/delete/delete.go +++ b/internal/cmd/server/backup/schedule/delete/delete.go @@ -66,12 +66,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { } } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete server backup schedule %q? (This cannot be undone)", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete server backup schedule %q? (This cannot be undone)", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/backup/schedule/update/update.go b/internal/cmd/server/backup/schedule/update/update.go index 3a54a12eb..d16db4d63 100644 --- a/internal/cmd/server/backup/schedule/update/update.go +++ b/internal/cmd/server/backup/schedule/update/update.go @@ -82,12 +82,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update Server Backup Schedule %q?", model.BackupScheduleId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update Server Backup Schedule %q?", model.BackupScheduleId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/backup/volume-backup/delete/delete.go b/internal/cmd/server/backup/volume-backup/delete/delete.go index f13d85633..1a7241bba 100644 --- a/internal/cmd/server/backup/volume-backup/delete/delete.go +++ b/internal/cmd/server/backup/volume-backup/delete/delete.go @@ -56,12 +56,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete server volume backup %q? (This cannot be undone)", model.VolumeId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete server volume backup %q? (This cannot be undone)", model.VolumeId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/backup/volume-backup/restore/restore.go b/internal/cmd/server/backup/volume-backup/restore/restore.go index 676b5135e..343f4ade8 100644 --- a/internal/cmd/server/backup/volume-backup/restore/restore.go +++ b/internal/cmd/server/backup/volume-backup/restore/restore.go @@ -58,12 +58,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to restore volume backup %q? (This cannot be undone)", model.VolumeBackupId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to restore volume backup %q? (This cannot be undone)", model.VolumeBackupId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/command/create/create.go b/internal/cmd/server/command/create/create.go index 1937f4e28..1561ab3b5 100644 --- a/internal/cmd/server/command/create/create.go +++ b/internal/cmd/server/command/create/create.go @@ -75,12 +75,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { } } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a Command for server %s?", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a Command for server %s?", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/create/create.go b/internal/cmd/server/create/create.go index 86f0af5dc..a93efcbf7 100644 --- a/internal/cmd/server/create/create.go +++ b/internal/cmd/server/create/create.go @@ -128,12 +128,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a server for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a server for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/deallocate/deallocate.go b/internal/cmd/server/deallocate/deallocate.go index 9c8d7971c..bed42bf7a 100644 --- a/internal/cmd/server/deallocate/deallocate.go +++ b/internal/cmd/server/deallocate/deallocate.go @@ -63,12 +63,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { serverLabel = model.ServerId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to deallocate server %q?", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to deallocate server %q?", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/delete/delete.go b/internal/cmd/server/delete/delete.go index 85c264b5e..412c099dc 100644 --- a/internal/cmd/server/delete/delete.go +++ b/internal/cmd/server/delete/delete.go @@ -66,12 +66,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { serverLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete server %q?", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete server %q?", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/network-interface/attach/attach.go b/internal/cmd/server/network-interface/attach/attach.go index 3e98a366e..5bcf7ed6d 100644 --- a/internal/cmd/server/network-interface/attach/attach.go +++ b/internal/cmd/server/network-interface/attach/attach.go @@ -78,13 +78,12 @@ func NewCmd(params *types.CmdParams) *cobra.Command { params.Printer.Debug(print.ErrorLevel, "get network name: %v", err) networkLabel = *model.NetworkId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a network interface for network %q and attach it to server %q?", networkLabel, serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a network interface for network %q and attach it to server %q?", networkLabel, serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } + // Call API req := buildRequestCreateAndAttach(ctx, model, apiClient) err = req.Execute() @@ -95,13 +94,12 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return nil } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to attach network interface %q to server %q?", *model.NicId, serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to attach network interface %q to server %q?", *model.NicId, serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } + // Call API req := buildRequestAttach(ctx, model, apiClient) err = req.Execute() diff --git a/internal/cmd/server/network-interface/detach/detach.go b/internal/cmd/server/network-interface/detach/detach.go index 1e8babe16..ed891e912 100644 --- a/internal/cmd/server/network-interface/detach/detach.go +++ b/internal/cmd/server/network-interface/detach/detach.go @@ -80,13 +80,12 @@ func NewCmd(params *types.CmdParams) *cobra.Command { params.Printer.Debug(print.ErrorLevel, "get network name: %v", err) networkLabel = *model.NetworkId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to detach and delete all network interfaces of network %q from server %q? (This cannot be undone)", networkLabel, serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to detach and delete all network interfaces of network %q from server %q? (This cannot be undone)", networkLabel, serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } + // Call API req := buildRequestDetachAndDelete(ctx, model, apiClient) err = req.Execute() @@ -97,13 +96,12 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return nil } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to detach network interface %q from server %q?", *model.NicId, serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to detach network interface %q from server %q?", *model.NicId, serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } + // Call API req := buildRequestDetach(ctx, model, apiClient) err = req.Execute() diff --git a/internal/cmd/server/os-update/create/create.go b/internal/cmd/server/os-update/create/create.go index eac250845..1d1ad8962 100644 --- a/internal/cmd/server/os-update/create/create.go +++ b/internal/cmd/server/os-update/create/create.go @@ -74,12 +74,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { } } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a os-update for server %s?", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a os-update for server %s?", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/os-update/disable/disable.go b/internal/cmd/server/os-update/disable/disable.go index c0cc0bb8d..c2a308710 100644 --- a/internal/cmd/server/os-update/disable/disable.go +++ b/internal/cmd/server/os-update/disable/disable.go @@ -64,12 +64,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { } } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to disable the os-update service for server %s?", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to disable the os-update service for server %s?", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/os-update/enable/enable.go b/internal/cmd/server/os-update/enable/enable.go index 5e25334bb..0d4630c45 100644 --- a/internal/cmd/server/os-update/enable/enable.go +++ b/internal/cmd/server/os-update/enable/enable.go @@ -65,12 +65,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { } } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to enable the server os-update service for server %s?", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to enable the server os-update service for server %s?", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/os-update/schedule/create/create.go b/internal/cmd/server/os-update/schedule/create/create.go index 446859534..421a173c6 100644 --- a/internal/cmd/server/os-update/schedule/create/create.go +++ b/internal/cmd/server/os-update/schedule/create/create.go @@ -82,12 +82,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { } } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a os-update Schedule for server %s?", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a os-update Schedule for server %s?", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/os-update/schedule/delete/delete.go b/internal/cmd/server/os-update/schedule/delete/delete.go index de1d19d3e..b26084c9a 100644 --- a/internal/cmd/server/os-update/schedule/delete/delete.go +++ b/internal/cmd/server/os-update/schedule/delete/delete.go @@ -53,12 +53,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete server os-update schedule %q? (This cannot be undone)", model.ScheduleId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete server os-update schedule %q? (This cannot be undone)", model.ScheduleId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/os-update/schedule/update/update.go b/internal/cmd/server/os-update/schedule/update/update.go index 59ca210b1..72c3f92f4 100644 --- a/internal/cmd/server/os-update/schedule/update/update.go +++ b/internal/cmd/server/os-update/schedule/update/update.go @@ -74,12 +74,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update Server os-update Schedule %q?", model.ScheduleId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update Server os-update Schedule %q?", model.ScheduleId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/public-ip/attach/attach.go b/internal/cmd/server/public-ip/attach/attach.go index 52ef99867..7532eac13 100644 --- a/internal/cmd/server/public-ip/attach/attach.go +++ b/internal/cmd/server/public-ip/attach/attach.go @@ -71,12 +71,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { serverLabel = model.ServerId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to attach public IP %q to server %q?", publicIpLabel, serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to attach public IP %q to server %q?", publicIpLabel, serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/public-ip/detach/detach.go b/internal/cmd/server/public-ip/detach/detach.go index adfa2ad47..8c85195e9 100644 --- a/internal/cmd/server/public-ip/detach/detach.go +++ b/internal/cmd/server/public-ip/detach/detach.go @@ -72,12 +72,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { serverLabel = model.ServerId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to detach public IP %q from server %q?", publicIpLabel, serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to detach public IP %q from server %q?", publicIpLabel, serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/reboot/reboot.go b/internal/cmd/server/reboot/reboot.go index 4f4b3e268..bf689cfcc 100644 --- a/internal/cmd/server/reboot/reboot.go +++ b/internal/cmd/server/reboot/reboot.go @@ -70,12 +70,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { } else if serverLabel == "" { serverLabel = model.ServerId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to reboot server %q?", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to reboot server %q?", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/rescue/rescue.go b/internal/cmd/server/rescue/rescue.go index 746fbadc4..dd77e4625 100644 --- a/internal/cmd/server/rescue/rescue.go +++ b/internal/cmd/server/rescue/rescue.go @@ -67,12 +67,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { serverLabel = model.ServerId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to rescue server %q?", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to rescue server %q?", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/resize/resize.go b/internal/cmd/server/resize/resize.go index d2a7836a2..804dbce1a 100644 --- a/internal/cmd/server/resize/resize.go +++ b/internal/cmd/server/resize/resize.go @@ -67,12 +67,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { serverLabel = model.ServerId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to resize server %q to machine type %q?", serverLabel, *model.MachineType) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to resize server %q to machine type %q?", serverLabel, *model.MachineType) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/service-account/attach/attach.go b/internal/cmd/server/service-account/attach/attach.go index 1bf853199..e7c7ea762 100644 --- a/internal/cmd/server/service-account/attach/attach.go +++ b/internal/cmd/server/service-account/attach/attach.go @@ -63,12 +63,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { serverLabel = model.ServerId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to attach service account %q to server %q?", model.ServiceAccMail, serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to attach service account %q to server %q?", model.ServiceAccMail, serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/service-account/detach/detach.go b/internal/cmd/server/service-account/detach/detach.go index ab9fbbe03..00830e7d6 100644 --- a/internal/cmd/server/service-account/detach/detach.go +++ b/internal/cmd/server/service-account/detach/detach.go @@ -63,12 +63,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { serverLabel = model.ServerId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are your sure you want to detach service account %q from a server %q?", model.ServiceAccMail, serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are your sure you want to detach service account %q from a server %q?", model.ServiceAccMail, serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/stop/stop.go b/internal/cmd/server/stop/stop.go index 07a8008c3..a7a9b4604 100644 --- a/internal/cmd/server/stop/stop.go +++ b/internal/cmd/server/stop/stop.go @@ -63,12 +63,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { serverLabel = model.ServerId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to stop server %q?", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to stop server %q?", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/unrescue/unrescue.go b/internal/cmd/server/unrescue/unrescue.go index e65d13d6e..f47ef6794 100644 --- a/internal/cmd/server/unrescue/unrescue.go +++ b/internal/cmd/server/unrescue/unrescue.go @@ -63,12 +63,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { serverLabel = model.ServerId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to unrescue server %q?", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to unrescue server %q?", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/update/update.go b/internal/cmd/server/update/update.go index 76973b91c..7349d1c28 100644 --- a/internal/cmd/server/update/update.go +++ b/internal/cmd/server/update/update.go @@ -70,12 +70,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { serverLabel = model.ServerId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update server %q?", serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update server %q?", serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/volume/attach/attach.go b/internal/cmd/server/volume/attach/attach.go index f8bf74a2f..27c734f8d 100644 --- a/internal/cmd/server/volume/attach/attach.go +++ b/internal/cmd/server/volume/attach/attach.go @@ -78,12 +78,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { serverLabel = model.ServerId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to attach volume %q to server %q?", volumeLabel, serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to attach volume %q to server %q?", volumeLabel, serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/volume/detach/detach.go b/internal/cmd/server/volume/detach/detach.go index 7ae8dee8e..0c8081a5d 100644 --- a/internal/cmd/server/volume/detach/detach.go +++ b/internal/cmd/server/volume/detach/detach.go @@ -70,12 +70,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { serverLabel = model.ServerId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to detach volume %q from server %q?", volumeLabel, serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to detach volume %q from server %q?", volumeLabel, serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/server/volume/update/update.go b/internal/cmd/server/volume/update/update.go index b3faf2d2f..4ba1a9342 100644 --- a/internal/cmd/server/volume/update/update.go +++ b/internal/cmd/server/volume/update/update.go @@ -74,12 +74,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { serverLabel = model.ServerId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update attached volume %q of server %q?", volumeLabel, serverLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update attached volume %q of server %q?", volumeLabel, serverLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/service-account/create/create.go b/internal/cmd/service-account/create/create.go index aca5c8133..8d9daf092 100644 --- a/internal/cmd/service-account/create/create.go +++ b/internal/cmd/service-account/create/create.go @@ -59,12 +59,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a service account for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a service account for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/service-account/delete/delete.go b/internal/cmd/service-account/delete/delete.go index ff843534d..eefc8a3e3 100644 --- a/internal/cmd/service-account/delete/delete.go +++ b/internal/cmd/service-account/delete/delete.go @@ -50,12 +50,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete service account %s? (This cannot be undone)", model.Email) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete service account %s? (This cannot be undone)", model.Email) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/service-account/key/create/create.go b/internal/cmd/service-account/key/create/create.go index 6af133cdc..49bdd3918 100644 --- a/internal/cmd/service-account/key/create/create.go +++ b/internal/cmd/service-account/key/create/create.go @@ -69,16 +69,14 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - validUntilInfo := "The key will be valid until deleted" - if model.ExpiresInDays != nil { - validUntilInfo = fmt.Sprintf("The key will be valid for %d days", *model.ExpiresInDays) - } - prompt := fmt.Sprintf("Are you sure you want to create a key for service account %s? %s", model.ServiceAccountEmail, validUntilInfo) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + validUntilInfo := "The key will be valid until deleted" + if model.ExpiresInDays != nil { + validUntilInfo = fmt.Sprintf("The key will be valid for %d days", *model.ExpiresInDays) + } + prompt := fmt.Sprintf("Are you sure you want to create a key for service account %s? %s", model.ServiceAccountEmail, validUntilInfo) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/service-account/key/delete/delete.go b/internal/cmd/service-account/key/delete/delete.go index b6ff682d8..c468d72a7 100644 --- a/internal/cmd/service-account/key/delete/delete.go +++ b/internal/cmd/service-account/key/delete/delete.go @@ -56,12 +56,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete the key %s from service account %s?", model.KeyId, model.ServiceAccountEmail) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete the key %s from service account %s?", model.KeyId, model.ServiceAccountEmail) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/service-account/key/update/update.go b/internal/cmd/service-account/key/update/update.go index fd5d3383a..5594396e4 100644 --- a/internal/cmd/service-account/key/update/update.go +++ b/internal/cmd/service-account/key/update/update.go @@ -73,12 +73,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update the key with ID %q?", model.KeyId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update the key with ID %q?", model.KeyId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/service-account/token/create/create.go b/internal/cmd/service-account/token/create/create.go index ea0b1f39d..a3286219b 100644 --- a/internal/cmd/service-account/token/create/create.go +++ b/internal/cmd/service-account/token/create/create.go @@ -63,12 +63,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create an access token for service account %s?", model.ServiceAccountEmail) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create an access token for service account %s?", model.ServiceAccountEmail) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/service-account/token/revoke/revoke.go b/internal/cmd/service-account/token/revoke/revoke.go index ee3c05a81..2a892e005 100644 --- a/internal/cmd/service-account/token/revoke/revoke.go +++ b/internal/cmd/service-account/token/revoke/revoke.go @@ -59,12 +59,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to revoke the access token with ID %q?", model.TokenId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to revoke the access token with ID %q?", model.TokenId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/ske/cluster/create/create.go b/internal/cmd/ske/cluster/create/create.go index 18113539b..1602e3680 100644 --- a/internal/cmd/ske/cluster/create/create.go +++ b/internal/cmd/ske/cluster/create/create.go @@ -82,12 +82,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a cluster for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a cluster for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Configure ServiceEnable API client diff --git a/internal/cmd/ske/cluster/delete/delete.go b/internal/cmd/ske/cluster/delete/delete.go index fc8b70978..34de6f2c7 100644 --- a/internal/cmd/ske/cluster/delete/delete.go +++ b/internal/cmd/ske/cluster/delete/delete.go @@ -52,12 +52,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete cluster %q? (This cannot be undone)", model.ClusterName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete cluster %q? (This cannot be undone)", model.ClusterName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/ske/cluster/hibernate/hibernate.go b/internal/cmd/ske/cluster/hibernate/hibernate.go index ce4c416e5..5e679e38b 100644 --- a/internal/cmd/ske/cluster/hibernate/hibernate.go +++ b/internal/cmd/ske/cluster/hibernate/hibernate.go @@ -57,12 +57,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to trigger hibernate for %q in project %q?", model.ClusterName, projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to trigger hibernate for %q in project %q?", model.ClusterName, projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/ske/cluster/maintenance/maintenance.go b/internal/cmd/ske/cluster/maintenance/maintenance.go index cc3c1ab1d..0b5f406ca 100644 --- a/internal/cmd/ske/cluster/maintenance/maintenance.go +++ b/internal/cmd/ske/cluster/maintenance/maintenance.go @@ -57,12 +57,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to trigger maintenance for %q in project %q?", model.ClusterName, projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to trigger maintenance for %q in project %q?", model.ClusterName, projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/ske/cluster/update/update.go b/internal/cmd/ske/cluster/update/update.go index e59fa9990..6150a9bda 100644 --- a/internal/cmd/ske/cluster/update/update.go +++ b/internal/cmd/ske/cluster/update/update.go @@ -70,12 +70,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update cluster %q?", model.ClusterName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update cluster %q?", model.ClusterName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Check if cluster exists diff --git a/internal/cmd/ske/credentials/complete-rotation/complete_rotation.go b/internal/cmd/ske/credentials/complete-rotation/complete_rotation.go index 5fc0f81bb..25f2601aa 100644 --- a/internal/cmd/ske/credentials/complete-rotation/complete_rotation.go +++ b/internal/cmd/ske/credentials/complete-rotation/complete_rotation.go @@ -69,12 +69,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to complete the rotation of the credentials for SKE cluster %q?", model.ClusterName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to complete the rotation of the credentials for SKE cluster %q?", model.ClusterName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/ske/credentials/start-rotation/start_rotation.go b/internal/cmd/ske/credentials/start-rotation/start_rotation.go index fa239775a..3cb3cee55 100644 --- a/internal/cmd/ske/credentials/start-rotation/start_rotation.go +++ b/internal/cmd/ske/credentials/start-rotation/start_rotation.go @@ -72,12 +72,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to start the rotation of the credentials for SKE cluster %q?", model.ClusterName) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to start the rotation of the credentials for SKE cluster %q?", model.ClusterName) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/ske/disable/disable.go b/internal/cmd/ske/disable/disable.go index cd2dc87db..075711b1a 100644 --- a/internal/cmd/ske/disable/disable.go +++ b/internal/cmd/ske/disable/disable.go @@ -55,12 +55,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to disable SKE for project %q? (This will delete all associated clusters)", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to disable SKE for project %q? (This will delete all associated clusters)", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/ske/enable/enable.go b/internal/cmd/ske/enable/enable.go index 411140edc..366f8d5f2 100644 --- a/internal/cmd/ske/enable/enable.go +++ b/internal/cmd/ske/enable/enable.go @@ -55,12 +55,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to enable SKE for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to enable SKE for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/ske/kubeconfig/create/create.go b/internal/cmd/ske/kubeconfig/create/create.go index 725c53636..355364098 100644 --- a/internal/cmd/ske/kubeconfig/create/create.go +++ b/internal/cmd/ske/kubeconfig/create/create.go @@ -90,7 +90,7 @@ func NewCmd(params *types.CmdParams) *cobra.Command { return err } - if !model.AssumeYes && !model.DisableWriting { + if !model.DisableWriting { var prompt string if model.Overwrite { prompt = fmt.Sprintf("Are you sure you want to create a kubeconfig for SKE cluster %q? This will OVERWRITE your current kubeconfig file, if it exists.", model.ClusterName) diff --git a/internal/cmd/volume/backup/create/create.go b/internal/cmd/volume/backup/create/create.go index 3673b6ac8..fc9e0b3cd 100644 --- a/internal/cmd/volume/backup/create/create.go +++ b/internal/cmd/volume/backup/create/create.go @@ -96,12 +96,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { } } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create backup from %s? (This cannot be undone)", sourceLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create backup from %s? (This cannot be undone)", sourceLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/volume/backup/delete/delete.go b/internal/cmd/volume/backup/delete/delete.go index e8e2ce676..9c9717427 100644 --- a/internal/cmd/volume/backup/delete/delete.go +++ b/internal/cmd/volume/backup/delete/delete.go @@ -58,12 +58,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { params.Printer.Debug(print.ErrorLevel, "get backup name: %v", err) } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete backup %q? (This cannot be undone)", backupLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete backup %q? (This cannot be undone)", backupLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/volume/backup/restore/restore.go b/internal/cmd/volume/backup/restore/restore.go index 29239a7fe..63fc0d915 100644 --- a/internal/cmd/volume/backup/restore/restore.go +++ b/internal/cmd/volume/backup/restore/restore.go @@ -71,12 +71,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { } } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to restore %q with backup %q? (This cannot be undone)", sourceLabel, backupLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to restore %q with backup %q? (This cannot be undone)", sourceLabel, backupLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/volume/backup/update/update.go b/internal/cmd/volume/backup/update/update.go index 02fe3703a..9141f9a2b 100644 --- a/internal/cmd/volume/backup/update/update.go +++ b/internal/cmd/volume/backup/update/update.go @@ -65,12 +65,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { params.Printer.Debug(print.ErrorLevel, "get backup name: %v", err) } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update backup %q? (This cannot be undone)", model.BackupId) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update backup %q? (This cannot be undone)", model.BackupId) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/volume/create/create.go b/internal/cmd/volume/create/create.go index 8b3a536a5..f0bda5f69 100644 --- a/internal/cmd/volume/create/create.go +++ b/internal/cmd/volume/create/create.go @@ -88,12 +88,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { projectLabel = model.ProjectId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create a volume for project %q?", projectLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create a volume for project %q?", projectLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/volume/delete/delete.go b/internal/cmd/volume/delete/delete.go index f6550714c..599f3bf56 100644 --- a/internal/cmd/volume/delete/delete.go +++ b/internal/cmd/volume/delete/delete.go @@ -64,12 +64,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { volumeLabel = model.VolumeId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete volume %q?", volumeLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete volume %q?", volumeLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/volume/resize/resize.go b/internal/cmd/volume/resize/resize.go index 7bcc40dc0..0bfbc0797 100644 --- a/internal/cmd/volume/resize/resize.go +++ b/internal/cmd/volume/resize/resize.go @@ -63,12 +63,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { volumeLabel = model.VolumeId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to resize volume %q?", volumeLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to resize volume %q?", volumeLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/volume/snapshot/create/create.go b/internal/cmd/volume/snapshot/create/create.go index 29dd2894c..f63a38b16 100644 --- a/internal/cmd/volume/snapshot/create/create.go +++ b/internal/cmd/volume/snapshot/create/create.go @@ -79,12 +79,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { volumeLabel = model.VolumeID } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to create snapshot from volume %q? (This cannot be undone)", volumeLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to create snapshot from volume %q? (This cannot be undone)", volumeLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/volume/snapshot/delete/delete.go b/internal/cmd/volume/snapshot/delete/delete.go index c4c06b34d..7334cac51 100644 --- a/internal/cmd/volume/snapshot/delete/delete.go +++ b/internal/cmd/volume/snapshot/delete/delete.go @@ -61,12 +61,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { snapshotLabel = model.SnapshotId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to delete snapshot %q? (This cannot be undone)", snapshotLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to delete snapshot %q? (This cannot be undone)", snapshotLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/volume/snapshot/update/update.go b/internal/cmd/volume/snapshot/update/update.go index b43072bce..f48649743 100644 --- a/internal/cmd/volume/snapshot/update/update.go +++ b/internal/cmd/volume/snapshot/update/update.go @@ -67,12 +67,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { snapshotLabel = model.SnapshotId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update snapshot %q?", snapshotLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update snapshot %q?", snapshotLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/cmd/volume/update/update.go b/internal/cmd/volume/update/update.go index 194a70db3..3c8f447d3 100644 --- a/internal/cmd/volume/update/update.go +++ b/internal/cmd/volume/update/update.go @@ -74,12 +74,10 @@ func NewCmd(params *types.CmdParams) *cobra.Command { volumeLabel = model.VolumeId } - if !model.AssumeYes { - prompt := fmt.Sprintf("Are you sure you want to update volume %q?", volumeLabel) - err = params.Printer.PromptForConfirmation(prompt) - if err != nil { - return err - } + prompt := fmt.Sprintf("Are you sure you want to update volume %q?", volumeLabel) + err = params.Printer.PromptForConfirmation(prompt) + if err != nil { + return err } // Call API diff --git a/internal/pkg/print/print.go b/internal/pkg/print/print.go index d8e06a25c..4098b9cb5 100644 --- a/internal/pkg/print/print.go +++ b/internal/pkg/print/print.go @@ -51,6 +51,7 @@ var ( type Printer struct { Cmd *cobra.Command + AssumeYes bool Verbosity Level } @@ -134,6 +135,10 @@ func (p *Printer) Error(msg string, args ...any) { // Returns nil only if the user (explicitly) answers positive. // Returns ErrAborted if the user answers negative. func (p *Printer) PromptForConfirmation(prompt string) error { + if p.AssumeYes { + p.Warn("Auto-confirming prompt: %q\n", prompt) + return nil + } question := fmt.Sprintf("%s [y/N] ", prompt) reader := bufio.NewReader(p.Cmd.InOrStdin()) for i := 0; i < 3; i++ { @@ -157,6 +162,10 @@ func (p *Printer) PromptForConfirmation(prompt string) error { // // Returns nil if the user presses Enter. func (p *Printer) PromptForEnter(prompt string) error { + if p.AssumeYes { + p.Warn("Auto-confirming prompt: %q", prompt) + return nil + } reader := bufio.NewReader(p.Cmd.InOrStdin()) p.Cmd.PrintErr(prompt) _, err := reader.ReadString('\n') diff --git a/internal/pkg/print/print_test.go b/internal/pkg/print/print_test.go index 8cb2e8ee2..d52af5241 100644 --- a/internal/pkg/print/print_test.go +++ b/internal/pkg/print/print_test.go @@ -509,6 +509,7 @@ func TestPromptForConfirmation(t *testing.T) { verbosity Level isValid bool isAborted bool + assumeYes bool }{ // Note: Some of these inputs have normal spaces, others have tabs { @@ -647,6 +648,13 @@ func TestPromptForConfirmation(t *testing.T) { verbosity: DebugLevel, isValid: false, }, + { + description: "no input with assume yes", + input: "", + verbosity: DebugLevel, + isValid: true, + assumeYes: true, + }, } for _, tt := range tests { @@ -665,6 +673,7 @@ func TestPromptForConfirmation(t *testing.T) { p := &Printer{ Cmd: cmd, Verbosity: tt.verbosity, + AssumeYes: tt.assumeYes, } err = p.PromptForConfirmation("")