diff --git a/.codegen/service.go.tmpl b/.codegen/service.go.tmpl index 281dfd6eb8f..c7ad85ff1d2 100644 --- a/.codegen/service.go.tmpl +++ b/.codegen/service.go.tmpl @@ -233,7 +233,7 @@ func new{{.PascalName}}() *cobra.Command { if cmd.Flags().Changed("json") { err = {{.CamelName}}Json.Unmarshal(&{{.CamelName}}Req) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } }{{end}}{{ if .MustUseJson }}else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/account/access-control/access-control.go b/cmd/account/access-control/access-control.go index f6761a1b4b7..87467d89507 100755 --- a/cmd/account/access-control/access-control.go +++ b/cmd/account/access-control/access-control.go @@ -207,7 +207,7 @@ func newUpdateRuleSet() *cobra.Command { if cmd.Flags().Changed("json") { err = updateRuleSetJson.Unmarshal(&updateRuleSetReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/account/budgets/budgets.go b/cmd/account/budgets/budgets.go index 6b47bb32cf1..f435fc7d1cc 100755 --- a/cmd/account/budgets/budgets.go +++ b/cmd/account/budgets/budgets.go @@ -80,7 +80,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -318,7 +318,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/account/credentials/credentials.go b/cmd/account/credentials/credentials.go index ed071cda358..296cc513fcf 100755 --- a/cmd/account/credentials/credentials.go +++ b/cmd/account/credentials/credentials.go @@ -92,7 +92,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/account/csp-enablement-account/csp-enablement-account.go b/cmd/account/csp-enablement-account/csp-enablement-account.go index d6fce9537d1..882e5853842 100755 --- a/cmd/account/csp-enablement-account/csp-enablement-account.go +++ b/cmd/account/csp-enablement-account/csp-enablement-account.go @@ -131,7 +131,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/account/custom-app-integration/custom-app-integration.go b/cmd/account/custom-app-integration/custom-app-integration.go index 5cdf422d72d..837402583da 100755 --- a/cmd/account/custom-app-integration/custom-app-integration.go +++ b/cmd/account/custom-app-integration/custom-app-integration.go @@ -3,6 +3,8 @@ package custom_app_integration import ( + "fmt" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/flags" @@ -90,7 +92,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -322,7 +324,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.IntegrationId = args[0] diff --git a/cmd/account/disable-legacy-features/disable-legacy-features.go b/cmd/account/disable-legacy-features/disable-legacy-features.go index 6d25b943d29..5a5e7a5f9be 100755 --- a/cmd/account/disable-legacy-features/disable-legacy-features.go +++ b/cmd/account/disable-legacy-features/disable-legacy-features.go @@ -187,7 +187,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/account/encryption-keys/encryption-keys.go b/cmd/account/encryption-keys/encryption-keys.go index 44545ccfa4c..4a496f1297e 100755 --- a/cmd/account/encryption-keys/encryption-keys.go +++ b/cmd/account/encryption-keys/encryption-keys.go @@ -109,7 +109,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/account/esm-enablement-account/esm-enablement-account.go b/cmd/account/esm-enablement-account/esm-enablement-account.go index 71149e5ad06..337aa981958 100755 --- a/cmd/account/esm-enablement-account/esm-enablement-account.go +++ b/cmd/account/esm-enablement-account/esm-enablement-account.go @@ -129,7 +129,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/account/groups/groups.go b/cmd/account/groups/groups.go index a7e1ac430fb..02ef82056ec 100755 --- a/cmd/account/groups/groups.go +++ b/cmd/account/groups/groups.go @@ -99,7 +99,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -360,7 +360,7 @@ func newPatch() *cobra.Command { if cmd.Flags().Changed("json") { err = patchJson.Unmarshal(&patchReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -448,7 +448,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/account/ip-access-lists/ip-access-lists.go b/cmd/account/ip-access-lists/ip-access-lists.go index 5c6d27dd7c5..f46eccca732 100755 --- a/cmd/account/ip-access-lists/ip-access-lists.go +++ b/cmd/account/ip-access-lists/ip-access-lists.go @@ -134,7 +134,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -413,7 +413,7 @@ func newReplace() *cobra.Command { if cmd.Flags().Changed("json") { err = replaceJson.Unmarshal(&replaceReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } replaceReq.IpAccessListId = args[0] @@ -507,7 +507,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/account/log-delivery/log-delivery.go b/cmd/account/log-delivery/log-delivery.go index 4584f4d2baf..965cc63a1e2 100755 --- a/cmd/account/log-delivery/log-delivery.go +++ b/cmd/account/log-delivery/log-delivery.go @@ -164,7 +164,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -371,7 +371,7 @@ func newPatchStatus() *cobra.Command { if cmd.Flags().Changed("json") { err = patchStatusJson.Unmarshal(&patchStatusReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } patchStatusReq.LogDeliveryConfigurationId = args[0] diff --git a/cmd/account/metastore-assignments/metastore-assignments.go b/cmd/account/metastore-assignments/metastore-assignments.go index d7f32ccb9c9..21ce01e8acc 100755 --- a/cmd/account/metastore-assignments/metastore-assignments.go +++ b/cmd/account/metastore-assignments/metastore-assignments.go @@ -87,7 +87,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } _, err = fmt.Sscan(args[0], &createReq.WorkspaceId) @@ -345,7 +345,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } _, err = fmt.Sscan(args[0], &updateReq.WorkspaceId) diff --git a/cmd/account/metastores/metastores.go b/cmd/account/metastores/metastores.go index 7c8e3f2c17a..d9629f2fc2e 100755 --- a/cmd/account/metastores/metastores.go +++ b/cmd/account/metastores/metastores.go @@ -3,6 +3,8 @@ package metastores import ( + "fmt" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/flags" @@ -82,7 +84,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -306,7 +308,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.MetastoreId = args[0] diff --git a/cmd/account/network-connectivity/network-connectivity.go b/cmd/account/network-connectivity/network-connectivity.go index cd8da290530..12a0f5d16e9 100755 --- a/cmd/account/network-connectivity/network-connectivity.go +++ b/cmd/account/network-connectivity/network-connectivity.go @@ -98,7 +98,7 @@ func newCreateNetworkConnectivityConfiguration() *cobra.Command { if cmd.Flags().Changed("json") { err = createNetworkConnectivityConfigurationJson.Unmarshal(&createNetworkConnectivityConfigurationReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -189,7 +189,7 @@ func newCreatePrivateEndpointRule() *cobra.Command { if cmd.Flags().Changed("json") { err = createPrivateEndpointRuleJson.Unmarshal(&createPrivateEndpointRuleReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } createPrivateEndpointRuleReq.NetworkConnectivityConfigId = args[0] diff --git a/cmd/account/networks/networks.go b/cmd/account/networks/networks.go index 05ef0c81550..27fa502ac19 100755 --- a/cmd/account/networks/networks.go +++ b/cmd/account/networks/networks.go @@ -99,7 +99,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { diff --git a/cmd/account/personal-compute/personal-compute.go b/cmd/account/personal-compute/personal-compute.go index 2a14b0b33bd..7dccaa5e49d 100755 --- a/cmd/account/personal-compute/personal-compute.go +++ b/cmd/account/personal-compute/personal-compute.go @@ -191,7 +191,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/account/private-access/private-access.go b/cmd/account/private-access/private-access.go index d527fa64e39..34501b9cd22 100755 --- a/cmd/account/private-access/private-access.go +++ b/cmd/account/private-access/private-access.go @@ -111,7 +111,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -413,7 +413,7 @@ func newReplace() *cobra.Command { if cmd.Flags().Changed("json") { err = replaceJson.Unmarshal(&replaceReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } replaceReq.PrivateAccessSettingsId = args[0] diff --git a/cmd/account/published-app-integration/published-app-integration.go b/cmd/account/published-app-integration/published-app-integration.go index 5143d53ccf5..9e10ec6c4aa 100755 --- a/cmd/account/published-app-integration/published-app-integration.go +++ b/cmd/account/published-app-integration/published-app-integration.go @@ -3,6 +3,8 @@ package published_app_integration import ( + "fmt" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/flags" @@ -87,7 +89,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -317,7 +319,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.IntegrationId = args[0] diff --git a/cmd/account/service-principals/service-principals.go b/cmd/account/service-principals/service-principals.go index c86810f1d54..d800c7dbdee 100755 --- a/cmd/account/service-principals/service-principals.go +++ b/cmd/account/service-principals/service-principals.go @@ -97,7 +97,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -360,7 +360,7 @@ func newPatch() *cobra.Command { if cmd.Flags().Changed("json") { err = patchJson.Unmarshal(&patchReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -450,7 +450,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/account/storage-credentials/storage-credentials.go b/cmd/account/storage-credentials/storage-credentials.go index 4280ae8c3c6..3fe87e1b76e 100755 --- a/cmd/account/storage-credentials/storage-credentials.go +++ b/cmd/account/storage-credentials/storage-credentials.go @@ -3,6 +3,8 @@ package storage_credentials import ( + "fmt" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/flags" @@ -90,7 +92,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } createReq.MetastoreId = args[0] @@ -342,7 +344,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.MetastoreId = args[0] diff --git a/cmd/account/storage/storage.go b/cmd/account/storage/storage.go index 50460ed0a7c..135d68f9408 100755 --- a/cmd/account/storage/storage.go +++ b/cmd/account/storage/storage.go @@ -89,7 +89,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/account/usage-dashboards/usage-dashboards.go b/cmd/account/usage-dashboards/usage-dashboards.go index 8a1c324764d..ddf27df33ad 100755 --- a/cmd/account/usage-dashboards/usage-dashboards.go +++ b/cmd/account/usage-dashboards/usage-dashboards.go @@ -3,6 +3,8 @@ package usage_dashboards import ( + "fmt" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/flags" @@ -82,7 +84,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } diff --git a/cmd/account/users/users.go b/cmd/account/users/users.go index 289d2972fe3..4766f3e6219 100755 --- a/cmd/account/users/users.go +++ b/cmd/account/users/users.go @@ -105,7 +105,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -376,7 +376,7 @@ func newPatch() *cobra.Command { if cmd.Flags().Changed("json") { err = patchJson.Unmarshal(&patchReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -467,7 +467,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/account/vpc-endpoints/vpc-endpoints.go b/cmd/account/vpc-endpoints/vpc-endpoints.go index e6c6c126a6c..33eaab58acf 100755 --- a/cmd/account/vpc-endpoints/vpc-endpoints.go +++ b/cmd/account/vpc-endpoints/vpc-endpoints.go @@ -106,7 +106,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { diff --git a/cmd/account/workspace-assignment/workspace-assignment.go b/cmd/account/workspace-assignment/workspace-assignment.go index 58468d09f0c..8cc00c4aded 100755 --- a/cmd/account/workspace-assignment/workspace-assignment.go +++ b/cmd/account/workspace-assignment/workspace-assignment.go @@ -275,7 +275,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } _, err = fmt.Sscan(args[0], &updateReq.WorkspaceId) diff --git a/cmd/account/workspaces/workspaces.go b/cmd/account/workspaces/workspaces.go index 1ec6230b2e8..8353e5cf186 100755 --- a/cmd/account/workspaces/workspaces.go +++ b/cmd/account/workspaces/workspaces.go @@ -135,7 +135,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -553,7 +553,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/alerts-legacy/alerts-legacy.go b/cmd/workspace/alerts-legacy/alerts-legacy.go index 1046b112450..9c46a0d0dcc 100755 --- a/cmd/workspace/alerts-legacy/alerts-legacy.go +++ b/cmd/workspace/alerts-legacy/alerts-legacy.go @@ -95,7 +95,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -359,7 +359,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/alerts/alerts.go b/cmd/workspace/alerts/alerts.go index cfaa3f55fa4..54438614f4f 100755 --- a/cmd/workspace/alerts/alerts.go +++ b/cmd/workspace/alerts/alerts.go @@ -87,7 +87,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -356,7 +356,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.Id = args[0] diff --git a/cmd/workspace/apps/apps.go b/cmd/workspace/apps/apps.go index 780f559452d..5728aff0dba 100755 --- a/cmd/workspace/apps/apps.go +++ b/cmd/workspace/apps/apps.go @@ -115,7 +115,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -269,7 +269,7 @@ func newDeploy() *cobra.Command { if cmd.Flags().Changed("json") { err = deployJson.Unmarshal(&deployReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } deployReq.AppName = args[0] @@ -704,7 +704,7 @@ func newSetPermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = setPermissionsJson.Unmarshal(&setPermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } setPermissionsReq.AppName = args[0] @@ -938,7 +938,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.Name = args[0] @@ -1007,7 +1007,7 @@ func newUpdatePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updatePermissionsReq.AppName = args[0] diff --git a/cmd/workspace/artifact-allowlists/artifact-allowlists.go b/cmd/workspace/artifact-allowlists/artifact-allowlists.go index fc25e3cb8de..49e090f585e 100755 --- a/cmd/workspace/artifact-allowlists/artifact-allowlists.go +++ b/cmd/workspace/artifact-allowlists/artifact-allowlists.go @@ -147,7 +147,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go b/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go index 2385195bb11..a71cb312305 100755 --- a/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go +++ b/cmd/workspace/automatic-cluster-update/automatic-cluster-update.go @@ -129,7 +129,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/catalogs/catalogs.go b/cmd/workspace/catalogs/catalogs.go index a17bb007240..22e55bd22aa 100755 --- a/cmd/workspace/catalogs/catalogs.go +++ b/cmd/workspace/catalogs/catalogs.go @@ -107,7 +107,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -365,7 +365,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.Name = args[0] diff --git a/cmd/workspace/clean-rooms/clean-rooms.go b/cmd/workspace/clean-rooms/clean-rooms.go index 9466c4b9475..387a5c24588 100755 --- a/cmd/workspace/clean-rooms/clean-rooms.go +++ b/cmd/workspace/clean-rooms/clean-rooms.go @@ -87,7 +87,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -346,7 +346,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.Name = args[0] diff --git a/cmd/workspace/cluster-policies/cluster-policies.go b/cmd/workspace/cluster-policies/cluster-policies.go index 830d44ca39f..98261d487ee 100755 --- a/cmd/workspace/cluster-policies/cluster-policies.go +++ b/cmd/workspace/cluster-policies/cluster-policies.go @@ -115,7 +115,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -187,7 +187,7 @@ func newDelete() *cobra.Command { if cmd.Flags().Changed("json") { err = deleteJson.Unmarshal(&deleteReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -286,7 +286,7 @@ func newEdit() *cobra.Command { if cmd.Flags().Changed("json") { err = editJson.Unmarshal(&editReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -632,7 +632,7 @@ func newSetPermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = setPermissionsJson.Unmarshal(&setPermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -713,7 +713,7 @@ func newUpdatePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/clusters/clusters.go b/cmd/workspace/clusters/clusters.go index b36102d98a6..78a74ce2f28 100755 --- a/cmd/workspace/clusters/clusters.go +++ b/cmd/workspace/clusters/clusters.go @@ -136,7 +136,7 @@ func newChangeOwner() *cobra.Command { if cmd.Flags().Changed("json") { err = changeOwnerJson.Unmarshal(&changeOwnerReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -270,7 +270,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -364,7 +364,7 @@ func newDelete() *cobra.Command { if cmd.Flags().Changed("json") { err = deleteJson.Unmarshal(&deleteReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -521,7 +521,7 @@ func newEdit() *cobra.Command { if cmd.Flags().Changed("json") { err = editJson.Unmarshal(&editReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -619,7 +619,7 @@ func newEvents() *cobra.Command { if cmd.Flags().Changed("json") { err = eventsJson.Unmarshal(&eventsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -1071,7 +1071,7 @@ func newPermanentDelete() *cobra.Command { if cmd.Flags().Changed("json") { err = permanentDeleteJson.Unmarshal(&permanentDeleteReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -1163,7 +1163,7 @@ func newPin() *cobra.Command { if cmd.Flags().Changed("json") { err = pinJson.Unmarshal(&pinReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -1262,7 +1262,7 @@ func newResize() *cobra.Command { if cmd.Flags().Changed("json") { err = resizeJson.Unmarshal(&resizeReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -1372,7 +1372,7 @@ func newRestart() *cobra.Command { if cmd.Flags().Changed("json") { err = restartJson.Unmarshal(&restartReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -1466,7 +1466,7 @@ func newSetPermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = setPermissionsJson.Unmarshal(&setPermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -1610,7 +1610,7 @@ func newStart() *cobra.Command { if cmd.Flags().Changed("json") { err = startJson.Unmarshal(&startReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -1714,7 +1714,7 @@ func newUnpin() *cobra.Command { if cmd.Flags().Changed("json") { err = unpinJson.Unmarshal(&unpinReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -1826,7 +1826,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -1907,7 +1907,7 @@ func newUpdatePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(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 a7b45901fd1..ed9e6a80de0 100755 --- a/cmd/workspace/compliance-security-profile/compliance-security-profile.go +++ b/cmd/workspace/compliance-security-profile/compliance-security-profile.go @@ -132,7 +132,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/connections/connections.go b/cmd/workspace/connections/connections.go index f76420fbe9d..680f9b0cedb 100755 --- a/cmd/workspace/connections/connections.go +++ b/cmd/workspace/connections/connections.go @@ -94,7 +94,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -357,7 +357,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/consumer-installations/consumer-installations.go b/cmd/workspace/consumer-installations/consumer-installations.go index 92f61789f1b..09c3fee5d6d 100755 --- a/cmd/workspace/consumer-installations/consumer-installations.go +++ b/cmd/workspace/consumer-installations/consumer-installations.go @@ -88,7 +88,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } createReq.ListingId = args[0] @@ -321,7 +321,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/consumer-personalization-requests/consumer-personalization-requests.go b/cmd/workspace/consumer-personalization-requests/consumer-personalization-requests.go index 8b0af3cc684..33ec136a160 100755 --- a/cmd/workspace/consumer-personalization-requests/consumer-personalization-requests.go +++ b/cmd/workspace/consumer-personalization-requests/consumer-personalization-requests.go @@ -87,7 +87,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/credentials-manager/credentials-manager.go b/cmd/workspace/credentials-manager/credentials-manager.go index 5a40232b3a8..f23d1c271f3 100755 --- a/cmd/workspace/credentials-manager/credentials-manager.go +++ b/cmd/workspace/credentials-manager/credentials-manager.go @@ -77,7 +77,7 @@ func newExchangeToken() *cobra.Command { if cmd.Flags().Changed("json") { err = exchangeTokenJson.Unmarshal(&exchangeTokenReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/dashboard-widgets/dashboard-widgets.go b/cmd/workspace/dashboard-widgets/dashboard-widgets.go index 02b13739a50..967bb682edb 100755 --- a/cmd/workspace/dashboard-widgets/dashboard-widgets.go +++ b/cmd/workspace/dashboard-widgets/dashboard-widgets.go @@ -77,7 +77,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -198,7 +198,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/dashboards/dashboards.go b/cmd/workspace/dashboards/dashboards.go index fcab0aa2abc..872f2e08d31 100755 --- a/cmd/workspace/dashboards/dashboards.go +++ b/cmd/workspace/dashboards/dashboards.go @@ -80,7 +80,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -407,7 +407,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/default-namespace/default-namespace.go b/cmd/workspace/default-namespace/default-namespace.go index b15907bec46..426f4d1ca38 100755 --- a/cmd/workspace/default-namespace/default-namespace.go +++ b/cmd/workspace/default-namespace/default-namespace.go @@ -201,7 +201,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/disable-legacy-access/disable-legacy-access.go b/cmd/workspace/disable-legacy-access/disable-legacy-access.go index fea2b3c4018..2d8f26e1512 100755 --- a/cmd/workspace/disable-legacy-access/disable-legacy-access.go +++ b/cmd/workspace/disable-legacy-access/disable-legacy-access.go @@ -189,7 +189,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go b/cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go index a8acc5cd1e9..794ba1bb026 100755 --- a/cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go +++ b/cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go @@ -134,7 +134,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/experiments/experiments.go b/cmd/workspace/experiments/experiments.go index b1af2f868b1..a91e980e43c 100755 --- a/cmd/workspace/experiments/experiments.go +++ b/cmd/workspace/experiments/experiments.go @@ -132,7 +132,7 @@ func newCreateExperiment() *cobra.Command { if cmd.Flags().Changed("json") { err = createExperimentJson.Unmarshal(&createExperimentReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -205,7 +205,7 @@ func newCreateRun() *cobra.Command { if cmd.Flags().Changed("json") { err = createRunJson.Unmarshal(&createRunReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -279,7 +279,7 @@ func newDeleteExperiment() *cobra.Command { if cmd.Flags().Changed("json") { err = deleteExperimentJson.Unmarshal(&deleteExperimentReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -354,7 +354,7 @@ func newDeleteRun() *cobra.Command { if cmd.Flags().Changed("json") { err = deleteRunJson.Unmarshal(&deleteRunReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -437,7 +437,7 @@ func newDeleteRuns() *cobra.Command { if cmd.Flags().Changed("json") { err = deleteRunsJson.Unmarshal(&deleteRunsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -520,7 +520,7 @@ func newDeleteTag() *cobra.Command { if cmd.Flags().Changed("json") { err = deleteTagJson.Unmarshal(&deleteTagReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -1110,7 +1110,7 @@ func newLogBatch() *cobra.Command { if cmd.Flags().Changed("json") { err = logBatchJson.Unmarshal(&logBatchReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -1176,7 +1176,7 @@ func newLogInputs() *cobra.Command { if cmd.Flags().Changed("json") { err = logInputsJson.Unmarshal(&logInputsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -1256,7 +1256,7 @@ func newLogMetric() *cobra.Command { if cmd.Flags().Changed("json") { err = logMetricJson.Unmarshal(&logMetricReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -1337,7 +1337,7 @@ func newLogModel() *cobra.Command { if cmd.Flags().Changed("json") { err = logModelJson.Unmarshal(&logModelReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -1416,7 +1416,7 @@ func newLogParam() *cobra.Command { if cmd.Flags().Changed("json") { err = logParamJson.Unmarshal(&logParamReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -1499,7 +1499,7 @@ func newRestoreExperiment() *cobra.Command { if cmd.Flags().Changed("json") { err = restoreExperimentJson.Unmarshal(&restoreExperimentReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -1574,7 +1574,7 @@ func newRestoreRun() *cobra.Command { if cmd.Flags().Changed("json") { err = restoreRunJson.Unmarshal(&restoreRunReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -1657,7 +1657,7 @@ func newRestoreRuns() *cobra.Command { if cmd.Flags().Changed("json") { err = restoreRunsJson.Unmarshal(&restoreRunsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -1734,7 +1734,7 @@ func newSearchExperiments() *cobra.Command { if cmd.Flags().Changed("json") { err = searchExperimentsJson.Unmarshal(&searchExperimentsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -1802,7 +1802,7 @@ func newSearchRuns() *cobra.Command { if cmd.Flags().Changed("json") { err = searchRunsJson.Unmarshal(&searchRunsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -1876,7 +1876,7 @@ func newSetExperimentTag() *cobra.Command { if cmd.Flags().Changed("json") { err = setExperimentTagJson.Unmarshal(&setExperimentTagReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -1953,7 +1953,7 @@ func newSetPermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = setPermissionsJson.Unmarshal(&setPermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } setPermissionsReq.ExperimentId = args[0] @@ -2034,7 +2034,7 @@ func newSetTag() *cobra.Command { if cmd.Flags().Changed("json") { err = setTagJson.Unmarshal(&setTagReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -2114,7 +2114,7 @@ func newUpdateExperiment() *cobra.Command { if cmd.Flags().Changed("json") { err = updateExperimentJson.Unmarshal(&updateExperimentReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -2185,7 +2185,7 @@ func newUpdatePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updatePermissionsReq.ExperimentId = args[0] @@ -2253,7 +2253,7 @@ func newUpdateRun() *cobra.Command { if cmd.Flags().Changed("json") { err = updateRunJson.Unmarshal(&updateRunReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } diff --git a/cmd/workspace/external-locations/external-locations.go b/cmd/workspace/external-locations/external-locations.go index 42493fc462c..83487d8af82 100755 --- a/cmd/workspace/external-locations/external-locations.go +++ b/cmd/workspace/external-locations/external-locations.go @@ -114,7 +114,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -383,7 +383,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.Name = args[0] diff --git a/cmd/workspace/functions/functions.go b/cmd/workspace/functions/functions.go index c8de4879734..7a363d0714d 100755 --- a/cmd/workspace/functions/functions.go +++ b/cmd/workspace/functions/functions.go @@ -87,7 +87,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -383,7 +383,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/genie/genie.go b/cmd/workspace/genie/genie.go index e4a059091c4..7b2d38b1909 100755 --- a/cmd/workspace/genie/genie.go +++ b/cmd/workspace/genie/genie.go @@ -107,7 +107,7 @@ func newCreateMessage() *cobra.Command { if cmd.Flags().Changed("json") { err = createMessageJson.Unmarshal(&createMessageReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } createMessageReq.SpaceId = args[0] @@ -394,7 +394,7 @@ func newStartConversation() *cobra.Command { if cmd.Flags().Changed("json") { err = startConversationJson.Unmarshal(&startConversationReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } startConversationReq.SpaceId = args[0] diff --git a/cmd/workspace/git-credentials/git-credentials.go b/cmd/workspace/git-credentials/git-credentials.go index b5082d311d1..6dda8da0e52 100755 --- a/cmd/workspace/git-credentials/git-credentials.go +++ b/cmd/workspace/git-credentials/git-credentials.go @@ -105,7 +105,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -373,7 +373,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } _, err = fmt.Sscan(args[0], &updateReq.CredentialId) diff --git a/cmd/workspace/global-init-scripts/global-init-scripts.go b/cmd/workspace/global-init-scripts/global-init-scripts.go index 92dcb259245..415e5ea053c 100755 --- a/cmd/workspace/global-init-scripts/global-init-scripts.go +++ b/cmd/workspace/global-init-scripts/global-init-scripts.go @@ -103,7 +103,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -369,7 +369,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.ScriptId = args[0] diff --git a/cmd/workspace/grants/grants.go b/cmd/workspace/grants/grants.go index 876f0343e59..3514b6dbd7e 100755 --- a/cmd/workspace/grants/grants.go +++ b/cmd/workspace/grants/grants.go @@ -225,7 +225,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } _, err = fmt.Sscan(args[0], &updateReq.SecurableType) diff --git a/cmd/workspace/groups/groups.go b/cmd/workspace/groups/groups.go index 14650d98447..5ec7c43944f 100755 --- a/cmd/workspace/groups/groups.go +++ b/cmd/workspace/groups/groups.go @@ -99,7 +99,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -360,7 +360,7 @@ func newPatch() *cobra.Command { if cmd.Flags().Changed("json") { err = patchJson.Unmarshal(&patchReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -448,7 +448,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/instance-pools/instance-pools.go b/cmd/workspace/instance-pools/instance-pools.go index db96f14663f..32d27134c62 100755 --- a/cmd/workspace/instance-pools/instance-pools.go +++ b/cmd/workspace/instance-pools/instance-pools.go @@ -130,7 +130,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -208,7 +208,7 @@ func newDelete() *cobra.Command { if cmd.Flags().Changed("json") { err = deleteJson.Unmarshal(&deleteReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -311,7 +311,7 @@ func newEdit() *cobra.Command { if cmd.Flags().Changed("json") { err = editJson.Unmarshal(&editReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -633,7 +633,7 @@ func newSetPermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = setPermissionsJson.Unmarshal(&setPermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -714,7 +714,7 @@ func newUpdatePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/instance-profiles/instance-profiles.go b/cmd/workspace/instance-profiles/instance-profiles.go index 7134c16c624..8e0e05593c5 100755 --- a/cmd/workspace/instance-profiles/instance-profiles.go +++ b/cmd/workspace/instance-profiles/instance-profiles.go @@ -101,7 +101,7 @@ func newAdd() *cobra.Command { if cmd.Flags().Changed("json") { err = addJson.Unmarshal(&addReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -194,7 +194,7 @@ func newEdit() *cobra.Command { if cmd.Flags().Changed("json") { err = editJson.Unmarshal(&editReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -313,7 +313,7 @@ func newRemove() *cobra.Command { if cmd.Flags().Changed("json") { err = removeJson.Unmarshal(&removeReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { diff --git a/cmd/workspace/ip-access-lists/ip-access-lists.go b/cmd/workspace/ip-access-lists/ip-access-lists.go index ec5958b5be8..9d7ab9272f5 100755 --- a/cmd/workspace/ip-access-lists/ip-access-lists.go +++ b/cmd/workspace/ip-access-lists/ip-access-lists.go @@ -135,7 +135,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -416,7 +416,7 @@ func newReplace() *cobra.Command { if cmd.Flags().Changed("json") { err = replaceJson.Unmarshal(&replaceReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } replaceReq.IpAccessListId = args[0] @@ -512,7 +512,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/jobs/jobs.go b/cmd/workspace/jobs/jobs.go index 2d422fa8c3e..dd110dc8647 100755 --- a/cmd/workspace/jobs/jobs.go +++ b/cmd/workspace/jobs/jobs.go @@ -118,7 +118,7 @@ func newCancelAllRuns() *cobra.Command { if cmd.Flags().Changed("json") { err = cancelAllRunsJson.Unmarshal(&cancelAllRunsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -195,7 +195,7 @@ func newCancelRun() *cobra.Command { if cmd.Flags().Changed("json") { err = cancelRunJson.Unmarshal(&cancelRunReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -293,7 +293,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -366,7 +366,7 @@ func newDelete() *cobra.Command { if cmd.Flags().Changed("json") { err = deleteJson.Unmarshal(&deleteReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -459,7 +459,7 @@ func newDeleteRun() *cobra.Command { if cmd.Flags().Changed("json") { err = deleteRunJson.Unmarshal(&deleteRunReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -1145,7 +1145,7 @@ func newRepairRun() *cobra.Command { if cmd.Flags().Changed("json") { err = repairRunJson.Unmarshal(&repairRunReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -1244,7 +1244,7 @@ func newReset() *cobra.Command { if cmd.Flags().Changed("json") { err = resetJson.Unmarshal(&resetReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -1334,7 +1334,7 @@ func newRunNow() *cobra.Command { if cmd.Flags().Changed("json") { err = runNowJson.Unmarshal(&runNowReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -1438,7 +1438,7 @@ func newSetPermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = setPermissionsJson.Unmarshal(&setPermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -1540,7 +1540,7 @@ func newSubmit() *cobra.Command { if cmd.Flags().Changed("json") { err = submitJson.Unmarshal(&submitReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -1634,7 +1634,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -1719,7 +1719,7 @@ func newUpdatePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/lakeview/lakeview.go b/cmd/workspace/lakeview/lakeview.go index ef2d6845b06..079b1a9c810 100755 --- a/cmd/workspace/lakeview/lakeview.go +++ b/cmd/workspace/lakeview/lakeview.go @@ -110,7 +110,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -182,7 +182,7 @@ func newCreateSchedule() *cobra.Command { if cmd.Flags().Changed("json") { err = createScheduleJson.Unmarshal(&createScheduleReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -252,7 +252,7 @@ func newCreateSubscription() *cobra.Command { if cmd.Flags().Changed("json") { err = createSubscriptionJson.Unmarshal(&createSubscriptionReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -872,7 +872,7 @@ func newMigrate() *cobra.Command { if cmd.Flags().Changed("json") { err = migrateJson.Unmarshal(&migrateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -943,7 +943,7 @@ func newPublish() *cobra.Command { if cmd.Flags().Changed("json") { err = publishJson.Unmarshal(&publishReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } publishReq.DashboardId = args[0] @@ -1130,7 +1130,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.DashboardId = args[0] @@ -1202,7 +1202,7 @@ func newUpdateSchedule() *cobra.Command { if cmd.Flags().Changed("json") { err = updateScheduleJson.Unmarshal(&updateScheduleReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/libraries/libraries.go b/cmd/workspace/libraries/libraries.go index 2c10d8161d5..d8712849827 100755 --- a/cmd/workspace/libraries/libraries.go +++ b/cmd/workspace/libraries/libraries.go @@ -192,7 +192,7 @@ func newInstall() *cobra.Command { if cmd.Flags().Changed("json") { err = installJson.Unmarshal(&installReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -253,7 +253,7 @@ func newUninstall() *cobra.Command { if cmd.Flags().Changed("json") { err = uninstallJson.Unmarshal(&uninstallReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/metastores/metastores.go b/cmd/workspace/metastores/metastores.go index 22bcd3dcf6d..a72c0078048 100755 --- a/cmd/workspace/metastores/metastores.go +++ b/cmd/workspace/metastores/metastores.go @@ -114,7 +114,7 @@ func newAssign() *cobra.Command { if cmd.Flags().Changed("json") { err = assignJson.Unmarshal(&assignReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } _, err = fmt.Sscan(args[0], &assignReq.WorkspaceId) @@ -203,7 +203,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -608,7 +608,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -692,7 +692,7 @@ func newUpdateAssignment() *cobra.Command { if cmd.Flags().Changed("json") { err = updateAssignmentJson.Unmarshal(&updateAssignmentReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/model-registry/model-registry.go b/cmd/workspace/model-registry/model-registry.go index 41f06ac4d52..7c062c628a9 100755 --- a/cmd/workspace/model-registry/model-registry.go +++ b/cmd/workspace/model-registry/model-registry.go @@ -143,7 +143,7 @@ func newApproveTransitionRequest() *cobra.Command { if cmd.Flags().Changed("json") { err = approveTransitionRequestJson.Unmarshal(&approveTransitionRequestReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -237,7 +237,7 @@ func newCreateComment() *cobra.Command { if cmd.Flags().Changed("json") { err = createCommentJson.Unmarshal(&createCommentReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -324,7 +324,7 @@ func newCreateModel() *cobra.Command { if cmd.Flags().Changed("json") { err = createModelJson.Unmarshal(&createModelReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -405,7 +405,7 @@ func newCreateModelVersion() *cobra.Command { if cmd.Flags().Changed("json") { err = createModelVersionJson.Unmarshal(&createModelVersionReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -495,7 +495,7 @@ func newCreateTransitionRequest() *cobra.Command { if cmd.Flags().Changed("json") { err = createTransitionRequestJson.Unmarshal(&createTransitionRequestReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -572,7 +572,7 @@ func newCreateWebhook() *cobra.Command { if cmd.Flags().Changed("json") { err = createWebhookJson.Unmarshal(&createWebhookReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -1081,7 +1081,7 @@ func newGetLatestVersions() *cobra.Command { if cmd.Flags().Changed("json") { err = getLatestVersionsJson.Unmarshal(&getLatestVersionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -1631,7 +1631,7 @@ func newRejectTransitionRequest() *cobra.Command { if cmd.Flags().Changed("json") { err = rejectTransitionRequestJson.Unmarshal(&rejectTransitionRequestReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -1717,7 +1717,7 @@ func newRenameModel() *cobra.Command { if cmd.Flags().Changed("json") { err = renameModelJson.Unmarshal(&renameModelReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -1909,7 +1909,7 @@ func newSetModelTag() *cobra.Command { if cmd.Flags().Changed("json") { err = setModelTagJson.Unmarshal(&setModelTagReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -1998,7 +1998,7 @@ func newSetModelVersionTag() *cobra.Command { if cmd.Flags().Changed("json") { err = setModelVersionTagJson.Unmarshal(&setModelVersionTagReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -2078,7 +2078,7 @@ func newSetPermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = setPermissionsJson.Unmarshal(&setPermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } setPermissionsReq.RegisteredModelId = args[0] @@ -2168,7 +2168,7 @@ func newTestRegistryWebhook() *cobra.Command { if cmd.Flags().Changed("json") { err = testRegistryWebhookJson.Unmarshal(&testRegistryWebhookReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -2261,7 +2261,7 @@ func newTransitionStage() *cobra.Command { if cmd.Flags().Changed("json") { err = transitionStageJson.Unmarshal(&transitionStageReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -2352,7 +2352,7 @@ func newUpdateComment() *cobra.Command { if cmd.Flags().Changed("json") { err = updateCommentJson.Unmarshal(&updateCommentReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -2432,7 +2432,7 @@ func newUpdateModel() *cobra.Command { if cmd.Flags().Changed("json") { err = updateModelJson.Unmarshal(&updateModelReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -2510,7 +2510,7 @@ func newUpdateModelVersion() *cobra.Command { if cmd.Flags().Changed("json") { err = updateModelVersionJson.Unmarshal(&updateModelVersionReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -2584,7 +2584,7 @@ func newUpdatePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updatePermissionsReq.RegisteredModelId = args[0] @@ -2665,7 +2665,7 @@ func newUpdateWebhook() *cobra.Command { if cmd.Flags().Changed("json") { err = updateWebhookJson.Unmarshal(&updateWebhookReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { diff --git a/cmd/workspace/model-versions/model-versions.go b/cmd/workspace/model-versions/model-versions.go index d2f05404575..b738f4d4a08 100755 --- a/cmd/workspace/model-versions/model-versions.go +++ b/cmd/workspace/model-versions/model-versions.go @@ -379,7 +379,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.FullName = args[0] diff --git a/cmd/workspace/notification-destinations/notification-destinations.go b/cmd/workspace/notification-destinations/notification-destinations.go index 5ad47cc95b6..10a80717dec 100755 --- a/cmd/workspace/notification-destinations/notification-destinations.go +++ b/cmd/workspace/notification-destinations/notification-destinations.go @@ -3,6 +3,8 @@ package notification_destinations import ( + "fmt" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/flags" @@ -86,7 +88,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -315,7 +317,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.Id = args[0] diff --git a/cmd/workspace/online-tables/online-tables.go b/cmd/workspace/online-tables/online-tables.go index da2f8c04158..9b43ed0598e 100755 --- a/cmd/workspace/online-tables/online-tables.go +++ b/cmd/workspace/online-tables/online-tables.go @@ -3,6 +3,8 @@ package online_tables import ( + "fmt" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/flags" @@ -81,7 +83,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } diff --git a/cmd/workspace/permission-migration/permission-migration.go b/cmd/workspace/permission-migration/permission-migration.go index 2e50b123157..b9bd8ee4fef 100755 --- a/cmd/workspace/permission-migration/permission-migration.go +++ b/cmd/workspace/permission-migration/permission-migration.go @@ -94,7 +94,7 @@ func newMigratePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = migratePermissionsJson.Unmarshal(&migratePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { diff --git a/cmd/workspace/permissions/permissions.go b/cmd/workspace/permissions/permissions.go index c6033e4a459..98af0d57ea5 100755 --- a/cmd/workspace/permissions/permissions.go +++ b/cmd/workspace/permissions/permissions.go @@ -3,6 +3,8 @@ package permissions import ( + "fmt" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/flags" @@ -267,7 +269,7 @@ func newSet() *cobra.Command { if cmd.Flags().Changed("json") { err = setJson.Unmarshal(&setReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } setReq.RequestObjectType = args[0] @@ -342,7 +344,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.RequestObjectType = args[0] diff --git a/cmd/workspace/pipelines/pipelines.go b/cmd/workspace/pipelines/pipelines.go index ac361e31368..a9e7722a824 100755 --- a/cmd/workspace/pipelines/pipelines.go +++ b/cmd/workspace/pipelines/pipelines.go @@ -100,7 +100,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -701,7 +701,7 @@ func newSetPermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = setPermissionsJson.Unmarshal(&setPermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -790,7 +790,7 @@ func newStartUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = startUpdateJson.Unmarshal(&startUpdateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -979,7 +979,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -1060,7 +1060,7 @@ func newUpdatePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { 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 1274c87904e..f9e7ba5585c 100755 --- a/cmd/workspace/policy-compliance-for-clusters/policy-compliance-for-clusters.go +++ b/cmd/workspace/policy-compliance-for-clusters/policy-compliance-for-clusters.go @@ -112,7 +112,7 @@ func newEnforceCompliance() *cobra.Command { if cmd.Flags().Changed("json") { err = enforceComplianceJson.Unmarshal(&enforceComplianceReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { 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 d74caa572ae..adc6b889bb6 100755 --- a/cmd/workspace/policy-compliance-for-jobs/policy-compliance-for-jobs.go +++ b/cmd/workspace/policy-compliance-for-jobs/policy-compliance-for-jobs.go @@ -106,7 +106,7 @@ func newEnforceCompliance() *cobra.Command { if cmd.Flags().Changed("json") { err = enforceComplianceJson.Unmarshal(&enforceComplianceReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { diff --git a/cmd/workspace/provider-exchange-filters/provider-exchange-filters.go b/cmd/workspace/provider-exchange-filters/provider-exchange-filters.go index a3f74621499..954801fb573 100755 --- a/cmd/workspace/provider-exchange-filters/provider-exchange-filters.go +++ b/cmd/workspace/provider-exchange-filters/provider-exchange-filters.go @@ -75,7 +75,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -261,7 +261,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/provider-exchanges/provider-exchanges.go b/cmd/workspace/provider-exchanges/provider-exchanges.go index b92403755a1..1778b660194 100755 --- a/cmd/workspace/provider-exchanges/provider-exchanges.go +++ b/cmd/workspace/provider-exchanges/provider-exchanges.go @@ -93,7 +93,7 @@ func newAddListingToExchange() *cobra.Command { if cmd.Flags().Changed("json") { err = addListingToExchangeJson.Unmarshal(&addListingToExchangeReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -156,7 +156,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -548,7 +548,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/provider-files/provider-files.go b/cmd/workspace/provider-files/provider-files.go index 62dcb6de9e5..b366c90ced0 100755 --- a/cmd/workspace/provider-files/provider-files.go +++ b/cmd/workspace/provider-files/provider-files.go @@ -79,7 +79,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -275,7 +275,7 @@ func newList() *cobra.Command { if cmd.Flags().Changed("json") { err = listJson.Unmarshal(&listReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/provider-listings/provider-listings.go b/cmd/workspace/provider-listings/provider-listings.go index 18c99c53d6a..8d44e17aac9 100755 --- a/cmd/workspace/provider-listings/provider-listings.go +++ b/cmd/workspace/provider-listings/provider-listings.go @@ -77,7 +77,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -328,7 +328,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/provider-personalization-requests/provider-personalization-requests.go b/cmd/workspace/provider-personalization-requests/provider-personalization-requests.go index d18e2e57818..54e7e193834 100755 --- a/cmd/workspace/provider-personalization-requests/provider-personalization-requests.go +++ b/cmd/workspace/provider-personalization-requests/provider-personalization-requests.go @@ -144,7 +144,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.ListingId = args[0] diff --git a/cmd/workspace/provider-provider-analytics-dashboards/provider-provider-analytics-dashboards.go b/cmd/workspace/provider-provider-analytics-dashboards/provider-provider-analytics-dashboards.go index bb3ca96664f..e47919f8f7b 100755 --- a/cmd/workspace/provider-provider-analytics-dashboards/provider-provider-analytics-dashboards.go +++ b/cmd/workspace/provider-provider-analytics-dashboards/provider-provider-analytics-dashboards.go @@ -3,6 +3,8 @@ package provider_provider_analytics_dashboards import ( + "fmt" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/flags" @@ -210,7 +212,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.Id = args[0] diff --git a/cmd/workspace/provider-providers/provider-providers.go b/cmd/workspace/provider-providers/provider-providers.go index 94d12d6f027..0012bf6fa0f 100755 --- a/cmd/workspace/provider-providers/provider-providers.go +++ b/cmd/workspace/provider-providers/provider-providers.go @@ -76,7 +76,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -327,7 +327,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/providers/providers.go b/cmd/workspace/providers/providers.go index af2737a0f26..924fce5761d 100755 --- a/cmd/workspace/providers/providers.go +++ b/cmd/workspace/providers/providers.go @@ -99,7 +99,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -448,7 +448,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/quality-monitors/quality-monitors.go b/cmd/workspace/quality-monitors/quality-monitors.go index 1ff9b017eb1..de62e0952ce 100755 --- a/cmd/workspace/quality-monitors/quality-monitors.go +++ b/cmd/workspace/quality-monitors/quality-monitors.go @@ -198,7 +198,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } createReq.TableName = args[0] @@ -561,7 +561,7 @@ func newRegenerateDashboard() *cobra.Command { if cmd.Flags().Changed("json") { err = regenerateDashboardJson.Unmarshal(®enerateDashboardReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } regenerateDashboardReq.TableName = args[0] @@ -726,7 +726,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.TableName = args[0] diff --git a/cmd/workspace/queries-legacy/queries-legacy.go b/cmd/workspace/queries-legacy/queries-legacy.go index fa78bb2b036..7eae5a793d9 100755 --- a/cmd/workspace/queries-legacy/queries-legacy.go +++ b/cmd/workspace/queries-legacy/queries-legacy.go @@ -98,7 +98,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -456,7 +456,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/queries/queries.go b/cmd/workspace/queries/queries.go index fea01451a52..b688424c5ad 100755 --- a/cmd/workspace/queries/queries.go +++ b/cmd/workspace/queries/queries.go @@ -87,7 +87,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -427,7 +427,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.Id = args[0] diff --git a/cmd/workspace/query-visualizations-legacy/query-visualizations-legacy.go b/cmd/workspace/query-visualizations-legacy/query-visualizations-legacy.go index 4f45ab23e64..ddf6de4e09d 100755 --- a/cmd/workspace/query-visualizations-legacy/query-visualizations-legacy.go +++ b/cmd/workspace/query-visualizations-legacy/query-visualizations-legacy.go @@ -89,7 +89,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -224,7 +224,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/query-visualizations/query-visualizations.go b/cmd/workspace/query-visualizations/query-visualizations.go index 042594529b2..f085fcb9760 100755 --- a/cmd/workspace/query-visualizations/query-visualizations.go +++ b/cmd/workspace/query-visualizations/query-visualizations.go @@ -86,7 +86,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -219,7 +219,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.Id = args[0] diff --git a/cmd/workspace/recipients/recipients.go b/cmd/workspace/recipients/recipients.go index f4472cf37eb..bc2261ca815 100755 --- a/cmd/workspace/recipients/recipients.go +++ b/cmd/workspace/recipients/recipients.go @@ -120,7 +120,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -406,7 +406,7 @@ func newRotateToken() *cobra.Command { if cmd.Flags().Changed("json") { err = rotateTokenJson.Unmarshal(&rotateTokenReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } rotateTokenReq.Name = args[0] @@ -556,7 +556,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/registered-models/registered-models.go b/cmd/workspace/registered-models/registered-models.go index 5aa6cdf1502..f283d30d942 100755 --- a/cmd/workspace/registered-models/registered-models.go +++ b/cmd/workspace/registered-models/registered-models.go @@ -137,7 +137,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -511,7 +511,7 @@ func newSetAlias() *cobra.Command { if cmd.Flags().Changed("json") { err = setAliasJson.Unmarshal(&setAliasReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } setAliasReq.FullName = args[0] @@ -591,7 +591,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/repos/repos.go b/cmd/workspace/repos/repos.go index f11dd3aced2..6719cf128e3 100755 --- a/cmd/workspace/repos/repos.go +++ b/cmd/workspace/repos/repos.go @@ -113,7 +113,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -523,7 +523,7 @@ func newSetPermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = setPermissionsJson.Unmarshal(&setPermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -606,7 +606,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -690,7 +690,7 @@ func newUpdatePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(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 5e9f59d2cef..fd9c7694832 100755 --- a/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go +++ b/cmd/workspace/restrict-workspace-admins/restrict-workspace-admins.go @@ -199,7 +199,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/schemas/schemas.go b/cmd/workspace/schemas/schemas.go index 3a398251fb2..0e372b9b92d 100755 --- a/cmd/workspace/schemas/schemas.go +++ b/cmd/workspace/schemas/schemas.go @@ -102,7 +102,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -388,7 +388,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/secrets/secrets.go b/cmd/workspace/secrets/secrets.go index f836a267067..364dd51d0c8 100755 --- a/cmd/workspace/secrets/secrets.go +++ b/cmd/workspace/secrets/secrets.go @@ -112,7 +112,7 @@ func newCreateScope() *cobra.Command { if cmd.Flags().Changed("json") { err = createScopeJson.Unmarshal(&createScopeReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -193,7 +193,7 @@ func newDeleteAcl() *cobra.Command { if cmd.Flags().Changed("json") { err = deleteAclJson.Unmarshal(&deleteAclReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -275,7 +275,7 @@ func newDeleteScope() *cobra.Command { if cmd.Flags().Changed("json") { err = deleteScopeJson.Unmarshal(&deleteScopeReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -356,7 +356,7 @@ func newDeleteSecret() *cobra.Command { if cmd.Flags().Changed("json") { err = deleteSecretJson.Unmarshal(&deleteSecretReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -761,7 +761,7 @@ func newPutAcl() *cobra.Command { if cmd.Flags().Changed("json") { err = putAclJson.Unmarshal(&putAclReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { diff --git a/cmd/workspace/service-principals/service-principals.go b/cmd/workspace/service-principals/service-principals.go index 957cb126518..d9ad0aa73eb 100755 --- a/cmd/workspace/service-principals/service-principals.go +++ b/cmd/workspace/service-principals/service-principals.go @@ -97,7 +97,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -360,7 +360,7 @@ func newPatch() *cobra.Command { if cmd.Flags().Changed("json") { err = patchJson.Unmarshal(&patchReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -450,7 +450,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/serving-endpoints/serving-endpoints.go b/cmd/workspace/serving-endpoints/serving-endpoints.go index 0837652dbc4..cb219b265e6 100755 --- a/cmd/workspace/serving-endpoints/serving-endpoints.go +++ b/cmd/workspace/serving-endpoints/serving-endpoints.go @@ -171,7 +171,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -708,7 +708,7 @@ func newPatch() *cobra.Command { if cmd.Flags().Changed("json") { err = patchJson.Unmarshal(&patchReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } patchReq.Name = args[0] @@ -779,7 +779,7 @@ func newPut() *cobra.Command { if cmd.Flags().Changed("json") { err = putJson.Unmarshal(&putReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } putReq.Name = args[0] @@ -852,7 +852,7 @@ func newPutAiGateway() *cobra.Command { if cmd.Flags().Changed("json") { err = putAiGatewayJson.Unmarshal(&putAiGatewayReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } putAiGatewayReq.Name = args[0] @@ -930,7 +930,7 @@ func newQuery() *cobra.Command { if cmd.Flags().Changed("json") { err = queryJson.Unmarshal(&queryReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } queryReq.Name = args[0] @@ -999,7 +999,7 @@ func newSetPermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = setPermissionsJson.Unmarshal(&setPermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } setPermissionsReq.ServingEndpointId = args[0] @@ -1078,7 +1078,7 @@ func newUpdateConfig() *cobra.Command { if cmd.Flags().Changed("json") { err = updateConfigJson.Unmarshal(&updateConfigReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateConfigReq.Name = args[0] @@ -1160,7 +1160,7 @@ func newUpdatePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updatePermissionsReq.ServingEndpointId = args[0] diff --git a/cmd/workspace/shares/shares.go b/cmd/workspace/shares/shares.go index 67f87017761..52986bfee53 100755 --- a/cmd/workspace/shares/shares.go +++ b/cmd/workspace/shares/shares.go @@ -102,7 +102,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -429,7 +429,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.Name = args[0] @@ -503,7 +503,7 @@ func newUpdatePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updatePermissionsReq.Name = args[0] diff --git a/cmd/workspace/storage-credentials/storage-credentials.go b/cmd/workspace/storage-credentials/storage-credentials.go index f4ec5eb4f49..54b87826198 100755 --- a/cmd/workspace/storage-credentials/storage-credentials.go +++ b/cmd/workspace/storage-credentials/storage-credentials.go @@ -113,7 +113,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -379,7 +379,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -480,7 +480,7 @@ func newValidate() *cobra.Command { if cmd.Flags().Changed("json") { err = validateJson.Unmarshal(&validateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } diff --git a/cmd/workspace/table-constraints/table-constraints.go b/cmd/workspace/table-constraints/table-constraints.go index 166da146ceb..d6171c483cc 100755 --- a/cmd/workspace/table-constraints/table-constraints.go +++ b/cmd/workspace/table-constraints/table-constraints.go @@ -94,7 +94,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/tables/tables.go b/cmd/workspace/tables/tables.go index ec297f2947d..f9337743f96 100755 --- a/cmd/workspace/tables/tables.go +++ b/cmd/workspace/tables/tables.go @@ -481,7 +481,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/temporary-table-credentials/temporary-table-credentials.go b/cmd/workspace/temporary-table-credentials/temporary-table-credentials.go index 8718f7ba1d2..57bf25496b0 100755 --- a/cmd/workspace/temporary-table-credentials/temporary-table-credentials.go +++ b/cmd/workspace/temporary-table-credentials/temporary-table-credentials.go @@ -3,6 +3,8 @@ package temporary_table_credentials import ( + "fmt" + "github.com/databricks/cli/cmd/root" "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/flags" @@ -96,7 +98,7 @@ func newGenerateTemporaryTableCredentials() *cobra.Command { if cmd.Flags().Changed("json") { err = generateTemporaryTableCredentialsJson.Unmarshal(&generateTemporaryTableCredentialsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } diff --git a/cmd/workspace/token-management/token-management.go b/cmd/workspace/token-management/token-management.go index dea94edb0c9..baacfd5cdfd 100755 --- a/cmd/workspace/token-management/token-management.go +++ b/cmd/workspace/token-management/token-management.go @@ -98,7 +98,7 @@ func newCreateOboToken() *cobra.Command { if cmd.Flags().Changed("json") { err = createOboTokenJson.Unmarshal(&createOboTokenReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -460,7 +460,7 @@ func newSetPermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = setPermissionsJson.Unmarshal(&setPermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -525,7 +525,7 @@ func newUpdatePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } diff --git a/cmd/workspace/tokens/tokens.go b/cmd/workspace/tokens/tokens.go index afe4b9a0367..4d3ebdb4b91 100755 --- a/cmd/workspace/tokens/tokens.go +++ b/cmd/workspace/tokens/tokens.go @@ -86,7 +86,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -160,7 +160,7 @@ func newDelete() *cobra.Command { if cmd.Flags().Changed("json") { err = deleteJson.Unmarshal(&deleteReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { diff --git a/cmd/workspace/users/users.go b/cmd/workspace/users/users.go index 53ba2e85c68..3744a8bface 100755 --- a/cmd/workspace/users/users.go +++ b/cmd/workspace/users/users.go @@ -109,7 +109,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -465,7 +465,7 @@ func newPatch() *cobra.Command { if cmd.Flags().Changed("json") { err = patchJson.Unmarshal(&patchReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -548,7 +548,7 @@ func newSetPermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = setPermissionsJson.Unmarshal(&setPermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -621,7 +621,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -704,7 +704,7 @@ func newUpdatePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } diff --git a/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go b/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go index dd9d5783502..a52e5dad310 100755 --- a/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go +++ b/cmd/workspace/vector-search-endpoints/vector-search-endpoints.go @@ -97,7 +97,7 @@ func newCreateEndpoint() *cobra.Command { if cmd.Flags().Changed("json") { err = createEndpointJson.Unmarshal(&createEndpointReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { diff --git a/cmd/workspace/vector-search-indexes/vector-search-indexes.go b/cmd/workspace/vector-search-indexes/vector-search-indexes.go index 158474770de..75227c65b23 100755 --- a/cmd/workspace/vector-search-indexes/vector-search-indexes.go +++ b/cmd/workspace/vector-search-indexes/vector-search-indexes.go @@ -116,7 +116,7 @@ func newCreateIndex() *cobra.Command { if cmd.Flags().Changed("json") { err = createIndexJson.Unmarshal(&createIndexReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -197,7 +197,7 @@ func newDeleteDataVectorIndex() *cobra.Command { if cmd.Flags().Changed("json") { err = deleteDataVectorIndexJson.Unmarshal(&deleteDataVectorIndexReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -445,7 +445,7 @@ func newQueryIndex() *cobra.Command { if cmd.Flags().Changed("json") { err = queryIndexJson.Unmarshal(&queryIndexReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") @@ -517,7 +517,7 @@ func newQueryNextPage() *cobra.Command { if cmd.Flags().Changed("json") { err = queryNextPageJson.Unmarshal(&queryNextPageReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } queryNextPageReq.IndexName = args[0] @@ -587,7 +587,7 @@ func newScanIndex() *cobra.Command { if cmd.Flags().Changed("json") { err = scanIndexJson.Unmarshal(&scanIndexReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } scanIndexReq.IndexName = args[0] @@ -720,7 +720,7 @@ func newUpsertDataVectorIndex() *cobra.Command { if cmd.Flags().Changed("json") { err = upsertDataVectorIndexJson.Unmarshal(&upsertDataVectorIndexReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } upsertDataVectorIndexReq.IndexName = args[0] diff --git a/cmd/workspace/volumes/volumes.go b/cmd/workspace/volumes/volumes.go index 3fc1f447b5b..f1718694505 100755 --- a/cmd/workspace/volumes/volumes.go +++ b/cmd/workspace/volumes/volumes.go @@ -121,7 +121,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -429,7 +429,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/warehouses/warehouses.go b/cmd/workspace/warehouses/warehouses.go index cdf1063655d..edb91c2d7b9 100755 --- a/cmd/workspace/warehouses/warehouses.go +++ b/cmd/workspace/warehouses/warehouses.go @@ -111,7 +111,7 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err = createJson.Unmarshal(&createReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -279,7 +279,7 @@ func newEdit() *cobra.Command { if cmd.Flags().Changed("json") { err = editJson.Unmarshal(&editReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -690,7 +690,7 @@ func newSetPermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = setPermissionsJson.Unmarshal(&setPermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { @@ -781,7 +781,7 @@ func newSetWorkspaceWarehouseConfig() *cobra.Command { if cmd.Flags().Changed("json") { err = setWorkspaceWarehouseConfigJson.Unmarshal(&setWorkspaceWarehouseConfigReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } @@ -1032,7 +1032,7 @@ func newUpdatePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if len(args) == 0 { diff --git a/cmd/workspace/workspace-bindings/workspace-bindings.go b/cmd/workspace/workspace-bindings/workspace-bindings.go index 4993f1afffa..2c8616042af 100755 --- a/cmd/workspace/workspace-bindings/workspace-bindings.go +++ b/cmd/workspace/workspace-bindings/workspace-bindings.go @@ -228,7 +228,7 @@ func newUpdate() *cobra.Command { if cmd.Flags().Changed("json") { err = updateJson.Unmarshal(&updateReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updateReq.Name = args[0] @@ -299,7 +299,7 @@ func newUpdateBindings() *cobra.Command { if cmd.Flags().Changed("json") { err = updateBindingsJson.Unmarshal(&updateBindingsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } _, err = fmt.Sscan(args[0], &updateBindingsReq.SecurableType) diff --git a/cmd/workspace/workspace-conf/workspace-conf.go b/cmd/workspace/workspace-conf/workspace-conf.go index 92b2f0f3aff..ab407f2a8d9 100755 --- a/cmd/workspace/workspace-conf/workspace-conf.go +++ b/cmd/workspace/workspace-conf/workspace-conf.go @@ -129,7 +129,7 @@ func newSetStatus() *cobra.Command { if cmd.Flags().Changed("json") { err = setStatusJson.Unmarshal(&setStatusReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") diff --git a/cmd/workspace/workspace/workspace.go b/cmd/workspace/workspace/workspace.go index 183cac8984e..220365d8ebf 100755 --- a/cmd/workspace/workspace/workspace.go +++ b/cmd/workspace/workspace/workspace.go @@ -108,7 +108,7 @@ func newDelete() *cobra.Command { if cmd.Flags().Changed("json") { err = deleteJson.Unmarshal(&deleteReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -484,7 +484,7 @@ func newImport() *cobra.Command { if cmd.Flags().Changed("json") { err = importJson.Unmarshal(&importReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } if !cmd.Flags().Changed("json") { @@ -624,7 +624,7 @@ func newMkdirs() *cobra.Command { if cmd.Flags().Changed("json") { err = mkdirsJson.Unmarshal(&mkdirsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } else { if len(args) == 0 { @@ -712,7 +712,7 @@ func newSetPermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = setPermissionsJson.Unmarshal(&setPermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } setPermissionsReq.WorkspaceObjectType = args[0] @@ -783,7 +783,7 @@ func newUpdatePermissions() *cobra.Command { if cmd.Flags().Changed("json") { err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) if err != nil { - return err + return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err) } } updatePermissionsReq.WorkspaceObjectType = args[0]