Return more presriptive error when user enters an invalid value for --json flag

This commit is contained in:
Shreyas Goenka 2024-10-10 15:34:15 +02:00
parent 3270afaff4
commit 62d60a251d
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
106 changed files with 318 additions and 297 deletions

View File

@ -9,6 +9,7 @@ import (
"github.com/databricks/databricks-sdk-go/service/{{.Package.Name}}" "github.com/databricks/databricks-sdk-go/service/{{.Package.Name}}"
"github.com/spf13/cobra" "github.com/spf13/cobra"
{{range .Subservices -}} {{range .Subservices -}}
{{.SnakeName}} "github.com/databricks/cli/cmd/{{ if .ParentService.IsAccounts }}account{{ else }}workspace{{ end }}/{{.KebabName}}" {{.SnakeName}} "github.com/databricks/cli/cmd/{{ if .ParentService.IsAccounts }}account{{ else }}workspace{{ end }}/{{.KebabName}}"
{{end}} {{end}}
@ -233,7 +234,7 @@ func new{{.PascalName}}() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = {{.CamelName}}Json.Unmarshal(&{{.CamelName}}Req) err = {{.CamelName}}Json.Unmarshal(&{{.CamelName}}Req)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { }{{end}}{{ if .MustUseJson }}else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -207,7 +207,7 @@ func newUpdateRuleSet() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateRuleSetJson.Unmarshal(&updateRuleSetReq) err = updateRuleSetJson.Unmarshal(&updateRuleSetReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -80,7 +80,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -92,7 +92,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -131,7 +131,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -3,6 +3,8 @@
package custom_app_integration package custom_app_integration
import ( import (
"fmt"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
@ -90,7 +92,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.IntegrationId = args[0]

View File

@ -187,7 +187,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -109,7 +109,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -129,7 +129,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -99,7 +99,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = patchJson.Unmarshal(&patchReq) err = patchJson.Unmarshal(&patchReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -448,7 +448,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -134,7 +134,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -413,7 +413,7 @@ func newReplace() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = replaceJson.Unmarshal(&replaceReq) err = replaceJson.Unmarshal(&replaceReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] replaceReq.IpAccessListId = args[0]
@ -507,7 +507,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -164,7 +164,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = patchStatusJson.Unmarshal(&patchStatusReq) err = patchStatusJson.Unmarshal(&patchStatusReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] patchStatusReq.LogDeliveryConfigurationId = args[0]

View File

@ -87,7 +87,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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) _, err = fmt.Sscan(args[0], &createReq.WorkspaceId)
@ -345,7 +345,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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) _, err = fmt.Sscan(args[0], &updateReq.WorkspaceId)

View File

@ -3,6 +3,8 @@
package metastores package metastores
import ( import (
"fmt"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
@ -82,7 +84,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.MetastoreId = args[0]

View File

@ -98,7 +98,7 @@ func newCreateNetworkConnectivityConfiguration() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createNetworkConnectivityConfigurationJson.Unmarshal(&createNetworkConnectivityConfigurationReq) err = createNetworkConnectivityConfigurationJson.Unmarshal(&createNetworkConnectivityConfigurationReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -189,7 +189,7 @@ func newCreatePrivateEndpointRule() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createPrivateEndpointRuleJson.Unmarshal(&createPrivateEndpointRuleReq) err = createPrivateEndpointRuleJson.Unmarshal(&createPrivateEndpointRuleReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] createPrivateEndpointRuleReq.NetworkConnectivityConfigId = args[0]

View File

@ -99,7 +99,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {

View File

@ -191,7 +191,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -111,7 +111,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -413,7 +413,7 @@ func newReplace() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = replaceJson.Unmarshal(&replaceReq) err = replaceJson.Unmarshal(&replaceReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] replaceReq.PrivateAccessSettingsId = args[0]

View File

@ -3,6 +3,8 @@
package published_app_integration package published_app_integration
import ( import (
"fmt"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
@ -87,7 +89,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.IntegrationId = args[0]

View File

@ -97,7 +97,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = patchJson.Unmarshal(&patchReq) err = patchJson.Unmarshal(&patchReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -450,7 +450,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -3,6 +3,8 @@
package storage_credentials package storage_credentials
import ( import (
"fmt"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
@ -90,7 +92,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] createReq.MetastoreId = args[0]
@ -342,7 +344,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.MetastoreId = args[0]

View File

@ -89,7 +89,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -3,6 +3,8 @@
package usage_dashboards package usage_dashboards
import ( import (
"fmt"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
@ -82,7 +84,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err)
} }
} }

View File

@ -105,7 +105,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = patchJson.Unmarshal(&patchReq) err = patchJson.Unmarshal(&patchReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -467,7 +467,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -106,7 +106,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {

View File

@ -275,7 +275,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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) _, err = fmt.Sscan(args[0], &updateReq.WorkspaceId)

View File

@ -135,7 +135,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -553,7 +553,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -95,7 +95,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -87,7 +87,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.Id = args[0]

View File

@ -115,7 +115,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -269,7 +269,7 @@ func newDeploy() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = deployJson.Unmarshal(&deployReq) err = deployJson.Unmarshal(&deployReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] deployReq.AppName = args[0]
@ -704,7 +704,7 @@ func newSetPermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setPermissionsJson.Unmarshal(&setPermissionsReq) err = setPermissionsJson.Unmarshal(&setPermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] setPermissionsReq.AppName = args[0]
@ -938,7 +938,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.Name = args[0]
@ -1007,7 +1007,7 @@ func newUpdatePermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updatePermissionsReq.AppName = args[0]

View File

@ -147,7 +147,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -129,7 +129,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -107,7 +107,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -365,7 +365,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.Name = args[0]

View File

@ -87,7 +87,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.Name = args[0]

View File

@ -115,7 +115,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = deleteJson.Unmarshal(&deleteReq) err = deleteJson.Unmarshal(&deleteReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -286,7 +286,7 @@ func newEdit() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = editJson.Unmarshal(&editReq) err = editJson.Unmarshal(&editReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -632,7 +632,7 @@ func newSetPermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setPermissionsJson.Unmarshal(&setPermissionsReq) err = setPermissionsJson.Unmarshal(&setPermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -713,7 +713,7 @@ func newUpdatePermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -136,7 +136,7 @@ func newChangeOwner() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = changeOwnerJson.Unmarshal(&changeOwnerReq) err = changeOwnerJson.Unmarshal(&changeOwnerReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -270,7 +270,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -364,7 +364,7 @@ func newDelete() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = deleteJson.Unmarshal(&deleteReq) err = deleteJson.Unmarshal(&deleteReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -521,7 +521,7 @@ func newEdit() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = editJson.Unmarshal(&editReq) err = editJson.Unmarshal(&editReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -619,7 +619,7 @@ func newEvents() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = eventsJson.Unmarshal(&eventsReq) err = eventsJson.Unmarshal(&eventsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -1071,7 +1071,7 @@ func newPermanentDelete() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = permanentDeleteJson.Unmarshal(&permanentDeleteReq) err = permanentDeleteJson.Unmarshal(&permanentDeleteReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -1163,7 +1163,7 @@ func newPin() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = pinJson.Unmarshal(&pinReq) err = pinJson.Unmarshal(&pinReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -1262,7 +1262,7 @@ func newResize() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = resizeJson.Unmarshal(&resizeReq) err = resizeJson.Unmarshal(&resizeReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -1372,7 +1372,7 @@ func newRestart() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = restartJson.Unmarshal(&restartReq) err = restartJson.Unmarshal(&restartReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -1466,7 +1466,7 @@ func newSetPermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setPermissionsJson.Unmarshal(&setPermissionsReq) err = setPermissionsJson.Unmarshal(&setPermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -1610,7 +1610,7 @@ func newStart() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = startJson.Unmarshal(&startReq) err = startJson.Unmarshal(&startReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -1714,7 +1714,7 @@ func newUnpin() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = unpinJson.Unmarshal(&unpinReq) err = unpinJson.Unmarshal(&unpinReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -1826,7 +1826,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -1907,7 +1907,7 @@ func newUpdatePermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -132,7 +132,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -94,7 +94,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -88,7 +88,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] createReq.ListingId = args[0]
@ -321,7 +321,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -87,7 +87,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -77,7 +77,7 @@ func newExchangeToken() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = exchangeTokenJson.Unmarshal(&exchangeTokenReq) err = exchangeTokenJson.Unmarshal(&exchangeTokenReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -77,7 +77,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -80,7 +80,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -201,7 +201,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -189,7 +189,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -134,7 +134,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -132,7 +132,7 @@ func newCreateExperiment() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createExperimentJson.Unmarshal(&createExperimentReq) err = createExperimentJson.Unmarshal(&createExperimentReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -205,7 +205,7 @@ func newCreateRun() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createRunJson.Unmarshal(&createRunReq) err = createRunJson.Unmarshal(&createRunReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = deleteExperimentJson.Unmarshal(&deleteExperimentReq) err = deleteExperimentJson.Unmarshal(&deleteExperimentReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -354,7 +354,7 @@ func newDeleteRun() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = deleteRunJson.Unmarshal(&deleteRunReq) err = deleteRunJson.Unmarshal(&deleteRunReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -437,7 +437,7 @@ func newDeleteRuns() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = deleteRunsJson.Unmarshal(&deleteRunsReq) err = deleteRunsJson.Unmarshal(&deleteRunsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -520,7 +520,7 @@ func newDeleteTag() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = deleteTagJson.Unmarshal(&deleteTagReq) err = deleteTagJson.Unmarshal(&deleteTagReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -1110,7 +1110,7 @@ func newLogBatch() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = logBatchJson.Unmarshal(&logBatchReq) err = logBatchJson.Unmarshal(&logBatchReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = logInputsJson.Unmarshal(&logInputsReq) err = logInputsJson.Unmarshal(&logInputsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = logMetricJson.Unmarshal(&logMetricReq) err = logMetricJson.Unmarshal(&logMetricReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -1337,7 +1337,7 @@ func newLogModel() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = logModelJson.Unmarshal(&logModelReq) err = logModelJson.Unmarshal(&logModelReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = logParamJson.Unmarshal(&logParamReq) err = logParamJson.Unmarshal(&logParamReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -1499,7 +1499,7 @@ func newRestoreExperiment() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = restoreExperimentJson.Unmarshal(&restoreExperimentReq) err = restoreExperimentJson.Unmarshal(&restoreExperimentReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -1574,7 +1574,7 @@ func newRestoreRun() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = restoreRunJson.Unmarshal(&restoreRunReq) err = restoreRunJson.Unmarshal(&restoreRunReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -1657,7 +1657,7 @@ func newRestoreRuns() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = restoreRunsJson.Unmarshal(&restoreRunsReq) err = restoreRunsJson.Unmarshal(&restoreRunsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -1734,7 +1734,7 @@ func newSearchExperiments() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = searchExperimentsJson.Unmarshal(&searchExperimentsReq) err = searchExperimentsJson.Unmarshal(&searchExperimentsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = searchRunsJson.Unmarshal(&searchRunsReq) err = searchRunsJson.Unmarshal(&searchRunsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = setExperimentTagJson.Unmarshal(&setExperimentTagReq) err = setExperimentTagJson.Unmarshal(&setExperimentTagReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -1953,7 +1953,7 @@ func newSetPermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setPermissionsJson.Unmarshal(&setPermissionsReq) err = setPermissionsJson.Unmarshal(&setPermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] setPermissionsReq.ExperimentId = args[0]
@ -2034,7 +2034,7 @@ func newSetTag() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setTagJson.Unmarshal(&setTagReq) err = setTagJson.Unmarshal(&setTagReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -2114,7 +2114,7 @@ func newUpdateExperiment() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateExperimentJson.Unmarshal(&updateExperimentReq) err = updateExperimentJson.Unmarshal(&updateExperimentReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -2185,7 +2185,7 @@ func newUpdatePermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updatePermissionsReq.ExperimentId = args[0]
@ -2253,7 +2253,7 @@ func newUpdateRun() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateRunJson.Unmarshal(&updateRunReq) err = updateRunJson.Unmarshal(&updateRunReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err)
} }
} }

View File

@ -114,7 +114,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -383,7 +383,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.Name = args[0]

View File

@ -87,7 +87,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -107,7 +107,7 @@ func newCreateMessage() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createMessageJson.Unmarshal(&createMessageReq) err = createMessageJson.Unmarshal(&createMessageReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] createMessageReq.SpaceId = args[0]
@ -394,7 +394,7 @@ func newStartConversation() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = startConversationJson.Unmarshal(&startConversationReq) err = startConversationJson.Unmarshal(&startConversationReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] startConversationReq.SpaceId = args[0]

View File

@ -105,7 +105,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -373,7 +373,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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) _, err = fmt.Sscan(args[0], &updateReq.CredentialId)

View File

@ -103,7 +103,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -369,7 +369,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.ScriptId = args[0]

View File

@ -225,7 +225,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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) _, err = fmt.Sscan(args[0], &updateReq.SecurableType)

View File

@ -99,7 +99,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = patchJson.Unmarshal(&patchReq) err = patchJson.Unmarshal(&patchReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -448,7 +448,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -130,7 +130,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -208,7 +208,7 @@ func newDelete() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = deleteJson.Unmarshal(&deleteReq) err = deleteJson.Unmarshal(&deleteReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -311,7 +311,7 @@ func newEdit() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = editJson.Unmarshal(&editReq) err = editJson.Unmarshal(&editReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -633,7 +633,7 @@ func newSetPermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setPermissionsJson.Unmarshal(&setPermissionsReq) err = setPermissionsJson.Unmarshal(&setPermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -714,7 +714,7 @@ func newUpdatePermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -101,7 +101,7 @@ func newAdd() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = addJson.Unmarshal(&addReq) err = addJson.Unmarshal(&addReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -194,7 +194,7 @@ func newEdit() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = editJson.Unmarshal(&editReq) err = editJson.Unmarshal(&editReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -313,7 +313,7 @@ func newRemove() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = removeJson.Unmarshal(&removeReq) err = removeJson.Unmarshal(&removeReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {

View File

@ -135,7 +135,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -416,7 +416,7 @@ func newReplace() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = replaceJson.Unmarshal(&replaceReq) err = replaceJson.Unmarshal(&replaceReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] replaceReq.IpAccessListId = args[0]
@ -512,7 +512,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -118,7 +118,7 @@ func newCancelAllRuns() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = cancelAllRunsJson.Unmarshal(&cancelAllRunsReq) err = cancelAllRunsJson.Unmarshal(&cancelAllRunsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = cancelRunJson.Unmarshal(&cancelRunReq) err = cancelRunJson.Unmarshal(&cancelRunReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -293,7 +293,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = deleteJson.Unmarshal(&deleteReq) err = deleteJson.Unmarshal(&deleteReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -459,7 +459,7 @@ func newDeleteRun() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = deleteRunJson.Unmarshal(&deleteRunReq) err = deleteRunJson.Unmarshal(&deleteRunReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -1145,7 +1145,7 @@ func newRepairRun() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = repairRunJson.Unmarshal(&repairRunReq) err = repairRunJson.Unmarshal(&repairRunReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -1244,7 +1244,7 @@ func newReset() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = resetJson.Unmarshal(&resetReq) err = resetJson.Unmarshal(&resetReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = runNowJson.Unmarshal(&runNowReq) err = runNowJson.Unmarshal(&runNowReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -1438,7 +1438,7 @@ func newSetPermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setPermissionsJson.Unmarshal(&setPermissionsReq) err = setPermissionsJson.Unmarshal(&setPermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -1540,7 +1540,7 @@ func newSubmit() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = submitJson.Unmarshal(&submitReq) err = submitJson.Unmarshal(&submitReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -1719,7 +1719,7 @@ func newUpdatePermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -110,7 +110,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -182,7 +182,7 @@ func newCreateSchedule() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createScheduleJson.Unmarshal(&createScheduleReq) err = createScheduleJson.Unmarshal(&createScheduleReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = createSubscriptionJson.Unmarshal(&createSubscriptionReq) err = createSubscriptionJson.Unmarshal(&createSubscriptionReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = migrateJson.Unmarshal(&migrateReq) err = migrateJson.Unmarshal(&migrateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -943,7 +943,7 @@ func newPublish() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = publishJson.Unmarshal(&publishReq) err = publishJson.Unmarshal(&publishReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] publishReq.DashboardId = args[0]
@ -1130,7 +1130,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.DashboardId = args[0]
@ -1202,7 +1202,7 @@ func newUpdateSchedule() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateScheduleJson.Unmarshal(&updateScheduleReq) err = updateScheduleJson.Unmarshal(&updateScheduleReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -192,7 +192,7 @@ func newInstall() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = installJson.Unmarshal(&installReq) err = installJson.Unmarshal(&installReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = uninstallJson.Unmarshal(&uninstallReq) err = uninstallJson.Unmarshal(&uninstallReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -114,7 +114,7 @@ func newAssign() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = assignJson.Unmarshal(&assignReq) err = assignJson.Unmarshal(&assignReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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) _, err = fmt.Sscan(args[0], &assignReq.WorkspaceId)
@ -203,7 +203,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -608,7 +608,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -692,7 +692,7 @@ func newUpdateAssignment() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateAssignmentJson.Unmarshal(&updateAssignmentReq) err = updateAssignmentJson.Unmarshal(&updateAssignmentReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -143,7 +143,7 @@ func newApproveTransitionRequest() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = approveTransitionRequestJson.Unmarshal(&approveTransitionRequestReq) err = approveTransitionRequestJson.Unmarshal(&approveTransitionRequestReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -237,7 +237,7 @@ func newCreateComment() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createCommentJson.Unmarshal(&createCommentReq) err = createCommentJson.Unmarshal(&createCommentReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -324,7 +324,7 @@ func newCreateModel() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createModelJson.Unmarshal(&createModelReq) err = createModelJson.Unmarshal(&createModelReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -405,7 +405,7 @@ func newCreateModelVersion() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createModelVersionJson.Unmarshal(&createModelVersionReq) err = createModelVersionJson.Unmarshal(&createModelVersionReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -495,7 +495,7 @@ func newCreateTransitionRequest() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createTransitionRequestJson.Unmarshal(&createTransitionRequestReq) err = createTransitionRequestJson.Unmarshal(&createTransitionRequestReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -572,7 +572,7 @@ func newCreateWebhook() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createWebhookJson.Unmarshal(&createWebhookReq) err = createWebhookJson.Unmarshal(&createWebhookReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = getLatestVersionsJson.Unmarshal(&getLatestVersionsReq) err = getLatestVersionsJson.Unmarshal(&getLatestVersionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -1631,7 +1631,7 @@ func newRejectTransitionRequest() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = rejectTransitionRequestJson.Unmarshal(&rejectTransitionRequestReq) err = rejectTransitionRequestJson.Unmarshal(&rejectTransitionRequestReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -1717,7 +1717,7 @@ func newRenameModel() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = renameModelJson.Unmarshal(&renameModelReq) err = renameModelJson.Unmarshal(&renameModelReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -1909,7 +1909,7 @@ func newSetModelTag() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setModelTagJson.Unmarshal(&setModelTagReq) err = setModelTagJson.Unmarshal(&setModelTagReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -1998,7 +1998,7 @@ func newSetModelVersionTag() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setModelVersionTagJson.Unmarshal(&setModelVersionTagReq) err = setModelVersionTagJson.Unmarshal(&setModelVersionTagReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -2078,7 +2078,7 @@ func newSetPermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setPermissionsJson.Unmarshal(&setPermissionsReq) err = setPermissionsJson.Unmarshal(&setPermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] setPermissionsReq.RegisteredModelId = args[0]
@ -2168,7 +2168,7 @@ func newTestRegistryWebhook() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = testRegistryWebhookJson.Unmarshal(&testRegistryWebhookReq) err = testRegistryWebhookJson.Unmarshal(&testRegistryWebhookReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -2261,7 +2261,7 @@ func newTransitionStage() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = transitionStageJson.Unmarshal(&transitionStageReq) err = transitionStageJson.Unmarshal(&transitionStageReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -2352,7 +2352,7 @@ func newUpdateComment() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateCommentJson.Unmarshal(&updateCommentReq) err = updateCommentJson.Unmarshal(&updateCommentReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -2432,7 +2432,7 @@ func newUpdateModel() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateModelJson.Unmarshal(&updateModelReq) err = updateModelJson.Unmarshal(&updateModelReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -2510,7 +2510,7 @@ func newUpdateModelVersion() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateModelVersionJson.Unmarshal(&updateModelVersionReq) err = updateModelVersionJson.Unmarshal(&updateModelVersionReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -2584,7 +2584,7 @@ func newUpdatePermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updatePermissionsReq.RegisteredModelId = args[0]
@ -2665,7 +2665,7 @@ func newUpdateWebhook() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateWebhookJson.Unmarshal(&updateWebhookReq) err = updateWebhookJson.Unmarshal(&updateWebhookReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {

View File

@ -379,7 +379,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.FullName = args[0]

View File

@ -3,6 +3,8 @@
package notification_destinations package notification_destinations
import ( import (
"fmt"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
@ -86,7 +88,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.Id = args[0]

View File

@ -3,6 +3,8 @@
package online_tables package online_tables
import ( import (
"fmt"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
@ -81,7 +83,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err)
} }
} }

View File

@ -94,7 +94,7 @@ func newMigratePermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = migratePermissionsJson.Unmarshal(&migratePermissionsReq) err = migratePermissionsJson.Unmarshal(&migratePermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {

View File

@ -3,6 +3,8 @@
package permissions package permissions
import ( import (
"fmt"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
@ -267,7 +269,7 @@ func newSet() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setJson.Unmarshal(&setReq) err = setJson.Unmarshal(&setReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] setReq.RequestObjectType = args[0]
@ -342,7 +344,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.RequestObjectType = args[0]

View File

@ -100,7 +100,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = setPermissionsJson.Unmarshal(&setPermissionsReq) err = setPermissionsJson.Unmarshal(&setPermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -790,7 +790,7 @@ func newStartUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = startUpdateJson.Unmarshal(&startUpdateReq) err = startUpdateJson.Unmarshal(&startUpdateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -979,7 +979,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -1060,7 +1060,7 @@ func newUpdatePermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -112,7 +112,7 @@ func newEnforceCompliance() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = enforceComplianceJson.Unmarshal(&enforceComplianceReq) err = enforceComplianceJson.Unmarshal(&enforceComplianceReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {

View File

@ -106,7 +106,7 @@ func newEnforceCompliance() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = enforceComplianceJson.Unmarshal(&enforceComplianceReq) err = enforceComplianceJson.Unmarshal(&enforceComplianceReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {

View File

@ -75,7 +75,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -93,7 +93,7 @@ func newAddListingToExchange() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = addListingToExchangeJson.Unmarshal(&addListingToExchangeReq) err = addListingToExchangeJson.Unmarshal(&addListingToExchangeReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -156,7 +156,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -79,7 +79,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = listJson.Unmarshal(&listReq) err = listJson.Unmarshal(&listReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -77,7 +77,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -144,7 +144,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.ListingId = args[0]

View File

@ -3,6 +3,8 @@
package provider_provider_analytics_dashboards package provider_provider_analytics_dashboards
import ( import (
"fmt"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
@ -210,7 +212,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.Id = args[0]

View File

@ -76,7 +76,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -99,7 +99,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -448,7 +448,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -198,7 +198,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] createReq.TableName = args[0]
@ -561,7 +561,7 @@ func newRegenerateDashboard() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = regenerateDashboardJson.Unmarshal(&regenerateDashboardReq) err = regenerateDashboardJson.Unmarshal(&regenerateDashboardReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] regenerateDashboardReq.TableName = args[0]
@ -726,7 +726,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.TableName = args[0]

View File

@ -98,7 +98,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -87,7 +87,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.Id = args[0]

View File

@ -89,7 +89,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -86,7 +86,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.Id = args[0]

View File

@ -120,7 +120,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -406,7 +406,7 @@ func newRotateToken() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = rotateTokenJson.Unmarshal(&rotateTokenReq) err = rotateTokenJson.Unmarshal(&rotateTokenReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] rotateTokenReq.Name = args[0]
@ -556,7 +556,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -137,7 +137,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -511,7 +511,7 @@ func newSetAlias() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setAliasJson.Unmarshal(&setAliasReq) err = setAliasJson.Unmarshal(&setAliasReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] setAliasReq.FullName = args[0]
@ -591,7 +591,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -113,7 +113,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -523,7 +523,7 @@ func newSetPermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setPermissionsJson.Unmarshal(&setPermissionsReq) err = setPermissionsJson.Unmarshal(&setPermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -606,7 +606,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -690,7 +690,7 @@ func newUpdatePermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -199,7 +199,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -102,7 +102,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -388,7 +388,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -112,7 +112,7 @@ func newCreateScope() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createScopeJson.Unmarshal(&createScopeReq) err = createScopeJson.Unmarshal(&createScopeReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -193,7 +193,7 @@ func newDeleteAcl() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = deleteAclJson.Unmarshal(&deleteAclReq) err = deleteAclJson.Unmarshal(&deleteAclReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -275,7 +275,7 @@ func newDeleteScope() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = deleteScopeJson.Unmarshal(&deleteScopeReq) err = deleteScopeJson.Unmarshal(&deleteScopeReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -356,7 +356,7 @@ func newDeleteSecret() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = deleteSecretJson.Unmarshal(&deleteSecretReq) err = deleteSecretJson.Unmarshal(&deleteSecretReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -761,7 +761,7 @@ func newPutAcl() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = putAclJson.Unmarshal(&putAclReq) err = putAclJson.Unmarshal(&putAclReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {

View File

@ -97,7 +97,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = patchJson.Unmarshal(&patchReq) err = patchJson.Unmarshal(&patchReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -450,7 +450,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -171,7 +171,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") 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") { if cmd.Flags().Changed("json") {
err = patchJson.Unmarshal(&patchReq) err = patchJson.Unmarshal(&patchReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] patchReq.Name = args[0]
@ -779,7 +779,7 @@ func newPut() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = putJson.Unmarshal(&putReq) err = putJson.Unmarshal(&putReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] putReq.Name = args[0]
@ -852,7 +852,7 @@ func newPutAiGateway() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = putAiGatewayJson.Unmarshal(&putAiGatewayReq) err = putAiGatewayJson.Unmarshal(&putAiGatewayReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] putAiGatewayReq.Name = args[0]
@ -930,7 +930,7 @@ func newQuery() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = queryJson.Unmarshal(&queryReq) err = queryJson.Unmarshal(&queryReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] queryReq.Name = args[0]
@ -999,7 +999,7 @@ func newSetPermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setPermissionsJson.Unmarshal(&setPermissionsReq) err = setPermissionsJson.Unmarshal(&setPermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] setPermissionsReq.ServingEndpointId = args[0]
@ -1078,7 +1078,7 @@ func newUpdateConfig() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateConfigJson.Unmarshal(&updateConfigReq) err = updateConfigJson.Unmarshal(&updateConfigReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateConfigReq.Name = args[0]
@ -1160,7 +1160,7 @@ func newUpdatePermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updatePermissionsReq.ServingEndpointId = args[0]

View File

@ -102,7 +102,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -429,7 +429,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updateReq.Name = args[0]
@ -503,7 +503,7 @@ func newUpdatePermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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] updatePermissionsReq.Name = args[0]

View File

@ -113,7 +113,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {
@ -379,7 +379,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -480,7 +480,7 @@ func newValidate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = validateJson.Unmarshal(&validateReq) err = validateJson.Unmarshal(&validateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err)
} }
} }

View File

@ -94,7 +94,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag") return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")

View File

@ -481,7 +481,7 @@ func newUpdate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {

View File

@ -3,6 +3,8 @@
package temporary_table_credentials package temporary_table_credentials
import ( import (
"fmt"
"github.com/databricks/cli/cmd/root" "github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/flags" "github.com/databricks/cli/libs/flags"
@ -96,7 +98,7 @@ func newGenerateTemporaryTableCredentials() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = generateTemporaryTableCredentialsJson.Unmarshal(&generateTemporaryTableCredentialsReq) err = generateTemporaryTableCredentialsJson.Unmarshal(&generateTemporaryTableCredentialsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err)
} }
} }

View File

@ -98,7 +98,7 @@ func newCreateOboToken() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createOboTokenJson.Unmarshal(&createOboTokenReq) err = createOboTokenJson.Unmarshal(&createOboTokenReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {
@ -460,7 +460,7 @@ func newSetPermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setPermissionsJson.Unmarshal(&setPermissionsReq) err = setPermissionsJson.Unmarshal(&setPermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err)
} }
} }

View File

@ -86,7 +86,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = deleteJson.Unmarshal(&deleteReq) err = deleteJson.Unmarshal(&deleteReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { } else {
if len(args) == 0 { if len(args) == 0 {

View File

@ -109,7 +109,7 @@ func newCreate() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq) err = createJson.Unmarshal(&createReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = patchJson.Unmarshal(&patchReq) err = patchJson.Unmarshal(&patchReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -548,7 +548,7 @@ func newSetPermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = setPermissionsJson.Unmarshal(&setPermissionsReq) err = setPermissionsJson.Unmarshal(&setPermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq) err = updateJson.Unmarshal(&updateReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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 { if len(args) == 0 {
@ -704,7 +704,7 @@ func newUpdatePermissions() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq) err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that the value provided to the --json flag is either a valid JSON string or @path/to/file.json with valid JSON content: %w", err)
} }
} }

View File

@ -97,7 +97,7 @@ func newCreateEndpoint() *cobra.Command {
if cmd.Flags().Changed("json") { if cmd.Flags().Changed("json") {
err = createEndpointJson.Unmarshal(&createEndpointReq) err = createEndpointJson.Unmarshal(&createEndpointReq)
if err != nil { if err != nil {
return err return fmt.Errorf("failed to parse JSON string. Please ensure that 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") { if !cmd.Flags().Changed("json") {

Some files were not shown because too many files have changed in this diff Show More