diff --git a/bundle/internal/tf/codegen/templates/block.go.tmpl b/bundle/internal/tf/codegen/templates/block.go.tmpl index 9b457cce708..2b99ad9f1b2 100644 --- a/bundle/internal/tf/codegen/templates/block.go.tmpl +++ b/bundle/internal/tf/codegen/templates/block.go.tmpl @@ -3,9 +3,13 @@ package schema {{ range .StructTypes }} +{{- if .Fields }} type {{ .Name }} struct { {{- range .Fields }} {{ .Name }} {{ .Type }} `json:"{{ .Tag }}"` {{- end }} } +{{ else }} +type {{ .Name }} struct{} {{ end }} +{{- end }} diff --git a/bundle/internal/tf/codegen/templates/root.go.tmpl b/bundle/internal/tf/codegen/templates/root.go.tmpl index fc356042cd3..9a94a8985c6 100644 --- a/bundle/internal/tf/codegen/templates/root.go.tmpl +++ b/bundle/internal/tf/codegen/templates/root.go.tmpl @@ -19,11 +19,13 @@ type Root struct { Resource *Resources `json:"resource,omitempty"` } -const ProviderHost = "registry.terraform.io" -const ProviderSource = "databricks/databricks" -const ProviderVersion = "{{ .ProviderVersion }}" -const ProviderChecksumLinuxAmd64 = "{{ .ProviderChecksumLinuxAmd64 }}" -const ProviderChecksumLinuxArm64 = "{{ .ProviderChecksumLinuxArm64 }}" +const ( + ProviderHost = "registry.terraform.io" + ProviderSource = "databricks/databricks" + ProviderVersion = "{{ .ProviderVersion }}" + ProviderChecksumLinuxAmd64 = "{{ .ProviderChecksumLinuxAmd64 }}" + ProviderChecksumLinuxArm64 = "{{ .ProviderChecksumLinuxArm64 }}" +) func NewRoot() *Root { return &Root{ diff --git a/bundle/internal/tf/schema/data_source_data_quality_monitor.go b/bundle/internal/tf/schema/data_source_data_quality_monitor.go index 251ce8ffa2b..9dca671651d 100644 --- a/bundle/internal/tf/schema/data_source_data_quality_monitor.go +++ b/bundle/internal/tf/schema/data_source_data_quality_monitor.go @@ -37,8 +37,7 @@ type DataSourceDataQualityMonitorDataProfilingConfigSchedule struct { TimezoneId string `json:"timezone_id"` } -type DataSourceDataQualityMonitorDataProfilingConfigSnapshot struct { -} +type DataSourceDataQualityMonitorDataProfilingConfigSnapshot struct{} type DataSourceDataQualityMonitorDataProfilingConfigTimeSeries struct { Granularities []string `json:"granularities"` diff --git a/bundle/internal/tf/schema/data_source_data_quality_monitors.go b/bundle/internal/tf/schema/data_source_data_quality_monitors.go index 312eac04159..4665fcd6f97 100644 --- a/bundle/internal/tf/schema/data_source_data_quality_monitors.go +++ b/bundle/internal/tf/schema/data_source_data_quality_monitors.go @@ -37,8 +37,7 @@ type DataSourceDataQualityMonitorsMonitorsDataProfilingConfigSchedule struct { TimezoneId string `json:"timezone_id"` } -type DataSourceDataQualityMonitorsMonitorsDataProfilingConfigSnapshot struct { -} +type DataSourceDataQualityMonitorsMonitorsDataProfilingConfigSnapshot struct{} type DataSourceDataQualityMonitorsMonitorsDataProfilingConfigTimeSeries struct { Granularities []string `json:"granularities"` diff --git a/bundle/internal/tf/schema/data_source_feature_engineering_materialized_feature.go b/bundle/internal/tf/schema/data_source_feature_engineering_materialized_feature.go index e1c4d0c4bd2..eeaf8d096d1 100644 --- a/bundle/internal/tf/schema/data_source_feature_engineering_materialized_feature.go +++ b/bundle/internal/tf/schema/data_source_feature_engineering_materialized_feature.go @@ -27,8 +27,7 @@ type DataSourceFeatureEngineeringMaterializedFeatureStreamingMode struct { Mode string `json:"mode,omitempty"` } -type DataSourceFeatureEngineeringMaterializedFeatureTableTrigger struct { -} +type DataSourceFeatureEngineeringMaterializedFeatureTableTrigger struct{} type DataSourceFeatureEngineeringMaterializedFeature struct { CronSchedule string `json:"cron_schedule,omitempty"` diff --git a/bundle/internal/tf/schema/data_source_feature_engineering_materialized_features.go b/bundle/internal/tf/schema/data_source_feature_engineering_materialized_features.go index 3f1823a23ce..cf95ba9f289 100644 --- a/bundle/internal/tf/schema/data_source_feature_engineering_materialized_features.go +++ b/bundle/internal/tf/schema/data_source_feature_engineering_materialized_features.go @@ -27,8 +27,7 @@ type DataSourceFeatureEngineeringMaterializedFeaturesMaterializedFeaturesStreami Mode string `json:"mode,omitempty"` } -type DataSourceFeatureEngineeringMaterializedFeaturesMaterializedFeaturesTableTrigger struct { -} +type DataSourceFeatureEngineeringMaterializedFeaturesMaterializedFeaturesTableTrigger struct{} type DataSourceFeatureEngineeringMaterializedFeaturesMaterializedFeatures struct { CronSchedule string `json:"cron_schedule,omitempty"` diff --git a/bundle/internal/tf/schema/resource_data_quality_monitor.go b/bundle/internal/tf/schema/resource_data_quality_monitor.go index 1aca6fdf281..58b2594c93d 100644 --- a/bundle/internal/tf/schema/resource_data_quality_monitor.go +++ b/bundle/internal/tf/schema/resource_data_quality_monitor.go @@ -37,8 +37,7 @@ type ResourceDataQualityMonitorDataProfilingConfigSchedule struct { TimezoneId string `json:"timezone_id"` } -type ResourceDataQualityMonitorDataProfilingConfigSnapshot struct { -} +type ResourceDataQualityMonitorDataProfilingConfigSnapshot struct{} type ResourceDataQualityMonitorDataProfilingConfigTimeSeries struct { Granularities []string `json:"granularities"` diff --git a/bundle/internal/tf/schema/resource_feature_engineering_materialized_feature.go b/bundle/internal/tf/schema/resource_feature_engineering_materialized_feature.go index 46b1de4dc67..4a753ec41ec 100644 --- a/bundle/internal/tf/schema/resource_feature_engineering_materialized_feature.go +++ b/bundle/internal/tf/schema/resource_feature_engineering_materialized_feature.go @@ -27,8 +27,7 @@ type ResourceFeatureEngineeringMaterializedFeatureStreamingMode struct { Mode string `json:"mode,omitempty"` } -type ResourceFeatureEngineeringMaterializedFeatureTableTrigger struct { -} +type ResourceFeatureEngineeringMaterializedFeatureTableTrigger struct{} type ResourceFeatureEngineeringMaterializedFeature struct { CronSchedule string `json:"cron_schedule,omitempty"` diff --git a/bundle/internal/tf/schema/resource_lakehouse_monitor.go b/bundle/internal/tf/schema/resource_lakehouse_monitor.go index af702885f2c..fff8442edb9 100644 --- a/bundle/internal/tf/schema/resource_lakehouse_monitor.go +++ b/bundle/internal/tf/schema/resource_lakehouse_monitor.go @@ -47,8 +47,7 @@ type ResourceLakehouseMonitorSchedule struct { TimezoneId string `json:"timezone_id"` } -type ResourceLakehouseMonitorSnapshot struct { -} +type ResourceLakehouseMonitorSnapshot struct{} type ResourceLakehouseMonitorTimeSeries struct { Granularities []string `json:"granularities"` diff --git a/bundle/internal/tf/schema/resource_online_table.go b/bundle/internal/tf/schema/resource_online_table.go index b2d515290fd..5ad7781380c 100644 --- a/bundle/internal/tf/schema/resource_online_table.go +++ b/bundle/internal/tf/schema/resource_online_table.go @@ -6,11 +6,9 @@ type ResourceOnlineTableProviderConfig struct { WorkspaceId string `json:"workspace_id,omitempty"` } -type ResourceOnlineTableSpecRunContinuously struct { -} +type ResourceOnlineTableSpecRunContinuously struct{} -type ResourceOnlineTableSpecRunTriggered struct { -} +type ResourceOnlineTableSpecRunTriggered struct{} type ResourceOnlineTableSpec struct { PerformFullCopy bool `json:"perform_full_copy,omitempty"` diff --git a/bundle/internal/tf/schema/resource_pipeline.go b/bundle/internal/tf/schema/resource_pipeline.go index 662cd243612..8d279e91902 100644 --- a/bundle/internal/tf/schema/resource_pipeline.go +++ b/bundle/internal/tf/schema/resource_pipeline.go @@ -778,8 +778,7 @@ type ResourcePipelineTriggerCron struct { TimezoneId string `json:"timezone_id,omitempty"` } -type ResourcePipelineTriggerManual struct { -} +type ResourcePipelineTriggerManual struct{} type ResourcePipelineTrigger struct { Cron *ResourcePipelineTriggerCron `json:"cron,omitempty"` diff --git a/bundle/internal/tf/schema/root.go b/bundle/internal/tf/schema/root.go index 8e370512700..8e160d0d549 100644 --- a/bundle/internal/tf/schema/root.go +++ b/bundle/internal/tf/schema/root.go @@ -19,11 +19,13 @@ type Root struct { Resource *Resources `json:"resource,omitempty"` } -const ProviderHost = "registry.terraform.io" -const ProviderSource = "databricks/databricks" -const ProviderVersion = "1.120.0" -const ProviderChecksumLinuxAmd64 = "b93e5b04c24164372afe85029135e11a1be7ff86fbbeac343be44356b89c752c" -const ProviderChecksumLinuxArm64 = "ac0f728cafd1434b19477b64a98f8cdff3b8c8fb4ddcb7dd61e8b0646a8b5ada" +const ( + ProviderHost = "registry.terraform.io" + ProviderSource = "databricks/databricks" + ProviderVersion = "1.120.0" + ProviderChecksumLinuxAmd64 = "b93e5b04c24164372afe85029135e11a1be7ff86fbbeac343be44356b89c752c" + ProviderChecksumLinuxArm64 = "ac0f728cafd1434b19477b64a98f8cdff3b8c8fb4ddcb7dd61e8b0646a8b5ada" +) func NewRoot() *Root { return &Root{ diff --git a/cmd/account/access-control/access-control.go b/cmd/account/access-control/access-control.go index 3f601a89330..3be9b6579cb 100644 --- a/cmd/account/access-control/access-control.go +++ b/cmd/account/access-control/access-control.go @@ -3,7 +3,7 @@ package access_control import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -253,7 +253,7 @@ Update a rule set. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := a.AccessControl.UpdateRuleSet(ctx, updateRuleSetReq) diff --git a/cmd/account/budgets/budgets.go b/cmd/account/budgets/budgets.go index 94557e3f3b2..723486a2e40 100644 --- a/cmd/account/budgets/budgets.go +++ b/cmd/account/budgets/budgets.go @@ -3,6 +3,7 @@ package budgets import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -97,7 +98,7 @@ Create new budget. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := a.Budgets.Create(ctx, createReq) @@ -368,7 +369,7 @@ Modify budget. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } updateReq.BudgetId = args[0] diff --git a/cmd/account/credentials/credentials.go b/cmd/account/credentials/credentials.go index e4461fac52e..580a650e889 100644 --- a/cmd/account/credentials/credentials.go +++ b/cmd/account/credentials/credentials.go @@ -3,7 +3,7 @@ package credentials import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -105,7 +105,7 @@ func newCreate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := a.Credentials.Create(ctx, createReq) diff --git a/cmd/account/csp-enablement-account/csp-enablement-account.go b/cmd/account/csp-enablement-account/csp-enablement-account.go index 07d9981a23d..6e90bdae435 100644 --- a/cmd/account/csp-enablement-account/csp-enablement-account.go +++ b/cmd/account/csp-enablement-account/csp-enablement-account.go @@ -3,7 +3,7 @@ package csp_enablement_account import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -154,7 +154,7 @@ Update the compliance security profile setting for new workspaces. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := a.Settings.CspEnablementAccount().Update(ctx, updateReq) diff --git a/cmd/account/disable-legacy-features/disable-legacy-features.go b/cmd/account/disable-legacy-features/disable-legacy-features.go index 8289e28f92e..7ded95ff0a3 100644 --- a/cmd/account/disable-legacy-features/disable-legacy-features.go +++ b/cmd/account/disable-legacy-features/disable-legacy-features.go @@ -3,7 +3,7 @@ package disable_legacy_features import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -202,7 +202,7 @@ func newUpdate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := a.Settings.DisableLegacyFeatures().Update(ctx, updateReq) diff --git a/cmd/account/disaster-recovery/disaster-recovery.go b/cmd/account/disaster-recovery/disaster-recovery.go index bbb17e2491c..f593144adb8 100644 --- a/cmd/account/disaster-recovery/disaster-recovery.go +++ b/cmd/account/disaster-recovery/disaster-recovery.go @@ -3,6 +3,7 @@ package disaster_recovery import ( + "errors" "fmt" "strings" @@ -101,7 +102,7 @@ Create a Failover Group. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only PARENT, FAILOVER_GROUP_ID as positional arguments. Provide 'regions', 'workspace_sets', 'initial_primary_region' in your JSON input") + return errors.New("when --json flag is specified, provide only PARENT, FAILOVER_GROUP_ID as positional arguments. Provide 'regions', 'workspace_sets', 'initial_primary_region' in your JSON input") } return nil } @@ -211,7 +212,7 @@ Create a Stable URL. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only PARENT, STABLE_URL_ID as positional arguments. Provide 'initial_workspace_id' in your JSON input") + return errors.New("when --json flag is specified, provide only PARENT, STABLE_URL_ID as positional arguments. Provide 'initial_workspace_id' in your JSON input") } return nil } @@ -430,7 +431,7 @@ Failover a Failover Group to a new primary region. if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME as positional arguments. Provide 'target_primary_region', 'failover_type' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME as positional arguments. Provide 'target_primary_region', 'failover_type' in your JSON input") } return nil } @@ -815,7 +816,7 @@ Update a Failover Group. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'regions', 'workspace_sets', 'initial_primary_region' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'regions', 'workspace_sets', 'initial_primary_region' in your JSON input") } return nil } diff --git a/cmd/account/enable-ip-access-lists/enable-ip-access-lists.go b/cmd/account/enable-ip-access-lists/enable-ip-access-lists.go index b89397ce1c2..e417dc92144 100644 --- a/cmd/account/enable-ip-access-lists/enable-ip-access-lists.go +++ b/cmd/account/enable-ip-access-lists/enable-ip-access-lists.go @@ -3,7 +3,7 @@ package enable_ip_access_lists import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -202,7 +202,7 @@ func newUpdate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := a.Settings.EnableIpAccessLists().Update(ctx, updateReq) diff --git a/cmd/account/encryption-keys/encryption-keys.go b/cmd/account/encryption-keys/encryption-keys.go index 1ae7e68ea37..941fe953d43 100644 --- a/cmd/account/encryption-keys/encryption-keys.go +++ b/cmd/account/encryption-keys/encryption-keys.go @@ -3,7 +3,7 @@ package encryption_keys import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -133,7 +133,7 @@ func newCreate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := a.EncryptionKeys.Create(ctx, createReq) diff --git a/cmd/account/endpoints/endpoints.go b/cmd/account/endpoints/endpoints.go index ff6f089b5a3..dff9c2344bf 100644 --- a/cmd/account/endpoints/endpoints.go +++ b/cmd/account/endpoints/endpoints.go @@ -3,6 +3,7 @@ package endpoints import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -94,7 +95,7 @@ func newCreateEndpoint() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only PARENT as positional arguments. Provide 'display_name', 'region' in your JSON input") + return errors.New("when --json flag is specified, provide only PARENT as positional arguments. Provide 'display_name', 'region' in your JSON input") } return nil } diff --git a/cmd/account/esm-enablement-account/esm-enablement-account.go b/cmd/account/esm-enablement-account/esm-enablement-account.go index 7f0286dd2b6..75af94183a2 100644 --- a/cmd/account/esm-enablement-account/esm-enablement-account.go +++ b/cmd/account/esm-enablement-account/esm-enablement-account.go @@ -3,7 +3,7 @@ package esm_enablement_account import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -152,7 +152,7 @@ Update the enhanced security monitoring setting for new workspaces. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := a.Settings.EsmEnablementAccount().Update(ctx, updateReq) diff --git a/cmd/account/iam-v2/iam-v2.go b/cmd/account/iam-v2/iam-v2.go index d473f4ce804..7de37b8ca7b 100644 --- a/cmd/account/iam-v2/iam-v2.go +++ b/cmd/account/iam-v2/iam-v2.go @@ -3,6 +3,7 @@ package iam_v2 import ( + "errors" "fmt" "strings" @@ -100,7 +101,7 @@ func newCreateWorkspaceAssignmentDetail() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only WORKSPACE_ID as positional arguments. Provide 'principal_id' in your JSON input") + return errors.New("when --json flag is specified, provide only WORKSPACE_ID as positional arguments. Provide 'principal_id' in your JSON input") } return nil } @@ -496,7 +497,7 @@ Resolve an external group in the Databricks account. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'external_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'external_id' in your JSON input") } return nil } @@ -583,7 +584,7 @@ Resolve an external service principal in the Databricks account. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'external_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'external_id' in your JSON input") } return nil } @@ -670,7 +671,7 @@ Resolve an external user in the Databricks account. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'external_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'external_id' in your JSON input") } return nil } @@ -767,7 +768,7 @@ func newUpdateWorkspaceAssignmentDetail() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(3)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only WORKSPACE_ID, PRINCIPAL_ID, UPDATE_MASK as positional arguments. Provide 'principal_id' in your JSON input") + return errors.New("when --json flag is specified, provide only WORKSPACE_ID, PRINCIPAL_ID, UPDATE_MASK as positional arguments. Provide 'principal_id' in your JSON input") } return nil } diff --git a/cmd/account/ip-access-lists/ip-access-lists.go b/cmd/account/ip-access-lists/ip-access-lists.go index f7bc59185a3..7e9dab8b09b 100644 --- a/cmd/account/ip-access-lists/ip-access-lists.go +++ b/cmd/account/ip-access-lists/ip-access-lists.go @@ -3,6 +3,7 @@ package ip_access_lists import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -118,7 +119,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'label', 'list_type' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'label', 'list_type' in your JSON input") } return nil } @@ -221,7 +222,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id for the corresponding ip access list") + return errors.New("expected to have the id for the corresponding ip access list") } deleteReq.IpAccessListId = args[0] @@ -291,7 +292,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id for the corresponding ip access list") + return errors.New("expected to have the id for the corresponding ip access list") } getReq.IpAccessListId = args[0] @@ -421,7 +422,7 @@ func newReplace() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only IP_ACCESS_LIST_ID as positional arguments. Provide 'label', 'list_type', 'enabled' in your JSON input") + return errors.New("when --json flag is specified, provide only IP_ACCESS_LIST_ID as positional arguments. Provide 'label', 'list_type', 'enabled' in your JSON input") } return nil } @@ -564,7 +565,7 @@ func newUpdate() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id for the corresponding ip access list") + return errors.New("expected to have the id for the corresponding ip access list") } updateReq.IpAccessListId = args[0] diff --git a/cmd/account/llm-proxy-partner-powered-account/llm-proxy-partner-powered-account.go b/cmd/account/llm-proxy-partner-powered-account/llm-proxy-partner-powered-account.go index 28143768d41..c81d65af84c 100644 --- a/cmd/account/llm-proxy-partner-powered-account/llm-proxy-partner-powered-account.go +++ b/cmd/account/llm-proxy-partner-powered-account/llm-proxy-partner-powered-account.go @@ -3,7 +3,7 @@ package llm_proxy_partner_powered_account import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -144,7 +144,7 @@ func newUpdate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := a.Settings.LlmProxyPartnerPoweredAccount().Update(ctx, updateReq) diff --git a/cmd/account/llm-proxy-partner-powered-enforce/llm-proxy-partner-powered-enforce.go b/cmd/account/llm-proxy-partner-powered-enforce/llm-proxy-partner-powered-enforce.go index be082440cb8..035b0a0accf 100644 --- a/cmd/account/llm-proxy-partner-powered-enforce/llm-proxy-partner-powered-enforce.go +++ b/cmd/account/llm-proxy-partner-powered-enforce/llm-proxy-partner-powered-enforce.go @@ -3,7 +3,7 @@ package llm_proxy_partner_powered_enforce import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -146,7 +146,7 @@ func newUpdate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := a.Settings.LlmProxyPartnerPoweredEnforce().Update(ctx, updateReq) diff --git a/cmd/account/log-delivery/log-delivery.go b/cmd/account/log-delivery/log-delivery.go index ec1f2b0e191..93310e7aad5 100644 --- a/cmd/account/log-delivery/log-delivery.go +++ b/cmd/account/log-delivery/log-delivery.go @@ -3,6 +3,7 @@ package log_delivery import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -177,7 +178,7 @@ func newCreate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := a.LogDelivery.Create(ctx, createReq) @@ -248,7 +249,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the log delivery configuration id of customer") + return errors.New("expected to have the log delivery configuration id of customer") } getReq.LogDeliveryConfigurationId = args[0] @@ -389,7 +390,7 @@ func newPatchStatus() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only LOG_DELIVERY_CONFIGURATION_ID as positional arguments. Provide 'status' in your JSON input") + return errors.New("when --json flag is specified, provide only LOG_DELIVERY_CONFIGURATION_ID as positional arguments. Provide 'status' in your JSON input") } return nil } diff --git a/cmd/account/network-connectivity/network-connectivity.go b/cmd/account/network-connectivity/network-connectivity.go index 9f0807d611b..3a1b00e18f6 100644 --- a/cmd/account/network-connectivity/network-connectivity.go +++ b/cmd/account/network-connectivity/network-connectivity.go @@ -3,6 +3,7 @@ package network_connectivity import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -109,7 +110,7 @@ func newCreateNetworkConnectivityConfiguration() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'region' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'region' in your JSON input") } return nil } diff --git a/cmd/account/personal-compute/personal-compute.go b/cmd/account/personal-compute/personal-compute.go index 69e944cef0c..1e6c3569975 100644 --- a/cmd/account/personal-compute/personal-compute.go +++ b/cmd/account/personal-compute/personal-compute.go @@ -3,7 +3,7 @@ package personal_compute import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -209,7 +209,7 @@ func newUpdate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := a.Settings.PersonalCompute().Update(ctx, updateReq) diff --git a/cmd/account/storage/storage.go b/cmd/account/storage/storage.go index 94753f450f5..116b58fc2ca 100644 --- a/cmd/account/storage/storage.go +++ b/cmd/account/storage/storage.go @@ -3,7 +3,7 @@ package storage import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -95,7 +95,7 @@ func newCreate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := a.Storage.Create(ctx, createReq) diff --git a/cmd/workspace/access-control/access-control.go b/cmd/workspace/access-control/access-control.go index acb37919c49..f3571d21c3f 100644 --- a/cmd/workspace/access-control/access-control.go +++ b/cmd/workspace/access-control/access-control.go @@ -3,7 +3,7 @@ package access_control import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -88,7 +88,7 @@ func newCheckPolicy() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.AccessControl.CheckPolicy(ctx, checkPolicyReq) diff --git a/cmd/workspace/agent-bricks/agent-bricks.go b/cmd/workspace/agent-bricks/agent-bricks.go index 2a9580646af..145b4198dee 100644 --- a/cmd/workspace/agent-bricks/agent-bricks.go +++ b/cmd/workspace/agent-bricks/agent-bricks.go @@ -3,7 +3,7 @@ package agent_bricks import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -140,7 +140,7 @@ func newCreateCustomLlm() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'instructions' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'instructions' in your JSON input") } return nil } @@ -412,7 +412,7 @@ func newUpdateCustomLlm() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } updateCustomLlmReq.Id = args[0] diff --git a/cmd/workspace/ai-search/ai-search.go b/cmd/workspace/ai-search/ai-search.go index 4f332372854..da9a7d8080e 100644 --- a/cmd/workspace/ai-search/ai-search.go +++ b/cmd/workspace/ai-search/ai-search.go @@ -3,6 +3,7 @@ package ai_search import ( + "errors" "fmt" "strings" @@ -111,7 +112,7 @@ Create an AI Search endpoint. if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only PARENT as positional arguments. Provide 'endpoint_type' in your JSON input") + return errors.New("when --json flag is specified, provide only PARENT as positional arguments. Provide 'endpoint_type' in your JSON input") } return nil } @@ -213,7 +214,7 @@ Create an AI Search index. if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only PARENT as positional arguments. Provide 'primary_key', 'index_type' in your JSON input") + return errors.New("when --json flag is specified, provide only PARENT as positional arguments. Provide 'primary_key', 'index_type' in your JSON input") } return nil } @@ -736,7 +737,7 @@ Query an AI Search index. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } queryIndexReq.Name = args[0] @@ -815,7 +816,7 @@ Remove data from an AI Search index. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } removeDataReq.Name = args[0] @@ -1042,7 +1043,7 @@ Update an AI Search endpoint. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'endpoint_type' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'endpoint_type' in your JSON input") } return nil } @@ -1138,7 +1139,7 @@ Upsert data into an AI Search index. if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME as positional arguments. Provide 'inputs_json' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME as positional arguments. Provide 'inputs_json' in your JSON input") } return nil } diff --git a/cmd/workspace/aibi-dashboard-embedding-access-policy/aibi-dashboard-embedding-access-policy.go b/cmd/workspace/aibi-dashboard-embedding-access-policy/aibi-dashboard-embedding-access-policy.go index 1d4e6741fc5..5341051cd12 100644 --- a/cmd/workspace/aibi-dashboard-embedding-access-policy/aibi-dashboard-embedding-access-policy.go +++ b/cmd/workspace/aibi-dashboard-embedding-access-policy/aibi-dashboard-embedding-access-policy.go @@ -3,7 +3,7 @@ package aibi_dashboard_embedding_access_policy import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -211,7 +211,7 @@ Update the AI/BI dashboard embedding access policy. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.AibiDashboardEmbeddingAccessPolicy().Update(ctx, updateReq) diff --git a/cmd/workspace/aibi-dashboard-embedding-approved-domains/aibi-dashboard-embedding-approved-domains.go b/cmd/workspace/aibi-dashboard-embedding-approved-domains/aibi-dashboard-embedding-approved-domains.go index 8cbd6dff101..3477f3a0971 100644 --- a/cmd/workspace/aibi-dashboard-embedding-approved-domains/aibi-dashboard-embedding-approved-domains.go +++ b/cmd/workspace/aibi-dashboard-embedding-approved-domains/aibi-dashboard-embedding-approved-domains.go @@ -3,7 +3,7 @@ package aibi_dashboard_embedding_approved_domains import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -211,7 +211,7 @@ Update the list of domains approved to host embedded AI/BI dashboards. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.AibiDashboardEmbeddingApprovedDomains().Update(ctx, updateReq) diff --git a/cmd/workspace/alerts-legacy/alerts-legacy.go b/cmd/workspace/alerts-legacy/alerts-legacy.go index 1863f7db6de..b381f027b2c 100644 --- a/cmd/workspace/alerts-legacy/alerts-legacy.go +++ b/cmd/workspace/alerts-legacy/alerts-legacy.go @@ -3,7 +3,7 @@ package alerts_legacy import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -112,7 +112,7 @@ Create an alert. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.AlertsLegacy.Create(ctx, createReq) @@ -372,7 +372,7 @@ Update an alert. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } updateReq.AlertId = args[0] diff --git a/cmd/workspace/alerts-v2/alerts-v2.go b/cmd/workspace/alerts-v2/alerts-v2.go index 2e929120a4b..3af56df67af 100644 --- a/cmd/workspace/alerts-v2/alerts-v2.go +++ b/cmd/workspace/alerts-v2/alerts-v2.go @@ -3,6 +3,7 @@ package alerts_v2 import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -95,7 +96,7 @@ Create an alert. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'display_name', 'query_text', 'warehouse_id', 'evaluation', 'schedule' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'display_name', 'query_text', 'warehouse_id', 'evaluation', 'schedule' in your JSON input") } return nil } @@ -210,7 +211,7 @@ Get an alert. args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } getAlertReq.Id = args[0] @@ -356,7 +357,7 @@ Delete an alert (legacy TrashAlert). args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } trashAlertReq.Id = args[0] @@ -439,7 +440,7 @@ Update an alert. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only ID, UPDATE_MASK as positional arguments. Provide 'display_name', 'query_text', 'warehouse_id', 'evaluation', 'schedule' in your JSON input") + return errors.New("when --json flag is specified, provide only ID, UPDATE_MASK as positional arguments. Provide 'display_name', 'query_text', 'warehouse_id', 'evaluation', 'schedule' in your JSON input") } return nil } diff --git a/cmd/workspace/alerts/alerts.go b/cmd/workspace/alerts/alerts.go index dd9aa1c8877..3d7ea15c063 100644 --- a/cmd/workspace/alerts/alerts.go +++ b/cmd/workspace/alerts/alerts.go @@ -3,6 +3,7 @@ package alerts import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -168,7 +169,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } deleteReq.Id = args[0] @@ -235,7 +236,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } getReq.Id = args[0] @@ -379,7 +380,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only ID as positional arguments. Provide 'update_mask' in your JSON input") + return errors.New("when --json flag is specified, provide only ID as positional arguments. Provide 'update_mask' in your JSON input") } return nil } diff --git a/cmd/workspace/apps-settings/apps-settings.go b/cmd/workspace/apps-settings/apps-settings.go index 15b80e01bd6..ce5e6d84a41 100644 --- a/cmd/workspace/apps-settings/apps-settings.go +++ b/cmd/workspace/apps-settings/apps-settings.go @@ -3,6 +3,7 @@ package apps_settings import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -93,7 +94,7 @@ func newCreateCustomTemplate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'git_repo', 'path', 'manifest', 'git_provider' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'git_repo', 'path', 'manifest', 'git_provider' in your JSON input") } return nil } @@ -391,7 +392,7 @@ func newUpdateCustomTemplate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME as positional arguments. Provide 'name', 'git_repo', 'path', 'manifest', 'git_provider' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME as positional arguments. Provide 'name', 'git_repo', 'path', 'manifest', 'git_provider' in your JSON input") } return nil } diff --git a/cmd/workspace/apps/apps.go b/cmd/workspace/apps/apps.go index 83d706f4d5d..c06e20fa301 100644 --- a/cmd/workspace/apps/apps.go +++ b/cmd/workspace/apps/apps.go @@ -3,6 +3,7 @@ package apps import ( + "errors" "fmt" "strings" "time" @@ -130,7 +131,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } @@ -255,7 +256,7 @@ func newCreateSpace() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } @@ -389,7 +390,7 @@ func newCreateUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only APP_NAME as positional arguments. Provide 'update_mask' in your JSON input") + return errors.New("when --json flag is specified, provide only APP_NAME as positional arguments. Provide 'update_mask' in your JSON input") } return nil } diff --git a/cmd/workspace/artifact-allowlists/artifact-allowlists.go b/cmd/workspace/artifact-allowlists/artifact-allowlists.go index 2d8f100d5d4..d6fce44ebd1 100644 --- a/cmd/workspace/artifact-allowlists/artifact-allowlists.go +++ b/cmd/workspace/artifact-allowlists/artifact-allowlists.go @@ -3,6 +3,7 @@ package artifact_allowlists import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -163,7 +164,7 @@ func newUpdate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } _, err = fmt.Sscan(args[0], &updateReq.ArtifactType) if err != nil { diff --git a/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go b/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go index feffc1595f7..2ee11c74d41 100644 --- a/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go +++ b/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go @@ -3,7 +3,7 @@ package automatic_cluster_update import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -152,7 +152,7 @@ Update the automatic cluster update setting. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.AutomaticClusterUpdate().Update(ctx, updateReq) diff --git a/cmd/workspace/bundle-deployments/bundle-deployments.go b/cmd/workspace/bundle-deployments/bundle-deployments.go index 204cf2dd738..b320cd9fba8 100644 --- a/cmd/workspace/bundle-deployments/bundle-deployments.go +++ b/cmd/workspace/bundle-deployments/bundle-deployments.go @@ -3,6 +3,7 @@ package bundle_deployments import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -103,7 +104,7 @@ func newCompleteVersion() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME as positional arguments. Provide 'completion_reason' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME as positional arguments. Provide 'completion_reason' in your JSON input") } return nil } @@ -284,7 +285,7 @@ func newCreateOperation() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only PARENT, RESOURCE_KEY as positional arguments. Provide 'action_type', 'status' in your JSON input") + return errors.New("when --json flag is specified, provide only PARENT, RESOURCE_KEY as positional arguments. Provide 'action_type', 'status' in your JSON input") } return nil } @@ -309,7 +310,7 @@ func newCreateOperation() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } createOperationReq.Parent = args[0] @@ -392,7 +393,7 @@ func newCreateVersion() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only PARENT, VERSION_ID as positional arguments. Provide 'cli_version', 'version_type' in your JSON input") + return errors.New("when --json flag is specified, provide only PARENT, VERSION_ID as positional arguments. Provide 'cli_version', 'version_type' in your JSON input") } return nil } diff --git a/cmd/workspace/catalogs/catalogs.go b/cmd/workspace/catalogs/catalogs.go index 9753089ac6e..0bc03d53555 100644 --- a/cmd/workspace/catalogs/catalogs.go +++ b/cmd/workspace/catalogs/catalogs.go @@ -3,6 +3,7 @@ package catalogs import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -97,7 +98,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } diff --git a/cmd/workspace/clean-room-assets/clean-room-assets.go b/cmd/workspace/clean-room-assets/clean-room-assets.go index dffc53ec176..f335be9f485 100644 --- a/cmd/workspace/clean-room-assets/clean-room-assets.go +++ b/cmd/workspace/clean-room-assets/clean-room-assets.go @@ -3,6 +3,7 @@ package clean_room_assets import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -107,7 +108,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only CLEAN_ROOM_NAME as positional arguments. Provide 'name', 'asset_type' in your JSON input") + return errors.New("when --json flag is specified, provide only CLEAN_ROOM_NAME as positional arguments. Provide 'name', 'asset_type' in your JSON input") } return nil } diff --git a/cmd/workspace/clean-room-auto-approval-rules/clean-room-auto-approval-rules.go b/cmd/workspace/clean-room-auto-approval-rules/clean-room-auto-approval-rules.go index 1515694ca64..6ffea68d40d 100644 --- a/cmd/workspace/clean-room-auto-approval-rules/clean-room-auto-approval-rules.go +++ b/cmd/workspace/clean-room-auto-approval-rules/clean-room-auto-approval-rules.go @@ -3,6 +3,7 @@ package clean_room_auto_approval_rules import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -103,7 +104,7 @@ Create an auto-approval rule. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } createReq.CleanRoomName = args[0] diff --git a/cmd/workspace/cluster-policies/cluster-policies.go b/cmd/workspace/cluster-policies/cluster-policies.go index 6cd52d27112..c601693c28c 100644 --- a/cmd/workspace/cluster-policies/cluster-policies.go +++ b/cmd/workspace/cluster-policies/cluster-policies.go @@ -3,6 +3,7 @@ package cluster_policies import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -184,7 +185,7 @@ func newDelete() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'policy_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'policy_id' in your JSON input") } return nil } @@ -223,7 +224,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id of the policy to delete") + return errors.New("expected to have the id of the policy to delete") } deleteReq.PolicyId = args[0] } @@ -290,7 +291,7 @@ func newEdit() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'policy_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'policy_id' in your JSON input") } return nil } @@ -329,7 +330,7 @@ func newEdit() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id of the policy to update") + return errors.New("expected to have the id of the policy to update") } editReq.PolicyId = args[0] @@ -401,7 +402,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have canonical unique identifier for the cluster policy") + return errors.New("expected to have canonical unique identifier for the cluster policy") } getReq.PolicyId = args[0] @@ -472,7 +473,7 @@ func newGetPermissionLevels() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the cluster policy for which to get or manage permissions") + return errors.New("expected to have the cluster policy for which to get or manage permissions") } getPermissionLevelsReq.ClusterPolicyId = args[0] @@ -544,7 +545,7 @@ func newGetPermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the cluster policy for which to get or manage permissions") + return errors.New("expected to have the cluster policy for which to get or manage permissions") } getPermissionsReq.ClusterPolicyId = args[0] @@ -703,7 +704,7 @@ func newSetPermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the cluster policy for which to get or manage permissions") + return errors.New("expected to have the cluster policy for which to get or manage permissions") } setPermissionsReq.ClusterPolicyId = args[0] @@ -792,7 +793,7 @@ func newUpdatePermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the cluster policy for which to get or manage permissions") + return errors.New("expected to have the cluster policy for which to get or manage permissions") } updatePermissionsReq.ClusterPolicyId = args[0] diff --git a/cmd/workspace/clusters/clusters.go b/cmd/workspace/clusters/clusters.go index 467246ca9a5..23d2b79fdd3 100644 --- a/cmd/workspace/clusters/clusters.go +++ b/cmd/workspace/clusters/clusters.go @@ -3,6 +3,7 @@ package clusters import ( + "errors" "fmt" "time" @@ -124,7 +125,7 @@ func newChangeOwner() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id', 'owner_username' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id', 'owner_username' in your JSON input") } return nil } @@ -279,7 +280,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'spark_version' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'spark_version' in your JSON input") } return nil } @@ -382,7 +383,7 @@ func newDelete() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") } return nil } @@ -421,7 +422,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the cluster to be terminated") + return errors.New("expected to have the cluster to be terminated") } deleteReq.ClusterId = args[0] } @@ -556,7 +557,7 @@ func newEdit() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id', 'spark_version' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id', 'spark_version' in your JSON input") } return nil } @@ -673,7 +674,7 @@ func newEvents() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") } return nil } @@ -712,7 +713,7 @@ func newEvents() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id of the cluster to retrieve events about") + return errors.New("expected to have the id of the cluster to retrieve events about") } eventsReq.ClusterId = args[0] @@ -789,7 +790,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the cluster about which to retrieve information") + return errors.New("expected to have the cluster about which to retrieve information") } getReq.ClusterId = args[0] @@ -860,7 +861,7 @@ func newGetPermissionLevels() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the cluster for which to get or manage permissions") + return errors.New("expected to have the cluster for which to get or manage permissions") } getPermissionLevelsReq.ClusterId = args[0] @@ -932,7 +933,7 @@ func newGetPermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the cluster for which to get or manage permissions") + return errors.New("expected to have the cluster for which to get or manage permissions") } getPermissionsReq.ClusterId = args[0] @@ -1161,7 +1162,7 @@ func newPermanentDelete() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") } return nil } @@ -1200,7 +1201,7 @@ func newPermanentDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the cluster to be deleted") + return errors.New("expected to have the cluster to be deleted") } permanentDeleteReq.ClusterId = args[0] } @@ -1257,7 +1258,7 @@ func newPin() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") } return nil } @@ -1296,7 +1297,7 @@ func newPin() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } pinReq.ClusterId = args[0] } @@ -1364,7 +1365,7 @@ func newResize() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") } return nil } @@ -1403,7 +1404,7 @@ func newResize() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the cluster to be resized") + return errors.New("expected to have the cluster to be resized") } resizeReq.ClusterId = args[0] @@ -1483,7 +1484,7 @@ func newRestart() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") } return nil } @@ -1522,7 +1523,7 @@ func newRestart() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the cluster to be started") + return errors.New("expected to have the cluster to be started") } restartReq.ClusterId = args[0] @@ -1625,7 +1626,7 @@ func newSetPermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the cluster for which to get or manage permissions") + return errors.New("expected to have the cluster for which to get or manage permissions") } setPermissionsReq.ClusterId = args[0] @@ -1741,7 +1742,7 @@ func newStart() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") } return nil } @@ -1780,7 +1781,7 @@ func newStart() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the cluster to be started") + return errors.New("expected to have the cluster to be started") } startReq.ClusterId = args[0] } @@ -1849,7 +1850,7 @@ func newUnpin() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") } return nil } @@ -1888,7 +1889,7 @@ func newUnpin() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } unpinReq.ClusterId = args[0] } @@ -1977,7 +1978,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id', 'update_mask' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id', 'update_mask' in your JSON input") } return nil } @@ -2105,7 +2106,7 @@ func newUpdatePermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the cluster for which to get or manage permissions") + return errors.New("expected to have the cluster for which to get or manage permissions") } updatePermissionsReq.ClusterId = args[0] diff --git a/cmd/workspace/compliance-security-profile/compliance-security-profile.go b/cmd/workspace/compliance-security-profile/compliance-security-profile.go index f709c78a1c9..0a87f8a7bc9 100644 --- a/cmd/workspace/compliance-security-profile/compliance-security-profile.go +++ b/cmd/workspace/compliance-security-profile/compliance-security-profile.go @@ -3,7 +3,7 @@ package compliance_security_profile import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -155,7 +155,7 @@ Update the compliance security profile setting. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.ComplianceSecurityProfile().Update(ctx, updateReq) diff --git a/cmd/workspace/connections/connections.go b/cmd/workspace/connections/connections.go index 99220048db1..eaaa91ad7dc 100644 --- a/cmd/workspace/connections/connections.go +++ b/cmd/workspace/connections/connections.go @@ -3,6 +3,7 @@ package connections import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -106,7 +107,7 @@ func newCreate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Connections.Create(ctx, createReq) @@ -176,7 +177,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the name of the connection to be deleted") + return errors.New("expected to have the name of the connection to be deleted") } deleteReq.Name = args[0] @@ -246,7 +247,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have name of the connection") + return errors.New("expected to have name of the connection") } getReq.Name = args[0] @@ -404,7 +405,7 @@ func newUpdate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } updateReq.Name = args[0] diff --git a/cmd/workspace/consumer-installations/consumer-installations.go b/cmd/workspace/consumer-installations/consumer-installations.go index b22738dd062..7325f18f9cc 100644 --- a/cmd/workspace/consumer-installations/consumer-installations.go +++ b/cmd/workspace/consumer-installations/consumer-installations.go @@ -3,6 +3,7 @@ package consumer_installations import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -388,7 +389,7 @@ Update an installation. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } updateReq.ListingId = args[0] updateReq.InstallationId = args[1] diff --git a/cmd/workspace/consumer-listings/consumer-listings.go b/cmd/workspace/consumer-listings/consumer-listings.go index f8113e3532a..691fdada926 100644 --- a/cmd/workspace/consumer-listings/consumer-listings.go +++ b/cmd/workspace/consumer-listings/consumer-listings.go @@ -3,6 +3,7 @@ package consumer_listings import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -152,7 +153,7 @@ Get listing. args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } getReq.Id = args[0] @@ -325,7 +326,7 @@ Search listings. args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have fuzzy matches query") + return errors.New("expected to have fuzzy matches query") } searchReq.Query = args[0] diff --git a/cmd/workspace/consumer-personalization-requests/consumer-personalization-requests.go b/cmd/workspace/consumer-personalization-requests/consumer-personalization-requests.go index c1bbdc047d0..ff2f4c0e55c 100644 --- a/cmd/workspace/consumer-personalization-requests/consumer-personalization-requests.go +++ b/cmd/workspace/consumer-personalization-requests/consumer-personalization-requests.go @@ -3,6 +3,7 @@ package consumer_personalization_requests import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -104,7 +105,7 @@ Create a personalization request. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } createReq.ListingId = args[0] diff --git a/cmd/workspace/consumer-providers/consumer-providers.go b/cmd/workspace/consumer-providers/consumer-providers.go index 4dc372d24d4..03ee75f84ce 100644 --- a/cmd/workspace/consumer-providers/consumer-providers.go +++ b/cmd/workspace/consumer-providers/consumer-providers.go @@ -3,6 +3,7 @@ package consumer_providers import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -150,7 +151,7 @@ Get a provider. args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } getReq.Id = args[0] diff --git a/cmd/workspace/credentials-manager/credentials-manager.go b/cmd/workspace/credentials-manager/credentials-manager.go index 67386dcecc1..6c960ed692f 100644 --- a/cmd/workspace/credentials-manager/credentials-manager.go +++ b/cmd/workspace/credentials-manager/credentials-manager.go @@ -3,7 +3,7 @@ package credentials_manager import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -101,7 +101,7 @@ func newExchangeToken() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.CredentialsManager.ExchangeToken(ctx, exchangeTokenReq) diff --git a/cmd/workspace/credentials/credentials.go b/cmd/workspace/credentials/credentials.go index e8ba0edc4dc..60348246c1b 100644 --- a/cmd/workspace/credentials/credentials.go +++ b/cmd/workspace/credentials/credentials.go @@ -3,6 +3,7 @@ package credentials import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -103,7 +104,7 @@ func newCreateCredential() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } @@ -252,7 +253,7 @@ func newGenerateTemporaryServiceCredential() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'credential_name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'credential_name' in your JSON input") } return nil } diff --git a/cmd/workspace/dashboard-email-subscriptions/dashboard-email-subscriptions.go b/cmd/workspace/dashboard-email-subscriptions/dashboard-email-subscriptions.go index 5da81d45bb1..b8cb554761f 100644 --- a/cmd/workspace/dashboard-email-subscriptions/dashboard-email-subscriptions.go +++ b/cmd/workspace/dashboard-email-subscriptions/dashboard-email-subscriptions.go @@ -3,7 +3,7 @@ package dashboard_email_subscriptions import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -208,7 +208,7 @@ Update the Dashboard Email Subscriptions setting. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.DashboardEmailSubscriptions().Update(ctx, updateReq) diff --git a/cmd/workspace/dashboard-widgets/dashboard-widgets.go b/cmd/workspace/dashboard-widgets/dashboard-widgets.go index 891896c02b2..f84e3ca71ea 100644 --- a/cmd/workspace/dashboard-widgets/dashboard-widgets.go +++ b/cmd/workspace/dashboard-widgets/dashboard-widgets.go @@ -3,7 +3,7 @@ package dashboard_widgets import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -95,7 +95,7 @@ func newCreate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.DashboardWidgets.Create(ctx, createReq) @@ -231,7 +231,7 @@ func newUpdate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } updateReq.Id = args[0] diff --git a/cmd/workspace/data-quality/data-quality.go b/cmd/workspace/data-quality/data-quality.go index 7d3e85a110d..b7ed15b8acb 100644 --- a/cmd/workspace/data-quality/data-quality.go +++ b/cmd/workspace/data-quality/data-quality.go @@ -3,6 +3,7 @@ package data_quality import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -218,7 +219,7 @@ Create a monitor. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'object_type', 'object_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'object_type', 'object_id' in your JSON input") } return nil } @@ -996,7 +997,7 @@ Update a monitor. if cmd.Flags().Changed("json") { err := root.ExactArgs(3)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only OBJECT_TYPE, OBJECT_ID, UPDATE_MASK as positional arguments. Provide 'object_type', 'object_id' in your JSON input") + return errors.New("when --json flag is specified, provide only OBJECT_TYPE, OBJECT_ID, UPDATE_MASK as positional arguments. Provide 'object_type', 'object_id' in your JSON input") } return nil } @@ -1121,7 +1122,7 @@ Update a refresh. if cmd.Flags().Changed("json") { err := root.ExactArgs(4)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only OBJECT_TYPE, OBJECT_ID, REFRESH_ID, UPDATE_MASK as positional arguments. Provide 'object_type', 'object_id' in your JSON input") + return errors.New("when --json flag is specified, provide only OBJECT_TYPE, OBJECT_ID, REFRESH_ID, UPDATE_MASK as positional arguments. Provide 'object_type', 'object_id' in your JSON input") } return nil } diff --git a/cmd/workspace/database/database.go b/cmd/workspace/database/database.go index ef18c20038a..7171e0421cd 100644 --- a/cmd/workspace/database/database.go +++ b/cmd/workspace/database/database.go @@ -3,6 +3,7 @@ package database import ( + "errors" "fmt" "time" @@ -106,7 +107,7 @@ Create a Database Catalog. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'database_instance_name', 'database_name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'database_instance_name', 'database_name' in your JSON input") } return nil } @@ -214,7 +215,7 @@ Create a Database Instance. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } @@ -320,7 +321,7 @@ func newCreateDatabaseInstanceRole() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only INSTANCE_NAME as positional arguments. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, provide only INSTANCE_NAME as positional arguments. Provide 'name' in your JSON input") } return nil } @@ -412,7 +413,7 @@ Create a Database Table. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } @@ -501,7 +502,7 @@ Create a Synced Database Table. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } @@ -1605,7 +1606,7 @@ func newUpdateDatabaseCatalog() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'name', 'database_instance_name', 'database_name' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'name', 'database_instance_name', 'database_name' in your JSON input") } return nil } diff --git a/cmd/workspace/default-namespace/default-namespace.go b/cmd/workspace/default-namespace/default-namespace.go index 963d944d1f7..c0ebe0ed600 100644 --- a/cmd/workspace/default-namespace/default-namespace.go +++ b/cmd/workspace/default-namespace/default-namespace.go @@ -3,7 +3,7 @@ package default_namespace import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -227,7 +227,7 @@ Update the default namespace setting. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.DefaultNamespace().Update(ctx, updateReq) diff --git a/cmd/workspace/default-warehouse-id/default-warehouse-id.go b/cmd/workspace/default-warehouse-id/default-warehouse-id.go index b22d987e747..491ac6b972c 100644 --- a/cmd/workspace/default-warehouse-id/default-warehouse-id.go +++ b/cmd/workspace/default-warehouse-id/default-warehouse-id.go @@ -3,7 +3,7 @@ package default_warehouse_id import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -202,7 +202,7 @@ func newUpdate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.DefaultWarehouseId().Update(ctx, updateReq) diff --git a/cmd/workspace/disable-legacy-access/disable-legacy-access.go b/cmd/workspace/disable-legacy-access/disable-legacy-access.go index 64bf8fd34c8..5a4c9639605 100644 --- a/cmd/workspace/disable-legacy-access/disable-legacy-access.go +++ b/cmd/workspace/disable-legacy-access/disable-legacy-access.go @@ -3,7 +3,7 @@ package disable_legacy_access import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -203,7 +203,7 @@ func newUpdate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.DisableLegacyAccess().Update(ctx, updateReq) diff --git a/cmd/workspace/disable-legacy-dbfs/disable-legacy-dbfs.go b/cmd/workspace/disable-legacy-dbfs/disable-legacy-dbfs.go index a57d63a451d..b624e1bffa8 100644 --- a/cmd/workspace/disable-legacy-dbfs/disable-legacy-dbfs.go +++ b/cmd/workspace/disable-legacy-dbfs/disable-legacy-dbfs.go @@ -3,7 +3,7 @@ package disable_legacy_dbfs import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -207,7 +207,7 @@ func newUpdate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.DisableLegacyDbfs().Update(ctx, updateReq) diff --git a/cmd/workspace/enable-export-notebook/enable-export-notebook.go b/cmd/workspace/enable-export-notebook/enable-export-notebook.go index 870cc7c0393..234e724440d 100644 --- a/cmd/workspace/enable-export-notebook/enable-export-notebook.go +++ b/cmd/workspace/enable-export-notebook/enable-export-notebook.go @@ -3,7 +3,7 @@ package enable_export_notebook import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -139,7 +139,7 @@ Update the Notebook and File exporting setting. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.EnableExportNotebook().PatchEnableExportNotebook(ctx, patchEnableExportNotebookReq) diff --git a/cmd/workspace/enable-notebook-table-clipboard/enable-notebook-table-clipboard.go b/cmd/workspace/enable-notebook-table-clipboard/enable-notebook-table-clipboard.go index 16e8d259ee8..48e11680f9f 100644 --- a/cmd/workspace/enable-notebook-table-clipboard/enable-notebook-table-clipboard.go +++ b/cmd/workspace/enable-notebook-table-clipboard/enable-notebook-table-clipboard.go @@ -3,7 +3,7 @@ package enable_notebook_table_clipboard import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -139,7 +139,7 @@ Update the Results Table Clipboard features setting. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.EnableNotebookTableClipboard().PatchEnableNotebookTableClipboard(ctx, patchEnableNotebookTableClipboardReq) diff --git a/cmd/workspace/enable-results-downloading/enable-results-downloading.go b/cmd/workspace/enable-results-downloading/enable-results-downloading.go index 8fe558e306f..9d417344d76 100644 --- a/cmd/workspace/enable-results-downloading/enable-results-downloading.go +++ b/cmd/workspace/enable-results-downloading/enable-results-downloading.go @@ -3,7 +3,7 @@ package enable_results_downloading import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -139,7 +139,7 @@ Update the Notebook results download setting. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.EnableResultsDownloading().PatchEnableResultsDownloading(ctx, patchEnableResultsDownloadingReq) diff --git a/cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go b/cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go index 7beea5f4431..ee5eb69c722 100644 --- a/cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go +++ b/cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go @@ -3,7 +3,7 @@ package enhanced_security_monitoring import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -157,7 +157,7 @@ Update the enhanced security monitoring setting. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.EnhancedSecurityMonitoring().Update(ctx, updateReq) diff --git a/cmd/workspace/entity-tag-assignments/entity-tag-assignments.go b/cmd/workspace/entity-tag-assignments/entity-tag-assignments.go index b269222fcce..d7caf1bbab7 100644 --- a/cmd/workspace/entity-tag-assignments/entity-tag-assignments.go +++ b/cmd/workspace/entity-tag-assignments/entity-tag-assignments.go @@ -3,6 +3,7 @@ package entity_tag_assignments import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -98,7 +99,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'entity_name', 'tag_key', 'entity_type' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'entity_name', 'tag_key', 'entity_type' in your JSON input") } return nil } diff --git a/cmd/workspace/environments/environments.go b/cmd/workspace/environments/environments.go index 2b317a13450..a11d550a52d 100644 --- a/cmd/workspace/environments/environments.go +++ b/cmd/workspace/environments/environments.go @@ -3,6 +3,7 @@ package environments import ( + "errors" "fmt" "strings" "time" @@ -114,7 +115,7 @@ func newCreateWorkspaceBaseEnvironment() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'display_name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'display_name' in your JSON input") } return nil } @@ -773,7 +774,7 @@ func newUpdateWorkspaceBaseEnvironment() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME as positional arguments. Provide 'display_name' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME as positional arguments. Provide 'display_name' in your JSON input") } return nil } diff --git a/cmd/workspace/experiments/experiments.go b/cmd/workspace/experiments/experiments.go index 6875a03b588..c52160e1cff 100644 --- a/cmd/workspace/experiments/experiments.go +++ b/cmd/workspace/experiments/experiments.go @@ -3,6 +3,7 @@ package experiments import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -131,7 +132,7 @@ func newCreateExperiment() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } @@ -218,7 +219,7 @@ func newCreateLoggedModel() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'experiment_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'experiment_id' in your JSON input") } return nil } @@ -382,7 +383,7 @@ func newDeleteExperiment() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'experiment_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'experiment_id' in your JSON input") } return nil } @@ -578,7 +579,7 @@ func newDeleteRun() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'run_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'run_id' in your JSON input") } return nil } @@ -667,7 +668,7 @@ func newDeleteRuns() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'experiment_id', 'max_timestamp_millis' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'experiment_id', 'max_timestamp_millis' in your JSON input") } return nil } @@ -759,7 +760,7 @@ func newDeleteTag() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'run_id', 'key' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'run_id', 'key' in your JSON input") } return nil } @@ -846,7 +847,7 @@ func newFinalizeLoggedModel() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only MODEL_ID as positional arguments. Provide 'status' in your JSON input") + return errors.New("when --json flag is specified, provide only MODEL_ID as positional arguments. Provide 'status' in your JSON input") } return nil } @@ -1646,7 +1647,7 @@ func newLogInputs() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'run_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'run_id' in your JSON input") } return nil } @@ -1817,7 +1818,7 @@ func newLogMetric() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'key', 'value', 'timestamp' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'key', 'value', 'timestamp' in your JSON input") } return nil } @@ -1991,7 +1992,7 @@ func newLogOutputs() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'run_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'run_id' in your JSON input") } return nil } @@ -2080,7 +2081,7 @@ func newLogParam() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'key', 'value' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'key', 'value' in your JSON input") } return nil } @@ -2170,7 +2171,7 @@ func newRestoreExperiment() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'experiment_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'experiment_id' in your JSON input") } return nil } @@ -2256,7 +2257,7 @@ func newRestoreRun() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'run_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'run_id' in your JSON input") } return nil } @@ -2345,7 +2346,7 @@ func newRestoreRuns() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'experiment_id', 'min_timestamp_millis' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'experiment_id', 'min_timestamp_millis' in your JSON input") } return nil } @@ -2696,7 +2697,7 @@ func newSetExperimentTag() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'experiment_id', 'key', 'value' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'experiment_id', 'key', 'value' in your JSON input") } return nil } @@ -2941,7 +2942,7 @@ func newSetTag() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'key', 'value' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'key', 'value' in your JSON input") } return nil } @@ -3028,7 +3029,7 @@ func newUpdateExperiment() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'experiment_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'experiment_id' in your JSON input") } return nil } diff --git a/cmd/workspace/external-lineage/external-lineage.go b/cmd/workspace/external-lineage/external-lineage.go index c724701a0d9..7d6cec7c938 100644 --- a/cmd/workspace/external-lineage/external-lineage.go +++ b/cmd/workspace/external-lineage/external-lineage.go @@ -3,6 +3,7 @@ package external_lineage import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -94,7 +95,7 @@ Create an external lineage relationship. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'source', 'target' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'source', 'target' in your JSON input") } return nil } @@ -201,7 +202,7 @@ Delete an external lineage relationship. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } err = w.ExternalLineage.DeleteExternalLineageRelationship(ctx, deleteExternalLineageRelationshipReq) @@ -283,7 +284,7 @@ List external lineage relationships. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response := w.ExternalLineage.ListExternalLineageRelationships(ctx, listExternalLineageRelationshipsReq) @@ -362,7 +363,7 @@ Update an external lineage relationship. if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only UPDATE_MASK as positional arguments. Provide 'source', 'target' in your JSON input") + return errors.New("when --json flag is specified, provide only UPDATE_MASK as positional arguments. Provide 'source', 'target' in your JSON input") } return nil } diff --git a/cmd/workspace/external-locations/external-locations.go b/cmd/workspace/external-locations/external-locations.go index 8eee537d08e..edd702cb4ec 100644 --- a/cmd/workspace/external-locations/external-locations.go +++ b/cmd/workspace/external-locations/external-locations.go @@ -3,6 +3,7 @@ package external_locations import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -104,7 +105,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'url', 'credential_name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'url', 'credential_name' in your JSON input") } return nil } diff --git a/cmd/workspace/external-metadata/external-metadata.go b/cmd/workspace/external-metadata/external-metadata.go index d51817902d1..3d8e7dac3db 100644 --- a/cmd/workspace/external-metadata/external-metadata.go +++ b/cmd/workspace/external-metadata/external-metadata.go @@ -3,6 +3,7 @@ package external_metadata import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -125,7 +126,7 @@ Create an external metadata object. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'system_type', 'entity_type' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'system_type', 'entity_type' in your JSON input") } return nil } @@ -464,7 +465,7 @@ Update an external metadata object. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'name', 'system_type', 'entity_type' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'name', 'system_type', 'entity_type' in your JSON input") } return nil } diff --git a/cmd/workspace/feature-engineering/feature-engineering.go b/cmd/workspace/feature-engineering/feature-engineering.go index 61497c9c5f3..131bef26c49 100644 --- a/cmd/workspace/feature-engineering/feature-engineering.go +++ b/cmd/workspace/feature-engineering/feature-engineering.go @@ -3,6 +3,7 @@ package feature_engineering import ( + "errors" "fmt" "strings" @@ -112,7 +113,7 @@ func newCreateFeature() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'full_name', 'source', 'function' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'full_name', 'source', 'function' in your JSON input") } return nil } @@ -223,7 +224,7 @@ func newCreateKafkaConfig() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'bootstrap_servers', 'subscription_mode', 'auth_config' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'bootstrap_servers', 'subscription_mode', 'auth_config' in your JSON input") } return nil } @@ -331,7 +332,7 @@ func newCreateMaterializedFeature() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'feature_name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'feature_name' in your JSON input") } return nil } @@ -425,7 +426,7 @@ func newCreateStream() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'source_config', 'connection_config', 'schema_config', 'ingestion_config' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'source_config', 'connection_config', 'schema_config', 'ingestion_config' in your JSON input") } return nil } @@ -1307,7 +1308,7 @@ func newUpdateFeature() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only FULL_NAME, UPDATE_MASK as positional arguments. Provide 'full_name', 'source', 'function' in your JSON input") + return errors.New("when --json flag is specified, provide only FULL_NAME, UPDATE_MASK as positional arguments. Provide 'full_name', 'source', 'function' in your JSON input") } return nil } @@ -1418,7 +1419,7 @@ func newUpdateKafkaConfig() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'name', 'bootstrap_servers', 'subscription_mode', 'auth_config' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'name', 'bootstrap_servers', 'subscription_mode', 'auth_config' in your JSON input") } return nil } @@ -1533,7 +1534,7 @@ func newUpdateMaterializedFeature() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only MATERIALIZED_FEATURE_ID, UPDATE_MASK as positional arguments. Provide 'feature_name' in your JSON input") + return errors.New("when --json flag is specified, provide only MATERIALIZED_FEATURE_ID, UPDATE_MASK as positional arguments. Provide 'feature_name' in your JSON input") } return nil } @@ -1629,7 +1630,7 @@ func newUpdateStream() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'name', 'source_config', 'connection_config', 'schema_config', 'ingestion_config' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'name', 'source_config', 'connection_config', 'schema_config', 'ingestion_config' in your JSON input") } return nil } diff --git a/cmd/workspace/feature-store/feature-store.go b/cmd/workspace/feature-store/feature-store.go index dbd4e581a59..bd7800999f9 100644 --- a/cmd/workspace/feature-store/feature-store.go +++ b/cmd/workspace/feature-store/feature-store.go @@ -3,6 +3,7 @@ package feature_store import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -95,7 +96,7 @@ func newCreateOnlineStore() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'capacity' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'capacity' in your JSON input") } return nil } @@ -436,7 +437,7 @@ func newPublishTable() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } publishTableReq.SourceTableName = args[0] @@ -500,7 +501,7 @@ func newUpdateOnlineStore() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'name', 'capacity' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'name', 'capacity' in your JSON input") } return nil } diff --git a/cmd/workspace/forecasting/forecasting.go b/cmd/workspace/forecasting/forecasting.go index c284a717bf6..29aa8a08fba 100644 --- a/cmd/workspace/forecasting/forecasting.go +++ b/cmd/workspace/forecasting/forecasting.go @@ -3,6 +3,7 @@ package forecasting import ( + "errors" "fmt" "time" @@ -114,7 +115,7 @@ func newCreateExperiment() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'train_data_path', 'target_column', 'time_column', 'forecast_granularity', 'forecast_horizon' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'train_data_path', 'target_column', 'time_column', 'forecast_granularity', 'forecast_horizon' in your JSON input") } return nil } diff --git a/cmd/workspace/functions/functions.go b/cmd/workspace/functions/functions.go index fc70bd717ca..4b00519ea87 100644 --- a/cmd/workspace/functions/functions.go +++ b/cmd/workspace/functions/functions.go @@ -3,6 +3,7 @@ package functions import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -100,7 +101,7 @@ func newCreate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Functions.Create(ctx, createReq) @@ -178,7 +179,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the fully-qualified name of the function (of the form __catalog_name__.__schema_name__.__function__name__) ") + return errors.New("expected to have the fully-qualified name of the function (of the form __catalog_name__.__schema_name__.__function__name__) ") } deleteReq.Name = args[0] @@ -257,7 +258,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the fully-qualified name of the function (of the form __catalog_name__.__schema_name__.__function__name__)") + return errors.New("expected to have the fully-qualified name of the function (of the form __catalog_name__.__schema_name__.__function__name__)") } getReq.Name = args[0] @@ -446,7 +447,7 @@ func newUpdate() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the fully-qualified name of the function (of the form __catalog_name__.__schema_name__.__function__name__)") + return errors.New("expected to have the fully-qualified name of the function (of the form __catalog_name__.__schema_name__.__function__name__)") } updateReq.Name = args[0] diff --git a/cmd/workspace/genie/genie.go b/cmd/workspace/genie/genie.go index ae4d9ad32ed..4b02963878c 100644 --- a/cmd/workspace/genie/genie.go +++ b/cmd/workspace/genie/genie.go @@ -3,6 +3,7 @@ package genie import ( + "errors" "fmt" "time" @@ -120,7 +121,7 @@ func newCreateMessage() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only SPACE_ID, CONVERSATION_ID as positional arguments. Provide 'content' in your JSON input") + return errors.New("when --json flag is specified, provide only SPACE_ID, CONVERSATION_ID as positional arguments. Provide 'content' in your JSON input") } return nil } @@ -222,7 +223,7 @@ Create message comment. if cmd.Flags().Changed("json") { err := root.ExactArgs(3)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only SPACE_ID, CONVERSATION_ID, MESSAGE_ID as positional arguments. Provide 'content' in your JSON input") + return errors.New("when --json flag is specified, provide only SPACE_ID, CONVERSATION_ID, MESSAGE_ID as positional arguments. Provide 'content' in your JSON input") } return nil } @@ -317,7 +318,7 @@ func newCreateSpace() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'warehouse_id', 'serialized_space' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'warehouse_id', 'serialized_space' in your JSON input") } return nil } @@ -1897,7 +1898,7 @@ func newSendMessageFeedback() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(3)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only SPACE_ID, CONVERSATION_ID, MESSAGE_ID as positional arguments. Provide 'rating' in your JSON input") + return errors.New("when --json flag is specified, provide only SPACE_ID, CONVERSATION_ID, MESSAGE_ID as positional arguments. Provide 'rating' in your JSON input") } return nil } @@ -1996,7 +1997,7 @@ func newStartConversation() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only SPACE_ID as positional arguments. Provide 'content' in your JSON input") + return errors.New("when --json flag is specified, provide only SPACE_ID as positional arguments. Provide 'content' in your JSON input") } return nil } diff --git a/cmd/workspace/git-credentials/git-credentials.go b/cmd/workspace/git-credentials/git-credentials.go index 9b5618b501d..e942ef21180 100644 --- a/cmd/workspace/git-credentials/git-credentials.go +++ b/cmd/workspace/git-credentials/git-credentials.go @@ -3,6 +3,7 @@ package git_credentials import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -97,7 +98,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'git_provider' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'git_provider' in your JSON input") } return nil } @@ -195,7 +196,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id for the corresponding credential to access") + return errors.New("expected to have the id for the corresponding credential to access") } _, err = fmt.Sscan(args[0], &deleteReq.CredentialId) if err != nil { @@ -270,7 +271,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id for the corresponding credential to access") + return errors.New("expected to have the id for the corresponding credential to access") } _, err = fmt.Sscan(args[0], &getReq.CredentialId) if err != nil { @@ -412,7 +413,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only CREDENTIAL_ID as positional arguments. Provide 'git_provider' in your JSON input") + return errors.New("when --json flag is specified, provide only CREDENTIAL_ID as positional arguments. Provide 'git_provider' in your JSON input") } return nil } diff --git a/cmd/workspace/global-init-scripts/global-init-scripts.go b/cmd/workspace/global-init-scripts/global-init-scripts.go index 3097c739cf1..674173ea22b 100644 --- a/cmd/workspace/global-init-scripts/global-init-scripts.go +++ b/cmd/workspace/global-init-scripts/global-init-scripts.go @@ -3,6 +3,7 @@ package global_init_scripts import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -91,7 +92,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'script' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'script' in your JSON input") } return nil } @@ -190,7 +191,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id of the global init script") + return errors.New("expected to have the id of the global init script") } deleteReq.ScriptId = args[0] @@ -260,7 +261,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id of the global init script") + return errors.New("expected to have the id of the global init script") } getReq.ScriptId = args[0] @@ -384,7 +385,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only SCRIPT_ID as positional arguments. Provide 'name', 'script' in your JSON input") + return errors.New("when --json flag is specified, provide only SCRIPT_ID as positional arguments. Provide 'name', 'script' in your JSON input") } return nil } diff --git a/cmd/workspace/instance-pools/instance-pools.go b/cmd/workspace/instance-pools/instance-pools.go index 9af0ac7714a..2a82286747c 100644 --- a/cmd/workspace/instance-pools/instance-pools.go +++ b/cmd/workspace/instance-pools/instance-pools.go @@ -3,6 +3,7 @@ package instance_pools import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -121,7 +122,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'instance_pool_name', 'node_type_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'instance_pool_name', 'node_type_id' in your JSON input") } return nil } @@ -208,7 +209,7 @@ func newDelete() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'instance_pool_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'instance_pool_id' in your JSON input") } return nil } @@ -247,7 +248,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the instance pool to be terminated") + return errors.New("expected to have the instance pool to be terminated") } deleteReq.InstancePoolId = args[0] } @@ -319,7 +320,7 @@ func newEdit() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'instance_pool_id', 'instance_pool_name', 'node_type_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'instance_pool_id', 'instance_pool_name', 'node_type_id' in your JSON input") } return nil } @@ -420,7 +421,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the canonical unique identifier for the instance pool") + return errors.New("expected to have the canonical unique identifier for the instance pool") } getReq.InstancePoolId = args[0] @@ -491,7 +492,7 @@ func newGetPermissionLevels() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the instance pool for which to get or manage permissions") + return errors.New("expected to have the instance pool for which to get or manage permissions") } getPermissionLevelsReq.InstancePoolId = args[0] @@ -563,7 +564,7 @@ func newGetPermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the instance pool for which to get or manage permissions") + return errors.New("expected to have the instance pool for which to get or manage permissions") } getPermissionsReq.InstancePoolId = args[0] @@ -710,7 +711,7 @@ func newSetPermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the instance pool for which to get or manage permissions") + return errors.New("expected to have the instance pool for which to get or manage permissions") } setPermissionsReq.InstancePoolId = args[0] @@ -799,7 +800,7 @@ func newUpdatePermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the instance pool for which to get or manage permissions") + return errors.New("expected to have the instance pool for which to get or manage permissions") } updatePermissionsReq.InstancePoolId = args[0] diff --git a/cmd/workspace/instance-profiles/instance-profiles.go b/cmd/workspace/instance-profiles/instance-profiles.go index d16a69d0c9d..8ddbdaf8f2f 100644 --- a/cmd/workspace/instance-profiles/instance-profiles.go +++ b/cmd/workspace/instance-profiles/instance-profiles.go @@ -3,6 +3,7 @@ package instance_profiles import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -91,7 +92,7 @@ func newAdd() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'instance_profile_arn' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'instance_profile_arn' in your JSON input") } return nil } @@ -191,7 +192,7 @@ func newEdit() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'instance_profile_arn' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'instance_profile_arn' in your JSON input") } return nil } @@ -335,7 +336,7 @@ func newRemove() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'instance_profile_arn' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'instance_profile_arn' in your JSON input") } return nil } diff --git a/cmd/workspace/ip-access-lists/ip-access-lists.go b/cmd/workspace/ip-access-lists/ip-access-lists.go index 0fd26430b67..ac663726564 100644 --- a/cmd/workspace/ip-access-lists/ip-access-lists.go +++ b/cmd/workspace/ip-access-lists/ip-access-lists.go @@ -3,6 +3,7 @@ package ip_access_lists import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -119,7 +120,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'label', 'list_type' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'label', 'list_type' in your JSON input") } return nil } @@ -222,7 +223,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id for the corresponding ip access list") + return errors.New("expected to have the id for the corresponding ip access list") } deleteReq.IpAccessListId = args[0] @@ -292,7 +293,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id for the corresponding ip access list") + return errors.New("expected to have the id for the corresponding ip access list") } getReq.IpAccessListId = args[0] @@ -424,7 +425,7 @@ func newReplace() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only IP_ACCESS_LIST_ID as positional arguments. Provide 'label', 'list_type', 'enabled' in your JSON input") + return errors.New("when --json flag is specified, provide only IP_ACCESS_LIST_ID as positional arguments. Provide 'label', 'list_type', 'enabled' in your JSON input") } return nil } @@ -569,7 +570,7 @@ func newUpdate() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id for the corresponding ip access list") + return errors.New("expected to have the id for the corresponding ip access list") } updateReq.IpAccessListId = args[0] diff --git a/cmd/workspace/jobs/jobs.go b/cmd/workspace/jobs/jobs.go index be26fc586d0..0f9ec046da5 100644 --- a/cmd/workspace/jobs/jobs.go +++ b/cmd/workspace/jobs/jobs.go @@ -3,6 +3,7 @@ package jobs import ( + "errors" "fmt" "time" @@ -192,7 +193,7 @@ func newCancelRun() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'run_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'run_id' in your JSON input") } return nil } @@ -231,7 +232,7 @@ func newCancelRun() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have this field is required") + return errors.New("expected to have this field is required") } _, err = fmt.Sscan(args[0], &cancelRunReq.RunId) if err != nil { @@ -320,7 +321,7 @@ func newCreate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Jobs.Create(ctx, createReq) @@ -377,7 +378,7 @@ func newDelete() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'job_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'job_id' in your JSON input") } return nil } @@ -416,7 +417,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the canonical identifier of the job to delete") + return errors.New("expected to have the canonical identifier of the job to delete") } _, err = fmt.Sscan(args[0], &deleteReq.JobId) if err != nil { @@ -478,7 +479,7 @@ func newDeleteRun() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'run_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'run_id' in your JSON input") } return nil } @@ -517,7 +518,7 @@ func newDeleteRun() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have id of the run to delete") + return errors.New("expected to have id of the run to delete") } _, err = fmt.Sscan(args[0], &deleteRunReq.RunId) if err != nil { @@ -594,7 +595,7 @@ func newExportRun() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the canonical identifier for the run") + return errors.New("expected to have the canonical identifier for the run") } _, err = fmt.Sscan(args[0], &exportRunReq.RunId) if err != nil { @@ -681,7 +682,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the canonical identifier of the job to retrieve information about") + return errors.New("expected to have the canonical identifier of the job to retrieve information about") } _, err = fmt.Sscan(args[0], &getReq.JobId) if err != nil { @@ -755,7 +756,7 @@ func newGetPermissionLevels() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the job for which to get or manage permissions") + return errors.New("expected to have the job for which to get or manage permissions") } getPermissionLevelsReq.JobId = args[0] @@ -827,7 +828,7 @@ func newGetPermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the job for which to get or manage permissions") + return errors.New("expected to have the job for which to get or manage permissions") } getPermissionsReq.JobId = args[0] @@ -912,7 +913,7 @@ func newGetRun() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the canonical identifier of the run for which to retrieve the metadata") + return errors.New("expected to have the canonical identifier of the run for which to retrieve the metadata") } _, err = fmt.Sscan(args[0], &getRunReq.RunId) if err != nil { @@ -995,7 +996,7 @@ func newGetRunOutput() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the canonical identifier for the run") + return errors.New("expected to have the canonical identifier for the run") } _, err = fmt.Sscan(args[0], &getRunOutputReq.RunId) if err != nil { @@ -1232,7 +1233,7 @@ func newRepairRun() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'run_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'run_id' in your JSON input") } return nil } @@ -1271,7 +1272,7 @@ func newRepairRun() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the job run id of the run to repair") + return errors.New("expected to have the job run id of the run to repair") } _, err = fmt.Sscan(args[0], &repairRunReq.RunId) if err != nil { @@ -1363,7 +1364,7 @@ func newReset() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } err = w.Jobs.Reset(ctx, resetReq) @@ -1439,7 +1440,7 @@ func newRunNow() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'job_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'job_id' in your JSON input") } return nil } @@ -1478,7 +1479,7 @@ func newRunNow() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id of the job to be executed") + return errors.New("expected to have the id of the job to be executed") } _, err = fmt.Sscan(args[0], &runNowReq.JobId) if err != nil { @@ -1591,7 +1592,7 @@ func newSetPermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the job for which to get or manage permissions") + return errors.New("expected to have the job for which to get or manage permissions") } setPermissionsReq.JobId = args[0] @@ -1773,7 +1774,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'job_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'job_id' in your JSON input") } return nil } @@ -1812,7 +1813,7 @@ func newUpdate() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the canonical identifier of the job to update") + return errors.New("expected to have the canonical identifier of the job to update") } _, err = fmt.Sscan(args[0], &updateReq.JobId) if err != nil { @@ -1905,7 +1906,7 @@ func newUpdatePermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the job for which to get or manage permissions") + return errors.New("expected to have the job for which to get or manage permissions") } updatePermissionsReq.JobId = args[0] diff --git a/cmd/workspace/knowledge-assistants/knowledge-assistants.go b/cmd/workspace/knowledge-assistants/knowledge-assistants.go index 299571c4ae5..3714ee727e8 100644 --- a/cmd/workspace/knowledge-assistants/knowledge-assistants.go +++ b/cmd/workspace/knowledge-assistants/knowledge-assistants.go @@ -3,6 +3,7 @@ package knowledge_assistants import ( + "errors" "fmt" "strings" @@ -106,7 +107,7 @@ Create an example for a Knowledge Assistant. if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only PARENT as positional arguments. Provide 'question' in your JSON input") + return errors.New("when --json flag is specified, provide only PARENT as positional arguments. Provide 'question' in your JSON input") } return nil } @@ -201,7 +202,7 @@ Create a Knowledge Assistant. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'display_name', 'description' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'display_name', 'description' in your JSON input") } return nil } @@ -305,7 +306,7 @@ Create a Knowledge Source. if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only PARENT as positional arguments. Provide 'display_name', 'description', 'source_type' in your JSON input") + return errors.New("when --json flag is specified, provide only PARENT as positional arguments. Provide 'display_name', 'description', 'source_type' in your JSON input") } return nil } @@ -1267,7 +1268,7 @@ Update an example in a Knowledge Assistant. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'question' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'question' in your JSON input") } return nil } @@ -1371,7 +1372,7 @@ Update a Knowledge Assistant. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'display_name', 'description' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'display_name', 'description' in your JSON input") } return nil } @@ -1483,7 +1484,7 @@ Update a Knowledge Source. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'display_name', 'description', 'source_type' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'display_name', 'description', 'source_type' in your JSON input") } return nil } diff --git a/cmd/workspace/lakeview/lakeview.go b/cmd/workspace/lakeview/lakeview.go index 7c0e40c1320..4b9949392d6 100644 --- a/cmd/workspace/lakeview/lakeview.go +++ b/cmd/workspace/lakeview/lakeview.go @@ -3,6 +3,7 @@ package lakeview import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -177,7 +178,7 @@ func newCreateSchedule() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only DASHBOARD_ID as positional arguments. Provide 'cron_schedule' in your JSON input") + return errors.New("when --json flag is specified, provide only DASHBOARD_ID as positional arguments. Provide 'cron_schedule' in your JSON input") } return nil } @@ -269,7 +270,7 @@ func newCreateSubscription() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only DASHBOARD_ID, SCHEDULE_ID as positional arguments. Provide 'subscriber' in your JSON input") + return errors.New("when --json flag is specified, provide only DASHBOARD_ID, SCHEDULE_ID as positional arguments. Provide 'subscriber' in your JSON input") } return nil } @@ -940,7 +941,7 @@ func newMigrate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'source_dashboard_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'source_dashboard_id' in your JSON input") } return nil } @@ -1377,7 +1378,7 @@ func newUpdateSchedule() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only DASHBOARD_ID, SCHEDULE_ID as positional arguments. Provide 'cron_schedule' in your JSON input") + return errors.New("when --json flag is specified, provide only DASHBOARD_ID, SCHEDULE_ID as positional arguments. Provide 'cron_schedule' in your JSON input") } return nil } diff --git a/cmd/workspace/libraries/libraries.go b/cmd/workspace/libraries/libraries.go index 32511997395..92b71e73019 100644 --- a/cmd/workspace/libraries/libraries.go +++ b/cmd/workspace/libraries/libraries.go @@ -3,6 +3,7 @@ package libraries import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -239,7 +240,7 @@ func newInstall() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } err = w.Libraries.Install(ctx, installReq) @@ -307,7 +308,7 @@ func newUninstall() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } err = w.Libraries.Uninstall(ctx, uninstallReq) diff --git a/cmd/workspace/llm-proxy-partner-powered-workspace/llm-proxy-partner-powered-workspace.go b/cmd/workspace/llm-proxy-partner-powered-workspace/llm-proxy-partner-powered-workspace.go index 0733e480083..e7186373e02 100644 --- a/cmd/workspace/llm-proxy-partner-powered-workspace/llm-proxy-partner-powered-workspace.go +++ b/cmd/workspace/llm-proxy-partner-powered-workspace/llm-proxy-partner-powered-workspace.go @@ -3,7 +3,7 @@ package llm_proxy_partner_powered_workspace import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -203,7 +203,7 @@ func newUpdate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.LlmProxyPartnerPoweredWorkspace().Update(ctx, updateReq) diff --git a/cmd/workspace/materialized-features/materialized-features.go b/cmd/workspace/materialized-features/materialized-features.go index 1beef5f871b..8da35540e24 100644 --- a/cmd/workspace/materialized-features/materialized-features.go +++ b/cmd/workspace/materialized-features/materialized-features.go @@ -3,6 +3,7 @@ package materialized_features import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -84,7 +85,7 @@ func newCreateFeatureTag() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only TABLE_NAME, FEATURE_NAME as positional arguments. Provide 'key' in your JSON input") + return errors.New("when --json flag is specified, provide only TABLE_NAME, FEATURE_NAME as positional arguments. Provide 'key' in your JSON input") } return nil } diff --git a/cmd/workspace/metastores/metastores.go b/cmd/workspace/metastores/metastores.go index 46fdedb8eca..6a1ef18de8c 100644 --- a/cmd/workspace/metastores/metastores.go +++ b/cmd/workspace/metastores/metastores.go @@ -3,6 +3,7 @@ package metastores import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -102,7 +103,7 @@ func newAssign() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only WORKSPACE_ID as positional arguments. Provide 'metastore_id', 'default_catalog_name' in your JSON input") + return errors.New("when --json flag is specified, provide only WORKSPACE_ID as positional arguments. Provide 'metastore_id', 'default_catalog_name' in your JSON input") } return nil } @@ -200,7 +201,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } diff --git a/cmd/workspace/model-registry/model-registry.go b/cmd/workspace/model-registry/model-registry.go index 4df77e40183..2c88d8d7dc1 100644 --- a/cmd/workspace/model-registry/model-registry.go +++ b/cmd/workspace/model-registry/model-registry.go @@ -3,6 +3,7 @@ package model_registry import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -131,7 +132,7 @@ func newApproveTransitionRequest() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'version', 'stage', 'archive_existing_versions' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'version', 'stage', 'archive_existing_versions' in your JSON input") } return nil } @@ -231,7 +232,7 @@ func newCreateComment() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'version', 'comment' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'version', 'comment' in your JSON input") } return nil } @@ -325,7 +326,7 @@ func newCreateModel() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } @@ -414,7 +415,7 @@ func newCreateModelVersion() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'source' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'source' in your JSON input") } return nil } @@ -512,7 +513,7 @@ func newCreateTransitionRequest() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'version', 'stage' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'version', 'stage' in your JSON input") } return nil } @@ -617,7 +618,7 @@ func newCreateWebhook() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.ModelRegistry.CreateWebhook(ctx, createWebhookReq) @@ -1120,7 +1121,7 @@ func newGetLatestVersions() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } @@ -1736,7 +1737,7 @@ func newRejectTransitionRequest() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'version', 'stage' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'version', 'stage' in your JSON input") } return nil } @@ -1827,7 +1828,7 @@ func newRenameModel() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } @@ -2061,7 +2062,7 @@ func newSetModelTag() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'key', 'value' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'key', 'value' in your JSON input") } return nil } @@ -2157,7 +2158,7 @@ func newSetModelVersionTag() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'version', 'key', 'value' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'version', 'key', 'value' in your JSON input") } return nil } @@ -2341,7 +2342,7 @@ func newTestRegistryWebhook() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'id' in your JSON input") } return nil } @@ -2442,7 +2443,7 @@ func newTransitionStage() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'version', 'stage', 'archive_existing_versions' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'version', 'stage', 'archive_existing_versions' in your JSON input") } return nil } @@ -2539,7 +2540,7 @@ func newUpdateComment() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'id', 'comment' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'id', 'comment' in your JSON input") } return nil } @@ -2627,7 +2628,7 @@ func newUpdateModel() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } @@ -2713,7 +2714,7 @@ func newUpdateModelVersion() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'version' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'version' in your JSON input") } return nil } @@ -2882,7 +2883,7 @@ func newUpdateWebhook() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'id' in your JSON input") } return nil } diff --git a/cmd/workspace/permission-migration/permission-migration.go b/cmd/workspace/permission-migration/permission-migration.go index c75ec9f01e1..3c9b6741b28 100644 --- a/cmd/workspace/permission-migration/permission-migration.go +++ b/cmd/workspace/permission-migration/permission-migration.go @@ -3,6 +3,7 @@ package permission_migration import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -82,7 +83,7 @@ func newMigratePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'workspace_id', 'from_workspace_group_name', 'to_account_group_name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'workspace_id', 'from_workspace_group_name', 'to_account_group_name' in your JSON input") } return nil } diff --git a/cmd/workspace/pipelines/pipelines.go b/cmd/workspace/pipelines/pipelines.go index d5f4a2046b2..3c9f1151e8d 100644 --- a/cmd/workspace/pipelines/pipelines.go +++ b/cmd/workspace/pipelines/pipelines.go @@ -3,6 +3,7 @@ package pipelines import ( + "errors" "fmt" "time" @@ -118,7 +119,7 @@ Apply the latest environment to the pipeline. args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } applyEnvironmentReq.PipelineId = args[0] @@ -196,7 +197,7 @@ func newClone() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } cloneReq.PipelineId = args[0] @@ -265,7 +266,7 @@ func newCreate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Pipelines.Create(ctx, createReq) @@ -337,7 +338,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } deleteReq.PipelineId = args[0] @@ -402,7 +403,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } getReq.PipelineId = args[0] @@ -473,7 +474,7 @@ func newGetPermissionLevels() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the pipeline for which to get or manage permissions") + return errors.New("expected to have the pipeline for which to get or manage permissions") } getPermissionLevelsReq.PipelineId = args[0] @@ -545,7 +546,7 @@ func newGetPermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the pipeline for which to get or manage permissions") + return errors.New("expected to have the pipeline for which to get or manage permissions") } getPermissionsReq.PipelineId = args[0] @@ -692,7 +693,7 @@ func newListPipelineEvents() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the pipeline to return events for") + return errors.New("expected to have the pipeline to return events for") } listPipelineEventsReq.PipelineId = args[0] @@ -842,7 +843,7 @@ func newListUpdates() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the pipeline to return updates for") + return errors.New("expected to have the pipeline to return updates for") } listUpdatesReq.PipelineId = args[0] @@ -932,7 +933,7 @@ func newSetPermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the pipeline for which to get or manage permissions") + return errors.New("expected to have the pipeline for which to get or manage permissions") } setPermissionsReq.PipelineId = args[0] @@ -1034,7 +1035,7 @@ func newStartUpdate() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } startUpdateReq.PipelineId = args[0] @@ -1109,7 +1110,7 @@ func newStop() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } stopReq.PipelineId = args[0] @@ -1240,7 +1241,7 @@ func newUpdate() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have unique identifier for this pipeline") + return errors.New("expected to have unique identifier for this pipeline") } updateReq.PipelineId = args[0] @@ -1328,7 +1329,7 @@ func newUpdatePermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the pipeline for which to get or manage permissions") + return errors.New("expected to have the pipeline for which to get or manage permissions") } updatePermissionsReq.PipelineId = args[0] diff --git a/cmd/workspace/policies/policies.go b/cmd/workspace/policies/policies.go index beac7bf3f8e..dd0938f01df 100644 --- a/cmd/workspace/policies/policies.go +++ b/cmd/workspace/policies/policies.go @@ -3,6 +3,7 @@ package policies import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -140,7 +141,7 @@ func newCreatePolicy() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'to_principals', 'for_securable_type', 'policy_type' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'to_principals', 'for_securable_type', 'policy_type' in your JSON input") } return nil } @@ -510,7 +511,7 @@ func newUpdatePolicy() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(3)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only ON_SECURABLE_TYPE, ON_SECURABLE_FULLNAME, NAME as positional arguments. Provide 'to_principals', 'for_securable_type', 'policy_type' in your JSON input") + return errors.New("when --json flag is specified, provide only ON_SECURABLE_TYPE, ON_SECURABLE_FULLNAME, NAME as positional arguments. Provide 'to_principals', 'for_securable_type', 'policy_type' in your JSON input") } return nil } diff --git a/cmd/workspace/policy-compliance-for-clusters/policy-compliance-for-clusters.go b/cmd/workspace/policy-compliance-for-clusters/policy-compliance-for-clusters.go index f6bf30078de..e18a23b556f 100644 --- a/cmd/workspace/policy-compliance-for-clusters/policy-compliance-for-clusters.go +++ b/cmd/workspace/policy-compliance-for-clusters/policy-compliance-for-clusters.go @@ -3,6 +3,7 @@ package policy_compliance_for_clusters import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -92,7 +93,7 @@ func newCancelPendingClusterEnforcement() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") } return nil } @@ -188,7 +189,7 @@ func newEnforceCompliance() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'cluster_id' in your JSON input") } return nil } diff --git a/cmd/workspace/policy-compliance-for-jobs/policy-compliance-for-jobs.go b/cmd/workspace/policy-compliance-for-jobs/policy-compliance-for-jobs.go index f184660ef63..7925735e472 100644 --- a/cmd/workspace/policy-compliance-for-jobs/policy-compliance-for-jobs.go +++ b/cmd/workspace/policy-compliance-for-jobs/policy-compliance-for-jobs.go @@ -3,6 +3,7 @@ package policy_compliance_for_jobs import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -94,7 +95,7 @@ func newEnforceCompliance() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'job_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'job_id' in your JSON input") } return nil } diff --git a/cmd/workspace/postgres/postgres.go b/cmd/workspace/postgres/postgres.go index 738171cc7d8..26e3a6053f2 100644 --- a/cmd/workspace/postgres/postgres.go +++ b/cmd/workspace/postgres/postgres.go @@ -3,6 +3,7 @@ package postgres import ( + "errors" "fmt" "strings" "time" @@ -1987,7 +1988,7 @@ Generate OAuth credentials for a Postgres database. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'endpoint' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'endpoint' in your JSON input") } return nil } diff --git a/cmd/workspace/provider-exchange-filters/provider-exchange-filters.go b/cmd/workspace/provider-exchange-filters/provider-exchange-filters.go index 6b29d15b39e..c67cac764b0 100644 --- a/cmd/workspace/provider-exchange-filters/provider-exchange-filters.go +++ b/cmd/workspace/provider-exchange-filters/provider-exchange-filters.go @@ -3,6 +3,7 @@ package provider_exchange_filters import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -92,7 +93,7 @@ Create a new exchange filter. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.ProviderExchangeFilters.Create(ctx, createReq) @@ -161,7 +162,7 @@ Delete an exchange filter. args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } deleteReq.Id = args[0] @@ -309,7 +310,7 @@ Update exchange filter. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } updateReq.Id = args[0] diff --git a/cmd/workspace/provider-exchanges/provider-exchanges.go b/cmd/workspace/provider-exchanges/provider-exchanges.go index d2c56498a3c..7c8484fce1b 100644 --- a/cmd/workspace/provider-exchanges/provider-exchanges.go +++ b/cmd/workspace/provider-exchanges/provider-exchanges.go @@ -3,6 +3,7 @@ package provider_exchanges import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -85,7 +86,7 @@ Add an exchange for listing. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'listing_id', 'exchange_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'listing_id', 'exchange_id' in your JSON input") } return nil } @@ -183,7 +184,7 @@ Create an exchange. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.ProviderExchanges.Create(ctx, createReq) @@ -647,7 +648,7 @@ Update exchange. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } updateReq.Id = args[0] diff --git a/cmd/workspace/provider-files/provider-files.go b/cmd/workspace/provider-files/provider-files.go index 1c77119e0ab..6322769d366 100644 --- a/cmd/workspace/provider-files/provider-files.go +++ b/cmd/workspace/provider-files/provider-files.go @@ -3,6 +3,7 @@ package provider_files import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -96,7 +97,7 @@ Create a file. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.ProviderFiles.Create(ctx, createReq) @@ -165,7 +166,7 @@ Delete a file. args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } deleteReq.FileId = args[0] @@ -234,7 +235,7 @@ Get a file. args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } getReq.FileId = args[0] @@ -317,7 +318,7 @@ List files. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response := w.ProviderFiles.List(ctx, listReq) diff --git a/cmd/workspace/provider-listings/provider-listings.go b/cmd/workspace/provider-listings/provider-listings.go index 854bdebfd7f..844f87041ce 100644 --- a/cmd/workspace/provider-listings/provider-listings.go +++ b/cmd/workspace/provider-listings/provider-listings.go @@ -3,6 +3,7 @@ package provider_listings import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -94,7 +95,7 @@ Create a listing. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.ProviderListings.Create(ctx, createReq) @@ -163,7 +164,7 @@ Delete a listing. args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } deleteReq.Id = args[0] @@ -232,7 +233,7 @@ Get a listing. args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } getReq.Id = args[0] @@ -379,7 +380,7 @@ Update listing. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } updateReq.Id = args[0] diff --git a/cmd/workspace/provider-personalization-requests/provider-personalization-requests.go b/cmd/workspace/provider-personalization-requests/provider-personalization-requests.go index f93215a96cd..b86741b6b2a 100644 --- a/cmd/workspace/provider-personalization-requests/provider-personalization-requests.go +++ b/cmd/workspace/provider-personalization-requests/provider-personalization-requests.go @@ -3,6 +3,7 @@ package provider_personalization_requests import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -155,7 +156,7 @@ Update personalization request status. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only LISTING_ID, REQUEST_ID as positional arguments. Provide 'status' in your JSON input") + return errors.New("when --json flag is specified, provide only LISTING_ID, REQUEST_ID as positional arguments. Provide 'status' in your JSON input") } return nil } diff --git a/cmd/workspace/provider-providers/provider-providers.go b/cmd/workspace/provider-providers/provider-providers.go index 011068323ad..92fb2ea916a 100644 --- a/cmd/workspace/provider-providers/provider-providers.go +++ b/cmd/workspace/provider-providers/provider-providers.go @@ -3,6 +3,7 @@ package provider_providers import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -93,7 +94,7 @@ Create a provider. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.ProviderProviders.Create(ctx, createReq) @@ -162,7 +163,7 @@ Delete provider. args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } deleteReq.Id = args[0] @@ -231,7 +232,7 @@ Get provider. args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } getReq.Id = args[0] @@ -378,7 +379,7 @@ Update provider. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } updateReq.Id = args[0] diff --git a/cmd/workspace/providers/providers.go b/cmd/workspace/providers/providers.go index 25d0ca73e9c..8d234ff712b 100644 --- a/cmd/workspace/providers/providers.go +++ b/cmd/workspace/providers/providers.go @@ -3,6 +3,7 @@ package providers import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -89,7 +90,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'authentication_type' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'authentication_type' in your JSON input") } return nil } @@ -193,7 +194,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have name of the provider") + return errors.New("expected to have name of the provider") } deleteReq.Name = args[0] @@ -265,7 +266,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have name of the provider") + return errors.New("expected to have name of the provider") } getReq.Name = args[0] @@ -495,7 +496,7 @@ func newListShares() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have name of the provider in which to list shares") + return errors.New("expected to have name of the provider in which to list shares") } listSharesReq.Name = args[0] @@ -592,7 +593,7 @@ func newUpdate() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have name of the provider") + return errors.New("expected to have name of the provider") } updateReq.Name = args[0] diff --git a/cmd/workspace/quality-monitor-v2/quality-monitor-v2.go b/cmd/workspace/quality-monitor-v2/quality-monitor-v2.go index 8290fbf92ac..b9a515c72cb 100644 --- a/cmd/workspace/quality-monitor-v2/quality-monitor-v2.go +++ b/cmd/workspace/quality-monitor-v2/quality-monitor-v2.go @@ -3,6 +3,7 @@ package quality_monitor_v2 import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -91,7 +92,7 @@ Create a quality monitor. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'object_type', 'object_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'object_type', 'object_id' in your JSON input") } return nil } @@ -388,7 +389,7 @@ Update a quality monitor. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only OBJECT_TYPE, OBJECT_ID as positional arguments. Provide 'object_type', 'object_id' in your JSON input") + return errors.New("when --json flag is specified, provide only OBJECT_TYPE, OBJECT_ID as positional arguments. Provide 'object_type', 'object_id' in your JSON input") } return nil } diff --git a/cmd/workspace/quality-monitors/quality-monitors.go b/cmd/workspace/quality-monitors/quality-monitors.go index 4e08a93ce46..c8d43ee3b7f 100644 --- a/cmd/workspace/quality-monitors/quality-monitors.go +++ b/cmd/workspace/quality-monitors/quality-monitors.go @@ -3,6 +3,7 @@ package quality_monitors import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -192,7 +193,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only TABLE_NAME as positional arguments. Provide 'output_schema_name', 'assets_dir' in your JSON input") + return errors.New("when --json flag is specified, provide only TABLE_NAME as positional arguments. Provide 'output_schema_name', 'assets_dir' in your JSON input") } return nil } @@ -761,7 +762,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only TABLE_NAME as positional arguments. Provide 'output_schema_name' in your JSON input") + return errors.New("when --json flag is specified, provide only TABLE_NAME as positional arguments. Provide 'output_schema_name' in your JSON input") } return nil } diff --git a/cmd/workspace/queries/queries.go b/cmd/workspace/queries/queries.go index 0e7bb05be59..e0eb80cb58c 100644 --- a/cmd/workspace/queries/queries.go +++ b/cmd/workspace/queries/queries.go @@ -3,6 +3,7 @@ package queries import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -169,7 +170,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } deleteReq.Id = args[0] @@ -236,7 +237,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } getReq.Id = args[0] @@ -392,7 +393,7 @@ func newListVisualizations() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have ") + return errors.New("expected to have ") } listVisualizationsReq.Id = args[0] @@ -467,7 +468,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only ID as positional arguments. Provide 'update_mask' in your JSON input") + return errors.New("when --json flag is specified, provide only ID as positional arguments. Provide 'update_mask' in your JSON input") } return nil } diff --git a/cmd/workspace/query-visualizations-legacy/query-visualizations-legacy.go b/cmd/workspace/query-visualizations-legacy/query-visualizations-legacy.go index caa073e6bf0..0b9562ec09d 100644 --- a/cmd/workspace/query-visualizations-legacy/query-visualizations-legacy.go +++ b/cmd/workspace/query-visualizations-legacy/query-visualizations-legacy.go @@ -3,7 +3,7 @@ package query_visualizations_legacy import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -105,7 +105,7 @@ func newCreate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.QueryVisualizationsLegacy.Create(ctx, createReq) diff --git a/cmd/workspace/query-visualizations/query-visualizations.go b/cmd/workspace/query-visualizations/query-visualizations.go index 44f9955cc3e..4e2b50c8687 100644 --- a/cmd/workspace/query-visualizations/query-visualizations.go +++ b/cmd/workspace/query-visualizations/query-visualizations.go @@ -3,7 +3,7 @@ package query_visualizations import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -222,7 +222,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only ID as positional arguments. Provide 'update_mask' in your JSON input") + return errors.New("when --json flag is specified, provide only ID as positional arguments. Provide 'update_mask' in your JSON input") } return nil } diff --git a/cmd/workspace/recipients/recipients.go b/cmd/workspace/recipients/recipients.go index 04da810e69b..ca02fb4d904 100644 --- a/cmd/workspace/recipients/recipients.go +++ b/cmd/workspace/recipients/recipients.go @@ -3,6 +3,7 @@ package recipients import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -109,7 +110,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'authentication_type' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'authentication_type' in your JSON input") } return nil } @@ -399,7 +400,7 @@ func newRotateToken() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME as positional arguments. Provide 'existing_token_expire_in_seconds' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME as positional arguments. Provide 'existing_token_expire_in_seconds' in your JSON input") } return nil } diff --git a/cmd/workspace/registered-models/registered-models.go b/cmd/workspace/registered-models/registered-models.go index 5e423cd9bb3..dea2800643d 100644 --- a/cmd/workspace/registered-models/registered-models.go +++ b/cmd/workspace/registered-models/registered-models.go @@ -3,6 +3,7 @@ package registered_models import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -224,7 +225,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the three-level (fully qualified) name of the registered model") + return errors.New("expected to have the three-level (fully qualified) name of the registered model") } deleteReq.FullName = args[0] @@ -367,7 +368,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the three-level (fully qualified) name of the registered model") + return errors.New("expected to have the three-level (fully qualified) name of the registered model") } getReq.FullName = args[0] @@ -521,7 +522,7 @@ func newSetAlias() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only FULL_NAME, ALIAS as positional arguments. Provide 'version_num' in your JSON input") + return errors.New("when --json flag is specified, provide only FULL_NAME, ALIAS as positional arguments. Provide 'version_num' in your JSON input") } return nil } @@ -661,7 +662,7 @@ func newUpdate() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the three-level (fully qualified) name of the registered model") + return errors.New("expected to have the three-level (fully qualified) name of the registered model") } updateReq.FullName = args[0] diff --git a/cmd/workspace/repos/repos.go b/cmd/workspace/repos/repos.go index cbcde860760..c9faa83214c 100644 --- a/cmd/workspace/repos/repos.go +++ b/cmd/workspace/repos/repos.go @@ -3,6 +3,7 @@ package repos import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -103,7 +104,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'url', 'provider' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'url', 'provider' in your JSON input") } return nil } @@ -202,7 +203,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id for the corresponding repo to delete") + return errors.New("expected to have the id for the corresponding repo to delete") } _, err = fmt.Sscan(args[0], &deleteReq.RepoId) if err != nil { @@ -275,7 +276,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have id of the git folder (repo) object in the workspace") + return errors.New("expected to have id of the git folder (repo) object in the workspace") } _, err = fmt.Sscan(args[0], &getReq.RepoId) if err != nil { @@ -349,7 +350,7 @@ func newGetPermissionLevels() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the repo for which to get or manage permissions") + return errors.New("expected to have the repo for which to get or manage permissions") } getPermissionLevelsReq.RepoId = args[0] @@ -421,7 +422,7 @@ func newGetPermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the repo for which to get or manage permissions") + return errors.New("expected to have the repo for which to get or manage permissions") } getPermissionsReq.RepoId = args[0] @@ -582,7 +583,7 @@ func newSetPermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the repo for which to get or manage permissions") + return errors.New("expected to have the repo for which to get or manage permissions") } setPermissionsReq.RepoId = args[0] @@ -674,7 +675,7 @@ func newUpdate() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have id of the git folder (repo) object in the workspace") + return errors.New("expected to have id of the git folder (repo) object in the workspace") } _, err = fmt.Sscan(args[0], &updateReq.RepoId) if err != nil { @@ -765,7 +766,7 @@ func newUpdatePermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the repo for which to get or manage permissions") + return errors.New("expected to have the repo for which to get or manage permissions") } updatePermissionsReq.RepoId = args[0] diff --git a/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go b/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go index bb947f91b34..ca07a765514 100644 --- a/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go +++ b/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go @@ -3,7 +3,7 @@ package restrict_workspace_admins import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -225,7 +225,7 @@ Update the restrict workspace admins setting. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.RestrictWorkspaceAdmins().Update(ctx, updateReq) diff --git a/cmd/workspace/rfa/rfa.go b/cmd/workspace/rfa/rfa.go index 508c3db68a7..4c2ba7f0e25 100644 --- a/cmd/workspace/rfa/rfa.go +++ b/cmd/workspace/rfa/rfa.go @@ -3,6 +3,7 @@ package rfa import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -265,7 +266,7 @@ Update Access Request Destinations. if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only UPDATE_MASK as positional arguments. Provide 'securable' in your JSON input") + return errors.New("when --json flag is specified, provide only UPDATE_MASK as positional arguments. Provide 'securable' in your JSON input") } return nil } diff --git a/cmd/workspace/schemas/schemas.go b/cmd/workspace/schemas/schemas.go index 248e18b4996..709452cd3a9 100644 --- a/cmd/workspace/schemas/schemas.go +++ b/cmd/workspace/schemas/schemas.go @@ -3,6 +3,7 @@ package schemas import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -91,7 +92,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'catalog_name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'catalog_name' in your JSON input") } return nil } diff --git a/cmd/workspace/secrets-uc/secrets-uc.go b/cmd/workspace/secrets-uc/secrets-uc.go index 006a5f5d33d..5284fdc7dfc 100644 --- a/cmd/workspace/secrets-uc/secrets-uc.go +++ b/cmd/workspace/secrets-uc/secrets-uc.go @@ -4,6 +4,7 @@ package secrets_uc import ( "encoding/json" + "errors" "fmt" "strings" @@ -111,7 +112,7 @@ func newCreateSecret() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'catalog_name', 'schema_name', 'value' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'catalog_name', 'schema_name', 'value' in your JSON input") } return nil } @@ -447,7 +448,7 @@ func newUpdateSecret() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only FULL_NAME, UPDATE_MASK as positional arguments. Provide 'name', 'catalog_name', 'schema_name', 'value' in your JSON input") + return errors.New("when --json flag is specified, provide only FULL_NAME, UPDATE_MASK as positional arguments. Provide 'name', 'catalog_name', 'schema_name', 'value' in your JSON input") } return nil } diff --git a/cmd/workspace/secrets/secrets.go b/cmd/workspace/secrets/secrets.go index 198abdcadf7..e3268ccfe6e 100644 --- a/cmd/workspace/secrets/secrets.go +++ b/cmd/workspace/secrets/secrets.go @@ -3,6 +3,7 @@ package secrets import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -135,7 +136,7 @@ func newCreateScope() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'scope' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'scope' in your JSON input") } return nil } @@ -231,7 +232,7 @@ func newDeleteAcl() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'scope', 'principal' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'scope', 'principal' in your JSON input") } return nil } @@ -327,7 +328,7 @@ func newDeleteScope() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'scope' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'scope' in your JSON input") } return nil } @@ -422,7 +423,7 @@ func newDeleteSecret() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'scope', 'key' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'scope', 'key' in your JSON input") } return nil } @@ -941,7 +942,7 @@ func newPutAcl() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'scope', 'principal', 'permission' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'scope', 'principal', 'permission' in your JSON input") } return nil } diff --git a/cmd/workspace/serving-endpoints/serving-endpoints.go b/cmd/workspace/serving-endpoints/serving-endpoints.go index 2c3982b7821..0bb70086164 100644 --- a/cmd/workspace/serving-endpoints/serving-endpoints.go +++ b/cmd/workspace/serving-endpoints/serving-endpoints.go @@ -3,6 +3,7 @@ package serving_endpoints import ( + "errors" "fmt" "time" @@ -187,7 +188,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } @@ -303,7 +304,7 @@ Create a new PT serving endpoint.` } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } wait, err := w.ServingEndpoints.CreateProvisionedThroughputEndpoint(ctx, createProvisionedThroughputEndpointReq) @@ -1616,7 +1617,7 @@ Update config of a PT serving endpoint. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } updateProvisionedThroughputEndpointConfigReq.Name = args[0] diff --git a/cmd/workspace/shares/shares.go b/cmd/workspace/shares/shares.go index b06b36389d8..4f3869ae300 100644 --- a/cmd/workspace/shares/shares.go +++ b/cmd/workspace/shares/shares.go @@ -3,6 +3,7 @@ package shares import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -90,7 +91,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } diff --git a/cmd/workspace/sql-results-download/sql-results-download.go b/cmd/workspace/sql-results-download/sql-results-download.go index 049e94d6d5e..84e177a4b8b 100644 --- a/cmd/workspace/sql-results-download/sql-results-download.go +++ b/cmd/workspace/sql-results-download/sql-results-download.go @@ -3,7 +3,7 @@ package sql_results_download import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -208,7 +208,7 @@ Update the SQL Results Download setting. } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.Settings.SqlResultsDownload().Update(ctx, updateReq) diff --git a/cmd/workspace/storage-credentials/storage-credentials.go b/cmd/workspace/storage-credentials/storage-credentials.go index ffeec286005..ff64940025f 100644 --- a/cmd/workspace/storage-credentials/storage-credentials.go +++ b/cmd/workspace/storage-credentials/storage-credentials.go @@ -3,6 +3,7 @@ package storage_credentials import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -105,7 +106,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name' in your JSON input") } return nil } diff --git a/cmd/workspace/supervisor-agents/supervisor-agents.go b/cmd/workspace/supervisor-agents/supervisor-agents.go index c488ee72ce8..f5532315c24 100644 --- a/cmd/workspace/supervisor-agents/supervisor-agents.go +++ b/cmd/workspace/supervisor-agents/supervisor-agents.go @@ -3,6 +3,7 @@ package supervisor_agents import ( + "errors" "fmt" "strings" @@ -105,7 +106,7 @@ Create an example for a Supervisor Agent. if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only PARENT as positional arguments. Provide 'question', 'guidelines' in your JSON input") + return errors.New("when --json flag is specified, provide only PARENT as positional arguments. Provide 'question', 'guidelines' in your JSON input") } return nil } @@ -203,7 +204,7 @@ Create a Supervisor Agent. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'display_name' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'display_name' in your JSON input") } return nil } @@ -312,7 +313,7 @@ Create a Tool. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only PARENT, TOOL_ID as positional arguments. Provide 'tool_type' in your JSON input") + return errors.New("when --json flag is specified, provide only PARENT, TOOL_ID as positional arguments. Provide 'tool_type' in your JSON input") } return nil } @@ -1207,7 +1208,7 @@ Update an example in a Supervisor Agent. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'question', 'guidelines' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'question', 'guidelines' in your JSON input") } return nil } @@ -1392,7 +1393,7 @@ Update a Supervisor Agent. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'display_name' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'display_name' in your JSON input") } return nil } @@ -1502,7 +1503,7 @@ Update a Tool. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'tool_type' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'tool_type' in your JSON input") } return nil } diff --git a/cmd/workspace/table-constraints/table-constraints.go b/cmd/workspace/table-constraints/table-constraints.go index cf2891200db..021cd317763 100644 --- a/cmd/workspace/table-constraints/table-constraints.go +++ b/cmd/workspace/table-constraints/table-constraints.go @@ -3,6 +3,7 @@ package table_constraints import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -107,7 +108,7 @@ func newCreate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } response, err := w.TableConstraints.Create(ctx, createReq) diff --git a/cmd/workspace/tables/tables.go b/cmd/workspace/tables/tables.go index c132bc9fa10..38a13f87171 100644 --- a/cmd/workspace/tables/tables.go +++ b/cmd/workspace/tables/tables.go @@ -3,6 +3,7 @@ package tables import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -165,7 +166,7 @@ Create a table. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'catalog_name', 'schema_name', 'table_type', 'data_source_format', 'storage_location' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'catalog_name', 'schema_name', 'table_type', 'data_source_format', 'storage_location' in your JSON input") } return nil } diff --git a/cmd/workspace/tag-policies/tag-policies.go b/cmd/workspace/tag-policies/tag-policies.go index 02ef1a7af31..82c31bd1fb4 100644 --- a/cmd/workspace/tag-policies/tag-policies.go +++ b/cmd/workspace/tag-policies/tag-policies.go @@ -3,6 +3,7 @@ package tag_policies import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -91,7 +92,7 @@ func newCreateTagPolicy() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'tag_key' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'tag_key' in your JSON input") } return nil } diff --git a/cmd/workspace/temporary-path-credentials/temporary-path-credentials.go b/cmd/workspace/temporary-path-credentials/temporary-path-credentials.go index 0bd28cd8487..aae3cdd0d0d 100644 --- a/cmd/workspace/temporary-path-credentials/temporary-path-credentials.go +++ b/cmd/workspace/temporary-path-credentials/temporary-path-credentials.go @@ -3,6 +3,7 @@ package temporary_path_credentials import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -112,7 +113,7 @@ func newGenerateTemporaryPathCredentials() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'url', 'operation' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'url', 'operation' in your JSON input") } return nil } diff --git a/cmd/workspace/token-management/token-management.go b/cmd/workspace/token-management/token-management.go index 02651b18068..ebbcdd9d8dd 100644 --- a/cmd/workspace/token-management/token-management.go +++ b/cmd/workspace/token-management/token-management.go @@ -3,6 +3,7 @@ package token_management import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -90,7 +91,7 @@ func newCreateOboToken() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'application_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'application_id' in your JSON input") } return nil } @@ -129,7 +130,7 @@ func newCreateOboToken() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have application id of the service principal") + return errors.New("expected to have application id of the service principal") } createOboTokenReq.ApplicationId = args[0] @@ -202,7 +203,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id of the token to revoke") + return errors.New("expected to have the id of the token to revoke") } deleteReq.TokenId = args[0] @@ -272,7 +273,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id of the token to get") + return errors.New("expected to have the id of the token to get") } getReq.TokenId = args[0] @@ -655,7 +656,7 @@ func newUpdateTokenManagement() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } updateTokenManagementReq.TokenId = args[0] diff --git a/cmd/workspace/tokens/tokens.go b/cmd/workspace/tokens/tokens.go index 3b70a5b6892..40ca4b786e9 100644 --- a/cmd/workspace/tokens/tokens.go +++ b/cmd/workspace/tokens/tokens.go @@ -3,6 +3,7 @@ package tokens import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -160,7 +161,7 @@ func newDelete() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'token_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'token_id' in your JSON input") } return nil } @@ -199,7 +200,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the id of the token to be revoked") + return errors.New("expected to have the id of the token to be revoked") } deleteReq.TokenId = args[0] } @@ -335,7 +336,7 @@ func newUpdate() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } updateReq.TokenId = args[0] diff --git a/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go b/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go index 9342d2999d0..bc4e7d83428 100644 --- a/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go +++ b/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go @@ -3,6 +3,7 @@ package vector_search_endpoints import ( + "errors" "fmt" "time" @@ -99,7 +100,7 @@ func newCreateEndpoint() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'endpoint_type' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'endpoint_type' in your JSON input") } return nil } @@ -750,7 +751,7 @@ Update the budget policy of an endpoint. if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only ENDPOINT_NAME as positional arguments. Provide 'budget_policy_id' in your JSON input") + return errors.New("when --json flag is specified, provide only ENDPOINT_NAME as positional arguments. Provide 'budget_policy_id' in your JSON input") } return nil } @@ -853,7 +854,7 @@ func newUpdateEndpointCustomTags() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } updateEndpointCustomTagsReq.EndpointName = args[0] diff --git a/cmd/workspace/vector-search-indexes/vector-search-indexes.go b/cmd/workspace/vector-search-indexes/vector-search-indexes.go index c0126db5abd..a1b9bddfcfa 100644 --- a/cmd/workspace/vector-search-indexes/vector-search-indexes.go +++ b/cmd/workspace/vector-search-indexes/vector-search-indexes.go @@ -3,6 +3,7 @@ package vector_search_indexes import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -100,7 +101,7 @@ func newCreateIndex() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'endpoint_name', 'primary_key', 'index_type' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'name', 'endpoint_name', 'primary_key', 'index_type' in your JSON input") } return nil } @@ -215,7 +216,7 @@ func newDeleteDataVectorIndex() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } deleteDataVectorIndexReq.IndexName = args[0] @@ -491,7 +492,7 @@ func newQueryIndex() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } queryIndexReq.IndexName = args[0] @@ -765,7 +766,7 @@ func newUpsertDataVectorIndex() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only INDEX_NAME as positional arguments. Provide 'inputs_json' in your JSON input") + return errors.New("when --json flag is specified, provide only INDEX_NAME as positional arguments. Provide 'inputs_json' in your JSON input") } return nil } diff --git a/cmd/workspace/volumes/volumes.go b/cmd/workspace/volumes/volumes.go index 9e8acd065ef..1361f293c8c 100644 --- a/cmd/workspace/volumes/volumes.go +++ b/cmd/workspace/volumes/volumes.go @@ -3,6 +3,7 @@ package volumes import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -115,7 +116,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'catalog_name', 'schema_name', 'name', 'volume_type' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'catalog_name', 'schema_name', 'name', 'volume_type' in your JSON input") } return nil } @@ -228,7 +229,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the three-level (fully qualified) name of the volume") + return errors.New("expected to have the three-level (fully qualified) name of the volume") } deleteReq.Name = args[0] @@ -398,7 +399,7 @@ func newRead() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the three-level (fully qualified) name of the volume") + return errors.New("expected to have the three-level (fully qualified) name of the volume") } readReq.Name = args[0] @@ -495,7 +496,7 @@ func newUpdate() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the three-level (fully qualified) name of the volume") + return errors.New("expected to have the three-level (fully qualified) name of the volume") } updateReq.Name = args[0] diff --git a/cmd/workspace/warehouses/warehouses.go b/cmd/workspace/warehouses/warehouses.go index a98c00325f1..11391ede839 100644 --- a/cmd/workspace/warehouses/warehouses.go +++ b/cmd/workspace/warehouses/warehouses.go @@ -3,6 +3,7 @@ package warehouses import ( + "errors" "fmt" "strings" "time" @@ -216,7 +217,7 @@ Create default warehouse override. if cmd.Flags().Changed("json") { err := root.ExactArgs(1)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only DEFAULT_WAREHOUSE_OVERRIDE_ID as positional arguments. Provide 'type' in your JSON input") + return errors.New("when --json flag is specified, provide only DEFAULT_WAREHOUSE_OVERRIDE_ID as positional arguments. Provide 'type' in your JSON input") } return nil } @@ -317,7 +318,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have required") + return errors.New("expected to have required") } deleteReq.Id = args[0] @@ -394,7 +395,7 @@ Delete default warehouse override. args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have required") + return errors.New("expected to have required") } deleteDefaultWarehouseOverrideReq.Name = args[0] @@ -499,7 +500,7 @@ func newEdit() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have required") + return errors.New("expected to have required") } editReq.Id = args[0] @@ -588,7 +589,7 @@ func newGet() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have required") + return errors.New("expected to have required") } getReq.Id = args[0] @@ -666,7 +667,7 @@ Get default warehouse override. args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have required") + return errors.New("expected to have required") } getDefaultWarehouseOverrideReq.Name = args[0] @@ -737,7 +738,7 @@ func newGetPermissionLevels() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the sql warehouse for which to get or manage permissions") + return errors.New("expected to have the sql warehouse for which to get or manage permissions") } getPermissionLevelsReq.WarehouseId = args[0] @@ -809,7 +810,7 @@ func newGetPermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the sql warehouse for which to get or manage permissions") + return errors.New("expected to have the sql warehouse for which to get or manage permissions") } getPermissionsReq.WarehouseId = args[0] @@ -1089,7 +1090,7 @@ func newSetPermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the sql warehouse for which to get or manage permissions") + return errors.New("expected to have the sql warehouse for which to get or manage permissions") } setPermissionsReq.WarehouseId = args[0] @@ -1247,7 +1248,7 @@ func newStart() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have required") + return errors.New("expected to have required") } startReq.Id = args[0] @@ -1342,7 +1343,7 @@ func newStop() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have required") + return errors.New("expected to have required") } stopReq.Id = args[0] @@ -1432,7 +1433,7 @@ Update default warehouse override. if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'type' in your JSON input") + return errors.New("when --json flag is specified, provide only NAME, UPDATE_MASK as positional arguments. Provide 'type' in your JSON input") } return nil } @@ -1555,7 +1556,7 @@ func newUpdatePermissions() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the sql warehouse for which to get or manage permissions") + return errors.New("expected to have the sql warehouse for which to get or manage permissions") } updatePermissionsReq.WarehouseId = args[0] diff --git a/cmd/workspace/workspace-conf/workspace-conf.go b/cmd/workspace/workspace-conf/workspace-conf.go index 16b3fd44a03..8da40a559d7 100644 --- a/cmd/workspace/workspace-conf/workspace-conf.go +++ b/cmd/workspace/workspace-conf/workspace-conf.go @@ -3,7 +3,7 @@ package workspace_conf import ( - "fmt" + "errors" "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdctx" @@ -143,7 +143,7 @@ func newSetStatus() *cobra.Command { } } } else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") } err = w.WorkspaceConf.SetStatus(ctx, setStatusReq) diff --git a/cmd/workspace/workspace-entity-tag-assignments/workspace-entity-tag-assignments.go b/cmd/workspace/workspace-entity-tag-assignments/workspace-entity-tag-assignments.go index 89e6ff34c58..e2f8495682e 100644 --- a/cmd/workspace/workspace-entity-tag-assignments/workspace-entity-tag-assignments.go +++ b/cmd/workspace/workspace-entity-tag-assignments/workspace-entity-tag-assignments.go @@ -3,6 +3,7 @@ package workspace_entity_tag_assignments import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -91,7 +92,7 @@ Create a tag assignment for an entity. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'entity_type', 'entity_id', 'tag_key' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'entity_type', 'entity_id', 'tag_key' in your JSON input") } return nil } diff --git a/cmd/workspace/workspace-iam-v2/workspace-iam-v2.go b/cmd/workspace/workspace-iam-v2/workspace-iam-v2.go index d5be73577ef..d028c27a185 100644 --- a/cmd/workspace/workspace-iam-v2/workspace-iam-v2.go +++ b/cmd/workspace/workspace-iam-v2/workspace-iam-v2.go @@ -3,6 +3,7 @@ package workspace_iam_v2 import ( + "errors" "fmt" "strings" @@ -99,7 +100,7 @@ func newCreateWorkspaceAssignmentDetailProxy() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'principal_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'principal_id' in your JSON input") } return nil } @@ -462,7 +463,7 @@ Resolve an external group in the Databricks account. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'external_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'external_id' in your JSON input") } return nil } @@ -549,7 +550,7 @@ Resolve an external service principal in the Databricks account. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'external_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'external_id' in your JSON input") } return nil } @@ -636,7 +637,7 @@ Resolve an external user in the Databricks account. if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'external_id' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'external_id' in your JSON input") } return nil } @@ -731,7 +732,7 @@ func newUpdateWorkspaceAssignmentDetailProxy() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(2)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, provide only PRINCIPAL_ID, UPDATE_MASK as positional arguments. Provide 'principal_id' in your JSON input") + return errors.New("when --json flag is specified, provide only PRINCIPAL_ID, UPDATE_MASK as positional arguments. Provide 'principal_id' in your JSON input") } return nil } diff --git a/cmd/workspace/workspace/workspace.go b/cmd/workspace/workspace/workspace.go index af3554bc7ec..97c47f80ac0 100644 --- a/cmd/workspace/workspace/workspace.go +++ b/cmd/workspace/workspace/workspace.go @@ -3,6 +3,7 @@ package workspace import ( + "errors" "fmt" "github.com/databricks/cli/cmd/root" @@ -98,7 +99,7 @@ func newDelete() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'path' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'path' in your JSON input") } return nil } @@ -137,7 +138,7 @@ func newDelete() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the absolute path of the notebook or directory") + return errors.New("expected to have the absolute path of the notebook or directory") } deleteReq.Path = args[0] @@ -227,7 +228,7 @@ func newExport() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the absolute path of the object or directory") + return errors.New("expected to have the absolute path of the object or directory") } exportReq.Path = args[0] @@ -491,7 +492,7 @@ func newImport() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'path' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'path' in your JSON input") } return nil } @@ -655,7 +656,7 @@ func newMkdirs() *cobra.Command { if cmd.Flags().Changed("json") { err := root.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide 'path' in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide 'path' in your JSON input") } return nil } @@ -694,7 +695,7 @@ func newMkdirs() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have the absolute path of the directory") + return errors.New("expected to have the absolute path of the directory") } mkdirsReq.Path = args[0] } diff --git a/internal/cligen/templates/service.go.tmpl b/internal/cligen/templates/service.go.tmpl index 21b634f4578..26eb44bbd88 100644 --- a/internal/cligen/templates/service.go.tmpl +++ b/internal/cligen/templates/service.go.tmpl @@ -4,6 +4,7 @@ package {{(.TrimPrefix "account").SnakeName}} import ( "encoding/json" + "errors" "fmt" "strings" "time" @@ -330,9 +331,9 @@ func new{{.PascalName}}() *cobra.Command { err := root.ExactArgs({{len .Request.RequiredInUrlFields}})(cmd, args) if err != nil { {{- if eq 0 (len .Request.RequiredInUrlFields) }} - return fmt.Errorf("when --json flag is specified, no positional arguments are allowed. Provide{{- range $index, $field := $request.RequiredFields}}{{if $index}},{{end}} '{{$field.Name}}'{{end}} in your JSON input") + return errors.New("when --json flag is specified, no positional arguments are allowed. Provide{{- range $index, $field := $request.RequiredFields}}{{if $index}},{{end}} '{{$field.Name}}'{{end}} in your JSON input") {{- else }} - return fmt.Errorf("when --json flag is specified, provide only{{- range $index, $field := .Request.RequiredInUrlFields}}{{if $index}},{{end}} {{$field.ConstantName}}{{end}} as positional arguments. Provide{{- range $index, $field := $request.RequiredRequestBodyFields}}{{if $index}},{{end}} '{{$field.Name}}'{{end}} in your JSON input") + return errors.New("when --json flag is specified, provide only{{- range $index, $field := .Request.RequiredInUrlFields}}{{if $index}},{{end}} {{$field.ConstantName}}{{end}} as positional arguments. Provide{{- range $index, $field := $request.RequiredRequestBodyFields}}{{if $index}},{{end}} '{{$field.Name}}'{{end}} in your JSON input") {{- end }} } return nil @@ -364,7 +365,7 @@ func new{{.PascalName}}() *cobra.Command { } } }{{end}}{{ if .MustUseJson }}else { - return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") + return errors.New("please provide command input in JSON format by specifying the --json flag") }{{- end}} {{- if $hasPosArgs }} {{- if and $canUseJson $hasSingleRequiredRequestBodyFieldWithPrompt }} else { @@ -385,7 +386,7 @@ func new{{.PascalName}}() *cobra.Command { args = append(args, id) } if len(args) != 1 { - return fmt.Errorf("expected to have {{range $request.RequiredFields}}{{.Summary | trimSuffix "." | lower}}{{end}}") + return errors.New("expected to have {{range $request.RequiredFields}}{{.Summary | trimSuffix "." | lower}}{{end}}") } {{- end -}}