diff --git a/.codegen/service.go.tmpl b/.codegen/service.go.tmpl index 281dfd6e..549fcc93 100644 --- a/.codegen/service.go.tmpl +++ b/.codegen/service.go.tmpl @@ -9,6 +9,7 @@ import ( "github.com/databricks/databricks-sdk-go/service/{{.Package.Name}}" "github.com/spf13/cobra" + {{range .Subservices -}} {{.SnakeName}} "github.com/databricks/cli/cmd/{{ if .ParentService.IsAccounts }}account{{ else }}workspace{{ end }}/{{.KebabName}}" {{end}} @@ -233,7 +234,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 f6761a1b..3f495c40 100755 --- a/cmd/account/access-control/access-control.go +++ b/cmd/account/access-control/access-control.go @@ -61,7 +61,7 @@ func newGetAssignableRolesForResource() *cobra.Command { cmd.Use = "get-assignable-roles-for-resource RESOURCE" cmd.Short = `Get assignable roles for a resource.` cmd.Long = `Get assignable roles for a resource. - + Gets all the roles that can be granted on an account level resource. A role is grantable if the rule set on the resource can contain an access rule of the role. @@ -121,7 +121,7 @@ func newGetRuleSet() *cobra.Command { cmd.Use = "get-rule-set NAME ETAG" cmd.Short = `Get a rule set.` cmd.Long = `Get a rule set. - + Get a rule set by its name. A rule set is always attached to a resource and contains a list of access rules on the said resource. Currently only a default rule set for each resource is supported. @@ -192,7 +192,7 @@ func newUpdateRuleSet() *cobra.Command { cmd.Use = "update-rule-set" cmd.Short = `Update a rule set.` cmd.Long = `Update a rule set. - + Replace the rules of a rule set. First, use get to read the current version of the rule set before modifying it. This pattern helps prevent conflicts between concurrent updates.` @@ -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 6b47bb32..f435fc7d 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 ed071cda..296cc513 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 d6fce953..882e5853 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 5cdf422d..83740258 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 6d25b943..5a5e7a5f 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 44545ccf..4a496f12 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 71149e5a..337aa981 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 a7e1ac43..02ef8205 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 5c6d27dd..f46eccca 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 4584f4d2..965cc63a 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 d7f32ccb..21ce01e8 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 7c8e3f2c..d9629f2f 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 cd8da290..12a0f5d1 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 05ef0c81..27fa502a 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 2a14b0b3..7dccaa5e 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 d527fa64..34501b9c 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 5143d53c..9e10ec6c 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 c86810f1..d800c7db 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 4280ae8c..3fe87e1b 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 50460ed0..135d68f9 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 8a1c3247..ddf27df3 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 289d2972..4766f3e6 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 e6c6c126..33eaab58 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 58468d09..8cc00c4a 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 1ec6230b..8353e5cf 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 1046b112..9c46a0d0 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 cfaa3f55..54438614 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 780f5594..5728aff0 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 fc25e3cb..49e090f5 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 2385195b..a71cb312 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 a17bb007..22e55bd2 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 9466c4b9..387a5c24 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 830d44ca..98261d48 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 b36102d9..78a74ce2 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 a7b45901..ed9e6a80 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 f76420fb..680f9b0c 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 92f61789..09c3fee5 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 8b0af3cc..33ec136a 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 5a40232b..f23d1c27 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 02b13739..967bb682 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 fcab0aa2..872f2e08 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 b15907be..426f4d1c 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 fea2b3c4..2d8f26e1 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 a8acc5cd..794ba1bb 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 b1af2f86..a91e980e 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 42493fc4..83487d8a 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 c8de4879..7a363d07 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 e4a05909..7b2d38b1 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 b5082d31..6dda8da0 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 92dcb259..415e5ea0 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 876f0343..3514b6db 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 14650d98..5ec7c439 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 db96f146..32d27134 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 7134c16c..8e0e0559 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 ec5958b5..9d7ab927 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 2d422fa8..dd110dc8 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 ef2d6845..079b1a9c 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 2c10d816..d8712849 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 22bcd3dc..a72c0078 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 41f06ac4..7c062c62 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 d2f05404..b738f4d4 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 5ad47cc9..10a80717 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 da2f8c04..9b43ed05 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 2e50b123..b9bd8ee4 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 c6033e4a..98af0d57 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 ac361e31..a9e7722a 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 1274c879..f9e7ba55 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 d74caa57..adc6b889 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 a3f74621..954801fb 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 b9240375..1778b660 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 62dcb6de..b366c90c 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 18c99c53..8d44e17a 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 d18e2e57..54e7e193 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 bb3ca966..e47919f8 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 94d12d6f..0012bf6f 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 af2737a0..924fce57 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 1ff9b017..de62e095 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 fa78bb2b..7eae5a79 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 fea01451..b688424c 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 4f45ab23..ddf6de4e 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 04259452..f085fcb9 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 f4472cf3..bc2261ca 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 5aa6cdf1..f283d30d 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 f11dd3ac..6719cf12 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 5e9f59d2..fd9c7694 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 3a398251..0e372b9b 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 f836a267..364dd51d 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 957cb126..d9ad0aa7 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 0837652d..cb219b26 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 67f87017..52986bfe 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 f4ec5eb4..54b87826 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 166da146..d6171c48 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 ec297f29..f9337743 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 8718f7ba..57bf2549 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 dea94edb..baacfd5c 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 afe4b9a0..4d3ebdb4 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 53ba2e85..3744a8bf 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 dd9d5783..a52e5dad 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 15847477..75227c65 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 3fc1f447..f1718694 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 cdf10636..edb91c2d 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 4993f1af..2c861604 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 92b2f0f3..ab407f2a 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 183cac89..220365d8 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]