mirror of https://github.com/databricks/cli.git
Compare commits
No commits in common. "5f839e3b9b46b422bce6c6e52e098506ef6e9ff5" and "b0aeee513406104b14fa174db313b5b19d2c2c52" have entirely different histories.
5f839e3b9b
...
b0aeee5134
|
@ -5,7 +5,6 @@ package {{(.TrimPrefix "account").SnakeName}}
|
||||||
import (
|
import (
|
||||||
"github.com/databricks/cli/libs/cmdio"
|
"github.com/databricks/cli/libs/cmdio"
|
||||||
"github.com/databricks/cli/libs/flags"
|
"github.com/databricks/cli/libs/flags"
|
||||||
"github.com/databricks/cli/libs/diag"
|
|
||||||
"github.com/databricks/cli/cmd/root"
|
"github.com/databricks/cli/cmd/root"
|
||||||
"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"
|
||||||
|
@ -232,13 +231,10 @@ func new{{.PascalName}}() *cobra.Command {
|
||||||
{{- if .Request }}
|
{{- if .Request }}
|
||||||
{{ if .CanUseJson }}
|
{{ if .CanUseJson }}
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := {{.CamelName}}Json.Unmarshal(&{{.CamelName}}Req)
|
err = {{.CamelName}}Json.Unmarshal(&{{.CamelName}}Req)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}{{- end}}
|
}{{- end}}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/databricks/cli/bundle"
|
"github.com/databricks/cli/bundle"
|
||||||
"github.com/databricks/cli/libs/cmdio"
|
|
||||||
"github.com/databricks/cli/libs/diag"
|
"github.com/databricks/cli/libs/diag"
|
||||||
"github.com/databricks/databricks-sdk-go/service/iam"
|
"github.com/databricks/databricks-sdk-go/service/iam"
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
|
@ -29,6 +28,34 @@ var renderFuncMap = template.FuncMap{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const errorTemplate = `{{ "Error" | red }}: {{ .Summary }}
|
||||||
|
{{- range $index, $element := .Paths }}
|
||||||
|
{{ if eq $index 0 }}at {{else}} {{ end}}{{ $element.String | green }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $index, $element := .Locations }}
|
||||||
|
{{ if eq $index 0 }}in {{else}} {{ end}}{{ $element.String | cyan }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Detail }}
|
||||||
|
|
||||||
|
{{ .Detail }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
`
|
||||||
|
|
||||||
|
const warningTemplate = `{{ "Warning" | yellow }}: {{ .Summary }}
|
||||||
|
{{- range $index, $element := .Paths }}
|
||||||
|
{{ if eq $index 0 }}at {{else}} {{ end}}{{ $element.String | green }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $index, $element := .Locations }}
|
||||||
|
{{ if eq $index 0 }}in {{else}} {{ end}}{{ $element.String | cyan }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Detail }}
|
||||||
|
|
||||||
|
{{ .Detail }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
`
|
||||||
|
|
||||||
const summaryTemplate = `{{- if .Name -}}
|
const summaryTemplate = `{{- if .Name -}}
|
||||||
Name: {{ .Name | bold }}
|
Name: {{ .Name | bold }}
|
||||||
{{- if .Target }}
|
{{- if .Target }}
|
||||||
|
@ -101,7 +128,19 @@ func renderSummaryTemplate(out io.Writer, b *bundle.Bundle, diags diag.Diagnosti
|
||||||
}
|
}
|
||||||
|
|
||||||
func renderDiagnostics(out io.Writer, b *bundle.Bundle, diags diag.Diagnostics) error {
|
func renderDiagnostics(out io.Writer, b *bundle.Bundle, diags diag.Diagnostics) error {
|
||||||
|
errorT := template.Must(template.New("error").Funcs(renderFuncMap).Parse(errorTemplate))
|
||||||
|
warningT := template.Must(template.New("warning").Funcs(renderFuncMap).Parse(warningTemplate))
|
||||||
|
|
||||||
|
// Print errors and warnings.
|
||||||
for _, d := range diags {
|
for _, d := range diags {
|
||||||
|
var t *template.Template
|
||||||
|
switch d.Severity {
|
||||||
|
case diag.Error:
|
||||||
|
t = errorT
|
||||||
|
case diag.Warning:
|
||||||
|
t = warningT
|
||||||
|
}
|
||||||
|
|
||||||
for i := range d.Locations {
|
for i := range d.Locations {
|
||||||
if b == nil {
|
if b == nil {
|
||||||
break
|
break
|
||||||
|
@ -116,9 +155,15 @@ func renderDiagnostics(out io.Writer, b *bundle.Bundle, diags diag.Diagnostics)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Render the diagnostic with the appropriate template.
|
||||||
|
err := t.Execute(out, d)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to render template: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmdio.RenderDiagnostics(out, diags)
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RenderOptions contains options for rendering diagnostics.
|
// RenderOptions contains options for rendering diagnostics.
|
||||||
|
|
|
@ -205,13 +205,10 @@ func newUpdateRuleSet() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateRuleSetJson.Unmarshal(&updateRuleSetReq)
|
err = updateRuleSetJson.Unmarshal(&updateRuleSetReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,13 +78,10 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -319,13 +316,10 @@ func newUpdate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,13 +90,10 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,13 +129,10 @@ func newUpdate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,14 +88,11 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := a.CustomAppIntegration.Create(ctx, createReq)
|
response, err := a.CustomAppIntegration.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -323,14 +320,11 @@ func newUpdate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.IntegrationId = args[0]
|
updateReq.IntegrationId = args[0]
|
||||||
|
|
||||||
err = a.CustomAppIntegration.Update(ctx, updateReq)
|
err = a.CustomAppIntegration.Update(ctx, updateReq)
|
||||||
|
|
|
@ -107,13 +107,10 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,13 +127,10 @@ func newUpdate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,14 +97,11 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := a.Groups.Create(ctx, createReq)
|
response, err := a.Groups.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -361,14 +358,11 @@ func newPatch() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := patchJson.Unmarshal(&patchReq)
|
err = patchJson.Unmarshal(&patchReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No ID argument specified. Loading names for Account Groups drop-down."
|
promptSpinner <- "No ID argument specified. Loading names for Account Groups drop-down."
|
||||||
|
@ -452,14 +446,11 @@ func newUpdate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No ID argument specified. Loading names for Account Groups drop-down."
|
promptSpinner <- "No ID argument specified. Loading names for Account Groups drop-down."
|
||||||
|
|
|
@ -132,14 +132,11 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.Label = args[0]
|
createReq.Label = args[0]
|
||||||
}
|
}
|
||||||
|
@ -414,14 +411,11 @@ func newReplace() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := replaceJson.Unmarshal(&replaceReq)
|
err = replaceJson.Unmarshal(&replaceReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
replaceReq.IpAccessListId = args[0]
|
replaceReq.IpAccessListId = args[0]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
replaceReq.Label = args[1]
|
replaceReq.Label = args[1]
|
||||||
|
@ -511,14 +505,11 @@ func newUpdate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No IP_ACCESS_LIST_ID argument specified. Loading names for Account Ip Access Lists drop-down."
|
promptSpinner <- "No IP_ACCESS_LIST_ID argument specified. Loading names for Account Ip Access Lists drop-down."
|
||||||
|
|
|
@ -162,14 +162,11 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := a.LogDelivery.Create(ctx, createReq)
|
response, err := a.LogDelivery.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -372,14 +369,11 @@ func newPatchStatus() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := patchStatusJson.Unmarshal(&patchStatusReq)
|
err = patchStatusJson.Unmarshal(&patchStatusReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
patchStatusReq.LogDeliveryConfigurationId = args[0]
|
patchStatusReq.LogDeliveryConfigurationId = args[0]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
_, err = fmt.Sscan(args[1], &patchStatusReq.Status)
|
_, err = fmt.Sscan(args[1], &patchStatusReq.Status)
|
||||||
|
|
|
@ -85,14 +85,11 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
_, err = fmt.Sscan(args[0], &createReq.WorkspaceId)
|
_, err = fmt.Sscan(args[0], &createReq.WorkspaceId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("invalid WORKSPACE_ID: %s", args[0])
|
return fmt.Errorf("invalid WORKSPACE_ID: %s", args[0])
|
||||||
|
@ -346,14 +343,11 @@ func newUpdate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
_, err = fmt.Sscan(args[0], &updateReq.WorkspaceId)
|
_, err = fmt.Sscan(args[0], &updateReq.WorkspaceId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("invalid WORKSPACE_ID: %s", args[0])
|
return fmt.Errorf("invalid WORKSPACE_ID: %s", args[0])
|
||||||
|
|
|
@ -80,14 +80,11 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := a.Metastores.Create(ctx, createReq)
|
response, err := a.Metastores.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -307,14 +304,11 @@ func newUpdate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.MetastoreId = args[0]
|
updateReq.MetastoreId = args[0]
|
||||||
|
|
||||||
response, err := a.Metastores.Update(ctx, updateReq)
|
response, err := a.Metastores.Update(ctx, updateReq)
|
||||||
|
|
|
@ -96,14 +96,11 @@ func newCreateNetworkConnectivityConfiguration() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createNetworkConnectivityConfigurationJson.Unmarshal(&createNetworkConnectivityConfigurationReq)
|
err = createNetworkConnectivityConfigurationJson.Unmarshal(&createNetworkConnectivityConfigurationReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createNetworkConnectivityConfigurationReq.Name = args[0]
|
createNetworkConnectivityConfigurationReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -190,14 +187,11 @@ func newCreatePrivateEndpointRule() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createPrivateEndpointRuleJson.Unmarshal(&createPrivateEndpointRuleReq)
|
err = createPrivateEndpointRuleJson.Unmarshal(&createPrivateEndpointRuleReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
createPrivateEndpointRuleReq.NetworkConnectivityConfigId = args[0]
|
createPrivateEndpointRuleReq.NetworkConnectivityConfigId = args[0]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createPrivateEndpointRuleReq.ResourceId = args[1]
|
createPrivateEndpointRuleReq.ResourceId = args[1]
|
||||||
|
|
|
@ -97,14 +97,11 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.NetworkName = args[0]
|
createReq.NetworkName = args[0]
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,13 +189,10 @@ func newUpdate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,14 +109,11 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.PrivateAccessSettingsName = args[0]
|
createReq.PrivateAccessSettingsName = args[0]
|
||||||
}
|
}
|
||||||
|
@ -414,14 +411,11 @@ func newReplace() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := replaceJson.Unmarshal(&replaceReq)
|
err = replaceJson.Unmarshal(&replaceReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
replaceReq.PrivateAccessSettingsId = args[0]
|
replaceReq.PrivateAccessSettingsId = args[0]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
replaceReq.PrivateAccessSettingsName = args[1]
|
replaceReq.PrivateAccessSettingsName = args[1]
|
||||||
|
|
|
@ -85,14 +85,11 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := a.PublishedAppIntegration.Create(ctx, createReq)
|
response, err := a.PublishedAppIntegration.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -318,14 +315,11 @@ func newUpdate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.IntegrationId = args[0]
|
updateReq.IntegrationId = args[0]
|
||||||
|
|
||||||
err = a.PublishedAppIntegration.Update(ctx, updateReq)
|
err = a.PublishedAppIntegration.Update(ctx, updateReq)
|
||||||
|
|
|
@ -95,14 +95,11 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := a.ServicePrincipals.Create(ctx, createReq)
|
response, err := a.ServicePrincipals.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -361,14 +358,11 @@ func newPatch() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := patchJson.Unmarshal(&patchReq)
|
err = patchJson.Unmarshal(&patchReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No ID argument specified. Loading names for Account Service Principals drop-down."
|
promptSpinner <- "No ID argument specified. Loading names for Account Service Principals drop-down."
|
||||||
|
@ -454,14 +448,11 @@ func newUpdate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No ID argument specified. Loading names for Account Service Principals drop-down."
|
promptSpinner <- "No ID argument specified. Loading names for Account Service Principals drop-down."
|
||||||
|
|
|
@ -88,14 +88,11 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
createReq.MetastoreId = args[0]
|
createReq.MetastoreId = args[0]
|
||||||
|
|
||||||
response, err := a.StorageCredentials.Create(ctx, createReq)
|
response, err := a.StorageCredentials.Create(ctx, createReq)
|
||||||
|
@ -343,14 +340,11 @@ func newUpdate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.MetastoreId = args[0]
|
updateReq.MetastoreId = args[0]
|
||||||
updateReq.StorageCredentialName = args[1]
|
updateReq.StorageCredentialName = args[1]
|
||||||
|
|
||||||
|
|
|
@ -87,13 +87,10 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,14 +80,11 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := a.UsageDashboards.Create(ctx, createReq)
|
response, err := a.UsageDashboards.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -103,14 +103,11 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := a.Users.Create(ctx, createReq)
|
response, err := a.Users.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -377,14 +374,11 @@ func newPatch() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := patchJson.Unmarshal(&patchReq)
|
err = patchJson.Unmarshal(&patchReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No ID argument specified. Loading names for Account Users drop-down."
|
promptSpinner <- "No ID argument specified. Loading names for Account Users drop-down."
|
||||||
|
@ -471,14 +465,11 @@ func newUpdate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No ID argument specified. Loading names for Account Users drop-down."
|
promptSpinner <- "No ID argument specified. Loading names for Account Users drop-down."
|
||||||
|
|
|
@ -104,14 +104,11 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.VpcEndpointName = args[0]
|
createReq.VpcEndpointName = args[0]
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,14 +273,11 @@ func newUpdate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
_, err = fmt.Sscan(args[0], &updateReq.WorkspaceId)
|
_, err = fmt.Sscan(args[0], &updateReq.WorkspaceId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("invalid WORKSPACE_ID: %s", args[0])
|
return fmt.Errorf("invalid WORKSPACE_ID: %s", args[0])
|
||||||
|
|
|
@ -133,14 +133,11 @@ func newCreate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.WorkspaceName = args[0]
|
createReq.WorkspaceName = args[0]
|
||||||
}
|
}
|
||||||
|
@ -554,14 +551,11 @@ func newUpdate() *cobra.Command {
|
||||||
a := root.AccountClient(ctx)
|
a := root.AccountClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No WORKSPACE_ID argument specified. Loading names for Workspaces drop-down."
|
promptSpinner <- "No WORKSPACE_ID argument specified. Loading names for Workspaces drop-down."
|
||||||
|
|
|
@ -42,9 +42,9 @@ func makeCommand(method string) *cobra.Command {
|
||||||
var path = args[0]
|
var path = args[0]
|
||||||
|
|
||||||
var request any
|
var request any
|
||||||
diags := payload.Unmarshal(&request)
|
err := payload.Unmarshal(&request)
|
||||||
if diags.HasError() {
|
if err != nil {
|
||||||
return diags.Error()
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := &config.Config{}
|
cfg := &config.Config{}
|
||||||
|
|
|
@ -93,13 +93,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -360,13 +357,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,14 +85,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.Alerts.Create(ctx, createReq)
|
response, err := w.Alerts.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -357,14 +354,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.Id = args[0]
|
updateReq.Id = args[0]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
updateReq.UpdateMask = args[1]
|
updateReq.UpdateMask = args[1]
|
||||||
|
|
|
@ -112,14 +112,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.Name = args[0]
|
createReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -281,14 +278,11 @@ func newDeploy() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := deployJson.Unmarshal(&deployReq)
|
err = deployJson.Unmarshal(&deployReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
deployReq.AppName = args[0]
|
deployReq.AppName = args[0]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
deployReq.SourceCodePath = args[1]
|
deployReq.SourceCodePath = args[1]
|
||||||
|
@ -722,14 +716,11 @@ func newSetPermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
|
err = setPermissionsJson.Unmarshal(&setPermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
setPermissionsReq.AppName = args[0]
|
setPermissionsReq.AppName = args[0]
|
||||||
|
|
||||||
response, err := w.Apps.SetPermissions(ctx, setPermissionsReq)
|
response, err := w.Apps.SetPermissions(ctx, setPermissionsReq)
|
||||||
|
@ -934,14 +925,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.Name = args[0]
|
updateReq.Name = args[0]
|
||||||
|
|
||||||
response, err := w.Apps.Update(ctx, updateReq)
|
response, err := w.Apps.Update(ctx, updateReq)
|
||||||
|
@ -1006,14 +994,11 @@ func newUpdatePermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updatePermissionsReq.AppName = args[0]
|
updatePermissionsReq.AppName = args[0]
|
||||||
|
|
||||||
response, err := w.Apps.UpdatePermissions(ctx, updatePermissionsReq)
|
response, err := w.Apps.UpdatePermissions(ctx, updatePermissionsReq)
|
||||||
|
|
|
@ -145,13 +145,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,13 +127,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,14 +105,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.Name = args[0]
|
createReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -366,14 +363,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.Name = args[0]
|
updateReq.Name = args[0]
|
||||||
|
|
||||||
response, err := w.Catalogs.Update(ctx, updateReq)
|
response, err := w.Catalogs.Update(ctx, updateReq)
|
||||||
|
|
|
@ -85,13 +85,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -347,14 +344,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.Name = args[0]
|
updateReq.Name = args[0]
|
||||||
|
|
||||||
response, err := w.CleanRooms.Update(ctx, updateReq)
|
response, err := w.CleanRooms.Update(ctx, updateReq)
|
||||||
|
|
|
@ -113,14 +113,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.ClusterPolicies.Create(ctx, createReq)
|
response, err := w.ClusterPolicies.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -188,13 +185,10 @@ func newDelete() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := deleteJson.Unmarshal(&deleteReq)
|
err = deleteJson.Unmarshal(&deleteReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -290,13 +284,10 @@ func newEdit() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := editJson.Unmarshal(&editReq)
|
err = editJson.Unmarshal(&editReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -639,14 +630,11 @@ func newSetPermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
|
err = setPermissionsJson.Unmarshal(&setPermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No CLUSTER_POLICY_ID argument specified. Loading names for Cluster Policies drop-down."
|
promptSpinner <- "No CLUSTER_POLICY_ID argument specified. Loading names for Cluster Policies drop-down."
|
||||||
|
@ -723,14 +711,11 @@ func newUpdatePermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No CLUSTER_POLICY_ID argument specified. Loading names for Cluster Policies drop-down."
|
promptSpinner <- "No CLUSTER_POLICY_ID argument specified. Loading names for Cluster Policies drop-down."
|
||||||
|
|
|
@ -134,14 +134,11 @@ func newChangeOwner() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := changeOwnerJson.Unmarshal(&changeOwnerReq)
|
err = changeOwnerJson.Unmarshal(&changeOwnerReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
changeOwnerReq.ClusterId = args[0]
|
changeOwnerReq.ClusterId = args[0]
|
||||||
}
|
}
|
||||||
|
@ -265,14 +262,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.SparkVersion = args[0]
|
createReq.SparkVersion = args[0]
|
||||||
}
|
}
|
||||||
|
@ -362,13 +356,10 @@ func newDelete() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := deleteJson.Unmarshal(&deleteReq)
|
err = deleteJson.Unmarshal(&deleteReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -522,14 +513,11 @@ func newEdit() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := editJson.Unmarshal(&editReq)
|
err = editJson.Unmarshal(&editReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
editReq.ClusterId = args[0]
|
editReq.ClusterId = args[0]
|
||||||
}
|
}
|
||||||
|
@ -623,13 +611,10 @@ func newEvents() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := eventsJson.Unmarshal(&eventsReq)
|
err = eventsJson.Unmarshal(&eventsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -1078,13 +1063,10 @@ func newPermanentDelete() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := permanentDeleteJson.Unmarshal(&permanentDeleteReq)
|
err = permanentDeleteJson.Unmarshal(&permanentDeleteReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -1173,13 +1155,10 @@ func newPin() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := pinJson.Unmarshal(&pinReq)
|
err = pinJson.Unmarshal(&pinReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -1275,13 +1254,10 @@ func newResize() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := resizeJson.Unmarshal(&resizeReq)
|
err = resizeJson.Unmarshal(&resizeReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -1388,13 +1364,10 @@ func newRestart() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := restartJson.Unmarshal(&restartReq)
|
err = restartJson.Unmarshal(&restartReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -1485,14 +1458,11 @@ func newSetPermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
|
err = setPermissionsJson.Unmarshal(&setPermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No CLUSTER_ID argument specified. Loading names for Clusters drop-down."
|
promptSpinner <- "No CLUSTER_ID argument specified. Loading names for Clusters drop-down."
|
||||||
|
@ -1632,13 +1602,10 @@ func newStart() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := startJson.Unmarshal(&startReq)
|
err = startJson.Unmarshal(&startReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -1739,13 +1706,10 @@ func newUnpin() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := unpinJson.Unmarshal(&unpinReq)
|
err = unpinJson.Unmarshal(&unpinReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -1854,14 +1818,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
updateReq.ClusterId = args[0]
|
updateReq.ClusterId = args[0]
|
||||||
}
|
}
|
||||||
|
@ -1938,14 +1899,11 @@ func newUpdatePermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No CLUSTER_ID argument specified. Loading names for Clusters drop-down."
|
promptSpinner <- "No CLUSTER_ID argument specified. Loading names for Clusters drop-down."
|
||||||
|
|
|
@ -130,13 +130,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,13 +92,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -358,13 +355,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,14 +86,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
createReq.ListingId = args[0]
|
createReq.ListingId = args[0]
|
||||||
|
|
||||||
response, err := w.ConsumerInstallations.Create(ctx, createReq)
|
response, err := w.ConsumerInstallations.Create(ctx, createReq)
|
||||||
|
@ -322,13 +319,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,13 +85,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,13 +75,10 @@ func newExchangeToken() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := exchangeTokenJson.Unmarshal(&exchangeTokenReq)
|
err = exchangeTokenJson.Unmarshal(&exchangeTokenReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,13 +75,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -199,13 +196,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,13 +78,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -408,14 +405,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No DASHBOARD_ID argument specified. Loading names for Dashboards drop-down."
|
promptSpinner <- "No DASHBOARD_ID argument specified. Loading names for Dashboards drop-down."
|
||||||
|
|
|
@ -199,13 +199,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,13 +132,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,14 +130,11 @@ func newCreateExperiment() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createExperimentJson.Unmarshal(&createExperimentReq)
|
err = createExperimentJson.Unmarshal(&createExperimentReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createExperimentReq.Name = args[0]
|
createExperimentReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -206,14 +203,11 @@ func newCreateRun() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createRunJson.Unmarshal(&createRunReq)
|
err = createRunJson.Unmarshal(&createRunReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.Experiments.CreateRun(ctx, createRunReq)
|
response, err := w.Experiments.CreateRun(ctx, createRunReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -283,14 +277,11 @@ func newDeleteExperiment() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := deleteExperimentJson.Unmarshal(&deleteExperimentReq)
|
err = deleteExperimentJson.Unmarshal(&deleteExperimentReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
deleteExperimentReq.ExperimentId = args[0]
|
deleteExperimentReq.ExperimentId = args[0]
|
||||||
}
|
}
|
||||||
|
@ -361,14 +352,11 @@ func newDeleteRun() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := deleteRunJson.Unmarshal(&deleteRunReq)
|
err = deleteRunJson.Unmarshal(&deleteRunReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
deleteRunReq.RunId = args[0]
|
deleteRunReq.RunId = args[0]
|
||||||
}
|
}
|
||||||
|
@ -447,14 +435,11 @@ func newDeleteRuns() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := deleteRunsJson.Unmarshal(&deleteRunsReq)
|
err = deleteRunsJson.Unmarshal(&deleteRunsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
deleteRunsReq.ExperimentId = args[0]
|
deleteRunsReq.ExperimentId = args[0]
|
||||||
}
|
}
|
||||||
|
@ -533,14 +518,11 @@ func newDeleteTag() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := deleteTagJson.Unmarshal(&deleteTagReq)
|
err = deleteTagJson.Unmarshal(&deleteTagReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
deleteTagReq.RunId = args[0]
|
deleteTagReq.RunId = args[0]
|
||||||
}
|
}
|
||||||
|
@ -1126,14 +1108,11 @@ func newLogBatch() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := logBatchJson.Unmarshal(&logBatchReq)
|
err = logBatchJson.Unmarshal(&logBatchReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
err = w.Experiments.LogBatch(ctx, logBatchReq)
|
err = w.Experiments.LogBatch(ctx, logBatchReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1195,14 +1174,11 @@ func newLogInputs() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := logInputsJson.Unmarshal(&logInputsReq)
|
err = logInputsJson.Unmarshal(&logInputsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
err = w.Experiments.LogInputs(ctx, logInputsReq)
|
err = w.Experiments.LogInputs(ctx, logInputsReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1278,14 +1254,11 @@ func newLogMetric() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := logMetricJson.Unmarshal(&logMetricReq)
|
err = logMetricJson.Unmarshal(&logMetricReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
logMetricReq.Key = args[0]
|
logMetricReq.Key = args[0]
|
||||||
}
|
}
|
||||||
|
@ -1362,14 +1335,11 @@ func newLogModel() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := logModelJson.Unmarshal(&logModelReq)
|
err = logModelJson.Unmarshal(&logModelReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
err = w.Experiments.LogModel(ctx, logModelReq)
|
err = w.Experiments.LogModel(ctx, logModelReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1444,14 +1414,11 @@ func newLogParam() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := logParamJson.Unmarshal(&logParamReq)
|
err = logParamJson.Unmarshal(&logParamReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
logParamReq.Key = args[0]
|
logParamReq.Key = args[0]
|
||||||
}
|
}
|
||||||
|
@ -1530,14 +1497,11 @@ func newRestoreExperiment() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := restoreExperimentJson.Unmarshal(&restoreExperimentReq)
|
err = restoreExperimentJson.Unmarshal(&restoreExperimentReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
restoreExperimentReq.ExperimentId = args[0]
|
restoreExperimentReq.ExperimentId = args[0]
|
||||||
}
|
}
|
||||||
|
@ -1608,14 +1572,11 @@ func newRestoreRun() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := restoreRunJson.Unmarshal(&restoreRunReq)
|
err = restoreRunJson.Unmarshal(&restoreRunReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
restoreRunReq.RunId = args[0]
|
restoreRunReq.RunId = args[0]
|
||||||
}
|
}
|
||||||
|
@ -1694,14 +1655,11 @@ func newRestoreRuns() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := restoreRunsJson.Unmarshal(&restoreRunsReq)
|
err = restoreRunsJson.Unmarshal(&restoreRunsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
restoreRunsReq.ExperimentId = args[0]
|
restoreRunsReq.ExperimentId = args[0]
|
||||||
}
|
}
|
||||||
|
@ -1774,14 +1732,11 @@ func newSearchExperiments() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := searchExperimentsJson.Unmarshal(&searchExperimentsReq)
|
err = searchExperimentsJson.Unmarshal(&searchExperimentsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response := w.Experiments.SearchExperiments(ctx, searchExperimentsReq)
|
response := w.Experiments.SearchExperiments(ctx, searchExperimentsReq)
|
||||||
return cmdio.RenderIterator(ctx, response)
|
return cmdio.RenderIterator(ctx, response)
|
||||||
|
@ -1845,14 +1800,11 @@ func newSearchRuns() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := searchRunsJson.Unmarshal(&searchRunsReq)
|
err = searchRunsJson.Unmarshal(&searchRunsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response := w.Experiments.SearchRuns(ctx, searchRunsReq)
|
response := w.Experiments.SearchRuns(ctx, searchRunsReq)
|
||||||
return cmdio.RenderIterator(ctx, response)
|
return cmdio.RenderIterator(ctx, response)
|
||||||
|
@ -1922,14 +1874,11 @@ func newSetExperimentTag() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setExperimentTagJson.Unmarshal(&setExperimentTagReq)
|
err = setExperimentTagJson.Unmarshal(&setExperimentTagReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
setExperimentTagReq.ExperimentId = args[0]
|
setExperimentTagReq.ExperimentId = args[0]
|
||||||
}
|
}
|
||||||
|
@ -2002,14 +1951,11 @@ func newSetPermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
|
err = setPermissionsJson.Unmarshal(&setPermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
setPermissionsReq.ExperimentId = args[0]
|
setPermissionsReq.ExperimentId = args[0]
|
||||||
|
|
||||||
response, err := w.Experiments.SetPermissions(ctx, setPermissionsReq)
|
response, err := w.Experiments.SetPermissions(ctx, setPermissionsReq)
|
||||||
|
@ -2086,14 +2032,11 @@ func newSetTag() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setTagJson.Unmarshal(&setTagReq)
|
err = setTagJson.Unmarshal(&setTagReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
setTagReq.Key = args[0]
|
setTagReq.Key = args[0]
|
||||||
}
|
}
|
||||||
|
@ -2169,14 +2112,11 @@ func newUpdateExperiment() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateExperimentJson.Unmarshal(&updateExperimentReq)
|
err = updateExperimentJson.Unmarshal(&updateExperimentReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
updateExperimentReq.ExperimentId = args[0]
|
updateExperimentReq.ExperimentId = args[0]
|
||||||
}
|
}
|
||||||
|
@ -2243,14 +2183,11 @@ func newUpdatePermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updatePermissionsReq.ExperimentId = args[0]
|
updatePermissionsReq.ExperimentId = args[0]
|
||||||
|
|
||||||
response, err := w.Experiments.UpdatePermissions(ctx, updatePermissionsReq)
|
response, err := w.Experiments.UpdatePermissions(ctx, updatePermissionsReq)
|
||||||
|
@ -2314,14 +2251,11 @@ func newUpdateRun() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateRunJson.Unmarshal(&updateRunReq)
|
err = updateRunJson.Unmarshal(&updateRunReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.Experiments.UpdateRun(ctx, updateRunReq)
|
response, err := w.Experiments.UpdateRun(ctx, updateRunReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -112,14 +112,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.Name = args[0]
|
createReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -384,14 +381,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.Name = args[0]
|
updateReq.Name = args[0]
|
||||||
|
|
||||||
response, err := w.ExternalLocations.Update(ctx, updateReq)
|
response, err := w.ExternalLocations.Update(ctx, updateReq)
|
||||||
|
|
|
@ -85,13 +85,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -384,14 +381,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No NAME argument specified. Loading names for Functions drop-down."
|
promptSpinner <- "No NAME argument specified. Loading names for Functions drop-down."
|
||||||
|
|
|
@ -105,14 +105,11 @@ func newCreateMessage() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createMessageJson.Unmarshal(&createMessageReq)
|
err = createMessageJson.Unmarshal(&createMessageReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
createMessageReq.SpaceId = args[0]
|
createMessageReq.SpaceId = args[0]
|
||||||
createMessageReq.ConversationId = args[1]
|
createMessageReq.ConversationId = args[1]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
|
@ -395,14 +392,11 @@ func newStartConversation() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := startConversationJson.Unmarshal(&startConversationReq)
|
err = startConversationJson.Unmarshal(&startConversationReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
startConversationReq.SpaceId = args[0]
|
startConversationReq.SpaceId = args[0]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
startConversationReq.Content = args[1]
|
startConversationReq.Content = args[1]
|
||||||
|
|
|
@ -102,14 +102,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.GitProvider = args[0]
|
createReq.GitProvider = args[0]
|
||||||
}
|
}
|
||||||
|
@ -358,14 +355,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No CREDENTIAL_ID argument specified. Loading names for Git Credentials drop-down."
|
promptSpinner <- "No CREDENTIAL_ID argument specified. Loading names for Git Credentials drop-down."
|
||||||
|
|
|
@ -101,14 +101,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.Name = args[0]
|
createReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -370,14 +367,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.ScriptId = args[0]
|
updateReq.ScriptId = args[0]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
updateReq.Name = args[1]
|
updateReq.Name = args[1]
|
||||||
|
|
|
@ -223,14 +223,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
_, err = fmt.Sscan(args[0], &updateReq.SecurableType)
|
_, err = fmt.Sscan(args[0], &updateReq.SecurableType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("invalid SECURABLE_TYPE: %s", args[0])
|
return fmt.Errorf("invalid SECURABLE_TYPE: %s", args[0])
|
||||||
|
|
|
@ -97,14 +97,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.Groups.Create(ctx, createReq)
|
response, err := w.Groups.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -361,14 +358,11 @@ func newPatch() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := patchJson.Unmarshal(&patchReq)
|
err = patchJson.Unmarshal(&patchReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No ID argument specified. Loading names for Groups drop-down."
|
promptSpinner <- "No ID argument specified. Loading names for Groups drop-down."
|
||||||
|
@ -452,14 +446,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No ID argument specified. Loading names for Groups drop-down."
|
promptSpinner <- "No ID argument specified. Loading names for Groups drop-down."
|
||||||
|
|
|
@ -128,14 +128,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.InstancePoolName = args[0]
|
createReq.InstancePoolName = args[0]
|
||||||
}
|
}
|
||||||
|
@ -209,13 +206,10 @@ func newDelete() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := deleteJson.Unmarshal(&deleteReq)
|
err = deleteJson.Unmarshal(&deleteReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -315,14 +309,11 @@ func newEdit() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := editJson.Unmarshal(&editReq)
|
err = editJson.Unmarshal(&editReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
editReq.InstancePoolId = args[0]
|
editReq.InstancePoolId = args[0]
|
||||||
}
|
}
|
||||||
|
@ -640,14 +631,11 @@ func newSetPermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
|
err = setPermissionsJson.Unmarshal(&setPermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No INSTANCE_POOL_ID argument specified. Loading names for Instance Pools drop-down."
|
promptSpinner <- "No INSTANCE_POOL_ID argument specified. Loading names for Instance Pools drop-down."
|
||||||
|
@ -724,14 +712,11 @@ func newUpdatePermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No INSTANCE_POOL_ID argument specified. Loading names for Instance Pools drop-down."
|
promptSpinner <- "No INSTANCE_POOL_ID argument specified. Loading names for Instance Pools drop-down."
|
||||||
|
|
|
@ -99,14 +99,11 @@ func newAdd() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := addJson.Unmarshal(&addReq)
|
err = addJson.Unmarshal(&addReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
addReq.InstanceProfileArn = args[0]
|
addReq.InstanceProfileArn = args[0]
|
||||||
}
|
}
|
||||||
|
@ -195,14 +192,11 @@ func newEdit() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := editJson.Unmarshal(&editReq)
|
err = editJson.Unmarshal(&editReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
editReq.InstanceProfileArn = args[0]
|
editReq.InstanceProfileArn = args[0]
|
||||||
}
|
}
|
||||||
|
@ -317,14 +311,11 @@ func newRemove() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := removeJson.Unmarshal(&removeReq)
|
err = removeJson.Unmarshal(&removeReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
removeReq.InstanceProfileArn = args[0]
|
removeReq.InstanceProfileArn = args[0]
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,14 +133,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.Label = args[0]
|
createReq.Label = args[0]
|
||||||
}
|
}
|
||||||
|
@ -417,14 +414,11 @@ func newReplace() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := replaceJson.Unmarshal(&replaceReq)
|
err = replaceJson.Unmarshal(&replaceReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
replaceReq.IpAccessListId = args[0]
|
replaceReq.IpAccessListId = args[0]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
replaceReq.Label = args[1]
|
replaceReq.Label = args[1]
|
||||||
|
@ -516,14 +510,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No IP_ACCESS_LIST_ID argument specified. Loading names for Ip Access Lists drop-down."
|
promptSpinner <- "No IP_ACCESS_LIST_ID argument specified. Loading names for Ip Access Lists drop-down."
|
||||||
|
|
|
@ -116,14 +116,11 @@ func newCancelAllRuns() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := cancelAllRunsJson.Unmarshal(&cancelAllRunsReq)
|
err = cancelAllRunsJson.Unmarshal(&cancelAllRunsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
err = w.Jobs.CancelAllRuns(ctx, cancelAllRunsReq)
|
err = w.Jobs.CancelAllRuns(ctx, cancelAllRunsReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -196,13 +193,10 @@ func newCancelRun() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := cancelRunJson.Unmarshal(&cancelRunReq)
|
err = cancelRunJson.Unmarshal(&cancelRunReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -297,13 +291,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -373,13 +364,10 @@ func newDelete() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := deleteJson.Unmarshal(&deleteReq)
|
err = deleteJson.Unmarshal(&deleteReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -469,13 +457,10 @@ func newDeleteRun() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := deleteRunJson.Unmarshal(&deleteRunReq)
|
err = deleteRunJson.Unmarshal(&deleteRunReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -1158,13 +1143,10 @@ func newRepairRun() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := repairRunJson.Unmarshal(&repairRunReq)
|
err = repairRunJson.Unmarshal(&repairRunReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -1260,13 +1242,10 @@ func newReset() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := resetJson.Unmarshal(&resetReq)
|
err = resetJson.Unmarshal(&resetReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -1353,13 +1332,10 @@ func newRunNow() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := runNowJson.Unmarshal(&runNowReq)
|
err = runNowJson.Unmarshal(&runNowReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -1460,14 +1436,11 @@ func newSetPermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
|
err = setPermissionsJson.Unmarshal(&setPermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No JOB_ID argument specified. Loading names for Jobs drop-down."
|
promptSpinner <- "No JOB_ID argument specified. Loading names for Jobs drop-down."
|
||||||
|
@ -1565,14 +1538,11 @@ func newSubmit() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := submitJson.Unmarshal(&submitReq)
|
err = submitJson.Unmarshal(&submitReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
wait, err := w.Jobs.Submit(ctx, submitReq)
|
wait, err := w.Jobs.Submit(ctx, submitReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1662,13 +1632,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -1750,14 +1717,11 @@ func newUpdatePermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No JOB_ID argument specified. Loading names for Jobs drop-down."
|
promptSpinner <- "No JOB_ID argument specified. Loading names for Jobs drop-down."
|
||||||
|
|
|
@ -108,14 +108,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.DisplayName = args[0]
|
createReq.DisplayName = args[0]
|
||||||
}
|
}
|
||||||
|
@ -183,13 +180,10 @@ func newCreateSchedule() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createScheduleJson.Unmarshal(&createScheduleReq)
|
err = createScheduleJson.Unmarshal(&createScheduleReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -256,13 +250,10 @@ func newCreateSubscription() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createSubscriptionJson.Unmarshal(&createSubscriptionReq)
|
err = createSubscriptionJson.Unmarshal(&createSubscriptionReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -879,14 +870,11 @@ func newMigrate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := migrateJson.Unmarshal(&migrateReq)
|
err = migrateJson.Unmarshal(&migrateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
migrateReq.SourceDashboardId = args[0]
|
migrateReq.SourceDashboardId = args[0]
|
||||||
}
|
}
|
||||||
|
@ -953,14 +941,11 @@ func newPublish() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := publishJson.Unmarshal(&publishReq)
|
err = publishJson.Unmarshal(&publishReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
publishReq.DashboardId = args[0]
|
publishReq.DashboardId = args[0]
|
||||||
|
|
||||||
response, err := w.Lakeview.Publish(ctx, publishReq)
|
response, err := w.Lakeview.Publish(ctx, publishReq)
|
||||||
|
@ -1143,14 +1128,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.DashboardId = args[0]
|
updateReq.DashboardId = args[0]
|
||||||
|
|
||||||
response, err := w.Lakeview.Update(ctx, updateReq)
|
response, err := w.Lakeview.Update(ctx, updateReq)
|
||||||
|
@ -1218,13 +1200,10 @@ func newUpdateSchedule() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateScheduleJson.Unmarshal(&updateScheduleReq)
|
err = updateScheduleJson.Unmarshal(&updateScheduleReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,13 +190,10 @@ func newInstall() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := installJson.Unmarshal(&installReq)
|
err = installJson.Unmarshal(&installReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -254,13 +251,10 @@ func newUninstall() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := uninstallJson.Unmarshal(&uninstallReq)
|
err = uninstallJson.Unmarshal(&uninstallReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,14 +112,11 @@ func newAssign() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := assignJson.Unmarshal(&assignReq)
|
err = assignJson.Unmarshal(&assignReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
_, err = fmt.Sscan(args[0], &assignReq.WorkspaceId)
|
_, err = fmt.Sscan(args[0], &assignReq.WorkspaceId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("invalid WORKSPACE_ID: %s", args[0])
|
return fmt.Errorf("invalid WORKSPACE_ID: %s", args[0])
|
||||||
|
@ -204,14 +201,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.Name = args[0]
|
createReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -612,14 +606,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No ID argument specified. Loading names for Metastores drop-down."
|
promptSpinner <- "No ID argument specified. Loading names for Metastores drop-down."
|
||||||
|
@ -699,14 +690,11 @@ func newUpdateAssignment() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateAssignmentJson.Unmarshal(&updateAssignmentReq)
|
err = updateAssignmentJson.Unmarshal(&updateAssignmentReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No WORKSPACE_ID argument specified. Loading names for Metastores drop-down."
|
promptSpinner <- "No WORKSPACE_ID argument specified. Loading names for Metastores drop-down."
|
||||||
|
|
|
@ -141,14 +141,11 @@ func newApproveTransitionRequest() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := approveTransitionRequestJson.Unmarshal(&approveTransitionRequestReq)
|
err = approveTransitionRequestJson.Unmarshal(&approveTransitionRequestReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
approveTransitionRequestReq.Name = args[0]
|
approveTransitionRequestReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -238,14 +235,11 @@ func newCreateComment() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createCommentJson.Unmarshal(&createCommentReq)
|
err = createCommentJson.Unmarshal(&createCommentReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createCommentReq.Name = args[0]
|
createCommentReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -328,14 +322,11 @@ func newCreateModel() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createModelJson.Unmarshal(&createModelReq)
|
err = createModelJson.Unmarshal(&createModelReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createModelReq.Name = args[0]
|
createModelReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -412,14 +403,11 @@ func newCreateModelVersion() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createModelVersionJson.Unmarshal(&createModelVersionReq)
|
err = createModelVersionJson.Unmarshal(&createModelVersionReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createModelVersionReq.Name = args[0]
|
createModelVersionReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -505,14 +493,11 @@ func newCreateTransitionRequest() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createTransitionRequestJson.Unmarshal(&createTransitionRequestReq)
|
err = createTransitionRequestJson.Unmarshal(&createTransitionRequestReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createTransitionRequestReq.Name = args[0]
|
createTransitionRequestReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -585,13 +570,10 @@ func newCreateWebhook() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createWebhookJson.Unmarshal(&createWebhookReq)
|
err = createWebhookJson.Unmarshal(&createWebhookReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -1097,14 +1079,11 @@ func newGetLatestVersions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := getLatestVersionsJson.Unmarshal(&getLatestVersionsReq)
|
err = getLatestVersionsJson.Unmarshal(&getLatestVersionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
getLatestVersionsReq.Name = args[0]
|
getLatestVersionsReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -1650,14 +1629,11 @@ func newRejectTransitionRequest() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := rejectTransitionRequestJson.Unmarshal(&rejectTransitionRequestReq)
|
err = rejectTransitionRequestJson.Unmarshal(&rejectTransitionRequestReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
rejectTransitionRequestReq.Name = args[0]
|
rejectTransitionRequestReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -1739,14 +1715,11 @@ func newRenameModel() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := renameModelJson.Unmarshal(&renameModelReq)
|
err = renameModelJson.Unmarshal(&renameModelReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
renameModelReq.Name = args[0]
|
renameModelReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -1934,14 +1907,11 @@ func newSetModelTag() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setModelTagJson.Unmarshal(&setModelTagReq)
|
err = setModelTagJson.Unmarshal(&setModelTagReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
setModelTagReq.Name = args[0]
|
setModelTagReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -2026,14 +1996,11 @@ func newSetModelVersionTag() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setModelVersionTagJson.Unmarshal(&setModelVersionTagReq)
|
err = setModelVersionTagJson.Unmarshal(&setModelVersionTagReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
setModelVersionTagReq.Name = args[0]
|
setModelVersionTagReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -2109,14 +2076,11 @@ func newSetPermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
|
err = setPermissionsJson.Unmarshal(&setPermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
setPermissionsReq.RegisteredModelId = args[0]
|
setPermissionsReq.RegisteredModelId = args[0]
|
||||||
|
|
||||||
response, err := w.ModelRegistry.SetPermissions(ctx, setPermissionsReq)
|
response, err := w.ModelRegistry.SetPermissions(ctx, setPermissionsReq)
|
||||||
|
@ -2202,14 +2166,11 @@ func newTestRegistryWebhook() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := testRegistryWebhookJson.Unmarshal(&testRegistryWebhookReq)
|
err = testRegistryWebhookJson.Unmarshal(&testRegistryWebhookReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
testRegistryWebhookReq.Id = args[0]
|
testRegistryWebhookReq.Id = args[0]
|
||||||
}
|
}
|
||||||
|
@ -2298,14 +2259,11 @@ func newTransitionStage() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := transitionStageJson.Unmarshal(&transitionStageReq)
|
err = transitionStageJson.Unmarshal(&transitionStageReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
transitionStageReq.Name = args[0]
|
transitionStageReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -2392,14 +2350,11 @@ func newUpdateComment() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateCommentJson.Unmarshal(&updateCommentReq)
|
err = updateCommentJson.Unmarshal(&updateCommentReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
updateCommentReq.Id = args[0]
|
updateCommentReq.Id = args[0]
|
||||||
}
|
}
|
||||||
|
@ -2475,14 +2430,11 @@ func newUpdateModel() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateModelJson.Unmarshal(&updateModelReq)
|
err = updateModelJson.Unmarshal(&updateModelReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
updateModelReq.Name = args[0]
|
updateModelReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -2556,14 +2508,11 @@ func newUpdateModelVersion() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateModelVersionJson.Unmarshal(&updateModelVersionReq)
|
err = updateModelVersionJson.Unmarshal(&updateModelVersionReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
updateModelVersionReq.Name = args[0]
|
updateModelVersionReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -2633,14 +2582,11 @@ func newUpdatePermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updatePermissionsReq.RegisteredModelId = args[0]
|
updatePermissionsReq.RegisteredModelId = args[0]
|
||||||
|
|
||||||
response, err := w.ModelRegistry.UpdatePermissions(ctx, updatePermissionsReq)
|
response, err := w.ModelRegistry.UpdatePermissions(ctx, updatePermissionsReq)
|
||||||
|
@ -2717,14 +2663,11 @@ func newUpdateWebhook() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateWebhookJson.Unmarshal(&updateWebhookReq)
|
err = updateWebhookJson.Unmarshal(&updateWebhookReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
updateWebhookReq.Id = args[0]
|
updateWebhookReq.Id = args[0]
|
||||||
}
|
}
|
||||||
|
|
|
@ -377,14 +377,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.FullName = args[0]
|
updateReq.FullName = args[0]
|
||||||
_, err = fmt.Sscan(args[1], &updateReq.Version)
|
_, err = fmt.Sscan(args[1], &updateReq.Version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -84,14 +84,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.NotificationDestinations.Create(ctx, createReq)
|
response, err := w.NotificationDestinations.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -316,14 +313,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.Id = args[0]
|
updateReq.Id = args[0]
|
||||||
|
|
||||||
response, err := w.NotificationDestinations.Update(ctx, updateReq)
|
response, err := w.NotificationDestinations.Update(ctx, updateReq)
|
||||||
|
|
|
@ -79,14 +79,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.OnlineTables.Create(ctx, createReq)
|
response, err := w.OnlineTables.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -92,14 +92,11 @@ func newMigratePermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := migratePermissionsJson.Unmarshal(&migratePermissionsReq)
|
err = migratePermissionsJson.Unmarshal(&migratePermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
_, err = fmt.Sscan(args[0], &migratePermissionsReq.WorkspaceId)
|
_, err = fmt.Sscan(args[0], &migratePermissionsReq.WorkspaceId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -265,14 +265,11 @@ func newSet() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setJson.Unmarshal(&setReq)
|
err = setJson.Unmarshal(&setReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
setReq.RequestObjectType = args[0]
|
setReq.RequestObjectType = args[0]
|
||||||
setReq.RequestObjectId = args[1]
|
setReq.RequestObjectId = args[1]
|
||||||
|
|
||||||
|
@ -343,14 +340,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.RequestObjectType = args[0]
|
updateReq.RequestObjectType = args[0]
|
||||||
updateReq.RequestObjectId = args[1]
|
updateReq.RequestObjectId = args[1]
|
||||||
|
|
||||||
|
|
|
@ -98,13 +98,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -702,14 +699,11 @@ func newSetPermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
|
err = setPermissionsJson.Unmarshal(&setPermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No PIPELINE_ID argument specified. Loading names for Pipelines drop-down."
|
promptSpinner <- "No PIPELINE_ID argument specified. Loading names for Pipelines drop-down."
|
||||||
|
@ -794,14 +788,11 @@ func newStartUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := startUpdateJson.Unmarshal(&startUpdateReq)
|
err = startUpdateJson.Unmarshal(&startUpdateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No PIPELINE_ID argument specified. Loading names for Pipelines drop-down."
|
promptSpinner <- "No PIPELINE_ID argument specified. Loading names for Pipelines drop-down."
|
||||||
|
@ -984,14 +975,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No PIPELINE_ID argument specified. Loading names for Pipelines drop-down."
|
promptSpinner <- "No PIPELINE_ID argument specified. Loading names for Pipelines drop-down."
|
||||||
|
@ -1068,14 +1056,11 @@ func newUpdatePermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No PIPELINE_ID argument specified. Loading names for Pipelines drop-down."
|
promptSpinner <- "No PIPELINE_ID argument specified. Loading names for Pipelines drop-down."
|
||||||
|
|
|
@ -110,14 +110,11 @@ func newEnforceCompliance() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := enforceComplianceJson.Unmarshal(&enforceComplianceReq)
|
err = enforceComplianceJson.Unmarshal(&enforceComplianceReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
enforceComplianceReq.ClusterId = args[0]
|
enforceComplianceReq.ClusterId = args[0]
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,14 +104,11 @@ func newEnforceCompliance() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := enforceComplianceJson.Unmarshal(&enforceComplianceReq)
|
err = enforceComplianceJson.Unmarshal(&enforceComplianceReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
_, err = fmt.Sscan(args[0], &enforceComplianceReq.JobId)
|
_, err = fmt.Sscan(args[0], &enforceComplianceReq.JobId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -73,13 +73,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -262,13 +259,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,14 +91,11 @@ func newAddListingToExchange() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := addListingToExchangeJson.Unmarshal(&addListingToExchangeReq)
|
err = addListingToExchangeJson.Unmarshal(&addListingToExchangeReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
addListingToExchangeReq.ListingId = args[0]
|
addListingToExchangeReq.ListingId = args[0]
|
||||||
}
|
}
|
||||||
|
@ -157,13 +154,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -552,13 +546,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,13 +77,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -276,13 +273,10 @@ func newList() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := listJson.Unmarshal(&listReq)
|
err = listJson.Unmarshal(&listReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,13 +75,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -329,13 +326,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,14 +142,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.ListingId = args[0]
|
updateReq.ListingId = args[0]
|
||||||
updateReq.RequestId = args[1]
|
updateReq.RequestId = args[1]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
|
|
|
@ -208,14 +208,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.Id = args[0]
|
updateReq.Id = args[0]
|
||||||
|
|
||||||
response, err := w.ProviderProviderAnalyticsDashboards.Update(ctx, updateReq)
|
response, err := w.ProviderProviderAnalyticsDashboards.Update(ctx, updateReq)
|
||||||
|
|
|
@ -74,13 +74,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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,13 +325,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,14 +97,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.Name = args[0]
|
createReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -449,14 +446,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No NAME argument specified. Loading names for Providers drop-down."
|
promptSpinner <- "No NAME argument specified. Loading names for Providers drop-down."
|
||||||
|
|
|
@ -196,14 +196,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
createReq.TableName = args[0]
|
createReq.TableName = args[0]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.AssetsDir = args[1]
|
createReq.AssetsDir = args[1]
|
||||||
|
@ -562,14 +559,11 @@ func newRegenerateDashboard() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := regenerateDashboardJson.Unmarshal(®enerateDashboardReq)
|
err = regenerateDashboardJson.Unmarshal(®enerateDashboardReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
regenerateDashboardReq.TableName = args[0]
|
regenerateDashboardReq.TableName = args[0]
|
||||||
|
|
||||||
response, err := w.QualityMonitors.RegenerateDashboard(ctx, regenerateDashboardReq)
|
response, err := w.QualityMonitors.RegenerateDashboard(ctx, regenerateDashboardReq)
|
||||||
|
@ -730,14 +724,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.TableName = args[0]
|
updateReq.TableName = args[0]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
updateReq.OutputSchemaName = args[1]
|
updateReq.OutputSchemaName = args[1]
|
||||||
|
|
|
@ -96,13 +96,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -457,14 +454,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No QUERY_ID argument specified. Loading names for Queries Legacy drop-down."
|
promptSpinner <- "No QUERY_ID argument specified. Loading names for Queries Legacy drop-down."
|
||||||
|
|
|
@ -85,14 +85,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.Queries.Create(ctx, createReq)
|
response, err := w.Queries.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -428,14 +425,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.Id = args[0]
|
updateReq.Id = args[0]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
updateReq.UpdateMask = args[1]
|
updateReq.UpdateMask = args[1]
|
||||||
|
|
|
@ -87,13 +87,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -225,13 +222,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,14 +84,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.QueryVisualizations.Create(ctx, createReq)
|
response, err := w.QueryVisualizations.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -220,14 +217,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.Id = args[0]
|
updateReq.Id = args[0]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
updateReq.UpdateMask = args[1]
|
updateReq.UpdateMask = args[1]
|
||||||
|
|
|
@ -118,14 +118,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.Name = args[0]
|
createReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -407,14 +404,11 @@ func newRotateToken() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := rotateTokenJson.Unmarshal(&rotateTokenReq)
|
err = rotateTokenJson.Unmarshal(&rotateTokenReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
rotateTokenReq.Name = args[0]
|
rotateTokenReq.Name = args[0]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
_, err = fmt.Sscan(args[1], &rotateTokenReq.ExistingTokenExpireInSeconds)
|
_, err = fmt.Sscan(args[1], &rotateTokenReq.ExistingTokenExpireInSeconds)
|
||||||
|
@ -560,14 +554,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No NAME argument specified. Loading names for Recipients drop-down."
|
promptSpinner <- "No NAME argument specified. Loading names for Recipients drop-down."
|
||||||
|
|
|
@ -135,14 +135,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.CatalogName = args[0]
|
createReq.CatalogName = args[0]
|
||||||
}
|
}
|
||||||
|
@ -512,14 +509,11 @@ func newSetAlias() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setAliasJson.Unmarshal(&setAliasReq)
|
err = setAliasJson.Unmarshal(&setAliasReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
setAliasReq.FullName = args[0]
|
setAliasReq.FullName = args[0]
|
||||||
setAliasReq.Alias = args[1]
|
setAliasReq.Alias = args[1]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
|
@ -595,14 +589,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No FULL_NAME argument specified. Loading names for Registered Models drop-down."
|
promptSpinner <- "No FULL_NAME argument specified. Loading names for Registered Models drop-down."
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
|
|
||||||
"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/diag"
|
|
||||||
"github.com/databricks/cli/libs/flags"
|
"github.com/databricks/cli/libs/flags"
|
||||||
"github.com/databricks/databricks-sdk-go"
|
"github.com/databricks/databricks-sdk-go"
|
||||||
"github.com/databricks/databricks-sdk-go/service/workspace"
|
"github.com/databricks/databricks-sdk-go/service/workspace"
|
||||||
|
@ -34,10 +33,12 @@ func createOverride(createCmd *cobra.Command, createReq *workspace.CreateRepo) {
|
||||||
createJson := createCmd.Flag("json").Value.(*flags.JsonFlag)
|
createJson := createCmd.Flag("json").Value.(*flags.JsonFlag)
|
||||||
createCmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
createCmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
var diags diag.Diagnostics
|
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags = createJson.Unmarshal(createReq)
|
err = createJson.Unmarshal(createReq)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
createReq.Url = args[0]
|
createReq.Url = args[0]
|
||||||
if len(args) > 1 {
|
if len(args) > 1 {
|
||||||
|
@ -54,7 +55,7 @@ func createOverride(createCmd *cobra.Command, createReq *workspace.CreateRepo) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return cmdio.RenderWithDiagnostics(ctx, response, diags)
|
return cmdio.Render(ctx, response)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,10 +101,12 @@ func updateOverride(updateCmd *cobra.Command, updateReq *workspace.UpdateRepo) {
|
||||||
updateJson := updateCmd.Flag("json").Value.(*flags.JsonFlag)
|
updateJson := updateCmd.Flag("json").Value.(*flags.JsonFlag)
|
||||||
updateCmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
updateCmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
var diags diag.Diagnostics
|
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags = updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
updateReq.RepoId, err = repoArgumentToRepoID(ctx, w, args)
|
updateReq.RepoId, err = repoArgumentToRepoID(ctx, w, args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -115,7 +118,7 @@ func updateOverride(updateCmd *cobra.Command, updateReq *workspace.UpdateRepo) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return diags.Error()
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,14 +110,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.Url = args[0]
|
createReq.Url = args[0]
|
||||||
}
|
}
|
||||||
|
@ -523,14 +520,11 @@ func newSetPermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
|
err = setPermissionsJson.Unmarshal(&setPermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No REPO_ID argument specified. Loading names for Repos drop-down."
|
promptSpinner <- "No REPO_ID argument specified. Loading names for Repos drop-down."
|
||||||
|
@ -609,14 +603,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No REPO_ID argument specified. Loading names for Repos drop-down."
|
promptSpinner <- "No REPO_ID argument specified. Loading names for Repos drop-down."
|
||||||
|
@ -696,14 +687,11 @@ func newUpdatePermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No REPO_ID argument specified. Loading names for Repos drop-down."
|
promptSpinner <- "No REPO_ID argument specified. Loading names for Repos drop-down."
|
||||||
|
|
|
@ -197,13 +197,10 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,14 +100,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.Name = args[0]
|
createReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -389,14 +386,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No FULL_NAME argument specified. Loading names for Schemas drop-down."
|
promptSpinner <- "No FULL_NAME argument specified. Loading names for Schemas drop-down."
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
|
|
||||||
"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/diag"
|
|
||||||
"github.com/databricks/cli/libs/flags"
|
"github.com/databricks/cli/libs/flags"
|
||||||
"github.com/databricks/databricks-sdk-go/service/workspace"
|
"github.com/databricks/databricks-sdk-go/service/workspace"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -61,7 +60,6 @@ func newPutSecret() *cobra.Command {
|
||||||
cmd.PreRunE = root.MustWorkspaceClient
|
cmd.PreRunE = root.MustWorkspaceClient
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
|
||||||
ctx := cmd.Context()
|
ctx := cmd.Context()
|
||||||
var diags diag.Diagnostics
|
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
bytesValueChanged := cmd.Flags().Changed("bytes-value")
|
bytesValueChanged := cmd.Flags().Changed("bytes-value")
|
||||||
|
@ -71,9 +69,9 @@ func newPutSecret() *cobra.Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags = putSecretJson.Unmarshal(&putSecretReq)
|
err = putSecretJson.Unmarshal(&putSecretReq)
|
||||||
if diags.HasError() {
|
if err != nil {
|
||||||
return diags.Error()
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
putSecretReq.Scope = args[0]
|
putSecretReq.Scope = args[0]
|
||||||
|
|
|
@ -110,14 +110,11 @@ func newCreateScope() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createScopeJson.Unmarshal(&createScopeReq)
|
err = createScopeJson.Unmarshal(&createScopeReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createScopeReq.Scope = args[0]
|
createScopeReq.Scope = args[0]
|
||||||
}
|
}
|
||||||
|
@ -194,14 +191,11 @@ func newDeleteAcl() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := deleteAclJson.Unmarshal(&deleteAclReq)
|
err = deleteAclJson.Unmarshal(&deleteAclReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
deleteAclReq.Scope = args[0]
|
deleteAclReq.Scope = args[0]
|
||||||
}
|
}
|
||||||
|
@ -279,14 +273,11 @@ func newDeleteScope() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := deleteScopeJson.Unmarshal(&deleteScopeReq)
|
err = deleteScopeJson.Unmarshal(&deleteScopeReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
deleteScopeReq.Scope = args[0]
|
deleteScopeReq.Scope = args[0]
|
||||||
}
|
}
|
||||||
|
@ -363,14 +354,11 @@ func newDeleteSecret() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := deleteSecretJson.Unmarshal(&deleteSecretReq)
|
err = deleteSecretJson.Unmarshal(&deleteSecretReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
deleteSecretReq.Scope = args[0]
|
deleteSecretReq.Scope = args[0]
|
||||||
}
|
}
|
||||||
|
@ -771,14 +759,11 @@ func newPutAcl() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := putAclJson.Unmarshal(&putAclReq)
|
err = putAclJson.Unmarshal(&putAclReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
putAclReq.Scope = args[0]
|
putAclReq.Scope = args[0]
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,14 +95,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.ServicePrincipals.Create(ctx, createReq)
|
response, err := w.ServicePrincipals.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -361,14 +358,11 @@ func newPatch() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := patchJson.Unmarshal(&patchReq)
|
err = patchJson.Unmarshal(&patchReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No ID argument specified. Loading names for Service Principals drop-down."
|
promptSpinner <- "No ID argument specified. Loading names for Service Principals drop-down."
|
||||||
|
@ -454,14 +448,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No ID argument specified. Loading names for Service Principals drop-down."
|
promptSpinner <- "No ID argument specified. Loading names for Service Principals drop-down."
|
||||||
|
|
|
@ -167,13 +167,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
@ -707,14 +704,11 @@ func newPatch() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := patchJson.Unmarshal(&patchReq)
|
err = patchJson.Unmarshal(&patchReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
patchReq.Name = args[0]
|
patchReq.Name = args[0]
|
||||||
|
|
||||||
response, err := w.ServingEndpoints.Patch(ctx, patchReq)
|
response, err := w.ServingEndpoints.Patch(ctx, patchReq)
|
||||||
|
@ -780,14 +774,11 @@ func newPut() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := putJson.Unmarshal(&putReq)
|
err = putJson.Unmarshal(&putReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
putReq.Name = args[0]
|
putReq.Name = args[0]
|
||||||
|
|
||||||
response, err := w.ServingEndpoints.Put(ctx, putReq)
|
response, err := w.ServingEndpoints.Put(ctx, putReq)
|
||||||
|
@ -861,14 +852,11 @@ func newQuery() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := queryJson.Unmarshal(&queryReq)
|
err = queryJson.Unmarshal(&queryReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
queryReq.Name = args[0]
|
queryReq.Name = args[0]
|
||||||
|
|
||||||
response, err := w.ServingEndpoints.Query(ctx, queryReq)
|
response, err := w.ServingEndpoints.Query(ctx, queryReq)
|
||||||
|
@ -933,14 +921,11 @@ func newSetPermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
|
err = setPermissionsJson.Unmarshal(&setPermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
setPermissionsReq.ServingEndpointId = args[0]
|
setPermissionsReq.ServingEndpointId = args[0]
|
||||||
|
|
||||||
response, err := w.ServingEndpoints.SetPermissions(ctx, setPermissionsReq)
|
response, err := w.ServingEndpoints.SetPermissions(ctx, setPermissionsReq)
|
||||||
|
@ -1015,14 +1000,11 @@ func newUpdateConfig() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateConfigJson.Unmarshal(&updateConfigReq)
|
err = updateConfigJson.Unmarshal(&updateConfigReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateConfigReq.Name = args[0]
|
updateConfigReq.Name = args[0]
|
||||||
|
|
||||||
wait, err := w.ServingEndpoints.UpdateConfig(ctx, updateConfigReq)
|
wait, err := w.ServingEndpoints.UpdateConfig(ctx, updateConfigReq)
|
||||||
|
@ -1100,14 +1082,11 @@ func newUpdatePermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updatePermissionsReq.ServingEndpointId = args[0]
|
updatePermissionsReq.ServingEndpointId = args[0]
|
||||||
|
|
||||||
response, err := w.ServingEndpoints.UpdatePermissions(ctx, updatePermissionsReq)
|
response, err := w.ServingEndpoints.UpdatePermissions(ctx, updatePermissionsReq)
|
||||||
|
|
|
@ -100,14 +100,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.Name = args[0]
|
createReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -430,14 +427,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateReq.Name = args[0]
|
updateReq.Name = args[0]
|
||||||
|
|
||||||
response, err := w.Shares.Update(ctx, updateReq)
|
response, err := w.Shares.Update(ctx, updateReq)
|
||||||
|
@ -507,14 +501,11 @@ func newUpdatePermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updatePermissionsReq.Name = args[0]
|
updatePermissionsReq.Name = args[0]
|
||||||
|
|
||||||
err = w.Shares.UpdatePermissions(ctx, updatePermissionsReq)
|
err = w.Shares.UpdatePermissions(ctx, updatePermissionsReq)
|
||||||
|
|
|
@ -111,14 +111,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
createReq.Name = args[0]
|
createReq.Name = args[0]
|
||||||
}
|
}
|
||||||
|
@ -380,14 +377,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No NAME argument specified. Loading names for Storage Credentials drop-down."
|
promptSpinner <- "No NAME argument specified. Loading names for Storage Credentials drop-down."
|
||||||
|
@ -484,14 +478,11 @@ func newValidate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := validateJson.Unmarshal(&validateReq)
|
err = validateJson.Unmarshal(&validateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.StorageCredentials.Validate(ctx, validateReq)
|
response, err := w.StorageCredentials.Validate(ctx, validateReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -92,13 +92,10 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -476,14 +476,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No FULL_NAME argument specified. Loading names for Tables drop-down."
|
promptSpinner <- "No FULL_NAME argument specified. Loading names for Tables drop-down."
|
||||||
|
|
|
@ -96,13 +96,10 @@ func newCreateOboToken() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createOboTokenJson.Unmarshal(&createOboTokenReq)
|
err = createOboTokenJson.Unmarshal(&createOboTokenReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
@ -461,14 +458,11 @@ func newSetPermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
|
err = setPermissionsJson.Unmarshal(&setPermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.TokenManagement.SetPermissions(ctx, setPermissionsReq)
|
response, err := w.TokenManagement.SetPermissions(ctx, setPermissionsReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -529,14 +523,11 @@ func newUpdatePermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.TokenManagement.UpdatePermissions(ctx, updatePermissionsReq)
|
response, err := w.TokenManagement.UpdatePermissions(ctx, updatePermissionsReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -84,14 +84,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.Tokens.Create(ctx, createReq)
|
response, err := w.Tokens.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -161,13 +158,10 @@ func newDelete() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := deleteJson.Unmarshal(&deleteReq)
|
err = deleteJson.Unmarshal(&deleteReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
|
|
|
@ -107,14 +107,11 @@ func newCreate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := createJson.Unmarshal(&createReq)
|
err = createJson.Unmarshal(&createReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.Users.Create(ctx, createReq)
|
response, err := w.Users.Create(ctx, createReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -466,14 +463,11 @@ func newPatch() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := patchJson.Unmarshal(&patchReq)
|
err = patchJson.Unmarshal(&patchReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No ID argument specified. Loading names for Users drop-down."
|
promptSpinner <- "No ID argument specified. Loading names for Users drop-down."
|
||||||
|
@ -552,14 +546,11 @@ func newSetPermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := setPermissionsJson.Unmarshal(&setPermissionsReq)
|
err = setPermissionsJson.Unmarshal(&setPermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.Users.SetPermissions(ctx, setPermissionsReq)
|
response, err := w.Users.SetPermissions(ctx, setPermissionsReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -628,14 +619,11 @@ func newUpdate() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updateJson.Unmarshal(&updateReq)
|
err = updateJson.Unmarshal(&updateReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
promptSpinner := cmdio.Spinner(ctx)
|
promptSpinner := cmdio.Spinner(ctx)
|
||||||
promptSpinner <- "No ID argument specified. Loading names for Users drop-down."
|
promptSpinner <- "No ID argument specified. Loading names for Users drop-down."
|
||||||
|
@ -714,14 +702,11 @@ func newUpdatePermissions() *cobra.Command {
|
||||||
w := root.WorkspaceClient(ctx)
|
w := root.WorkspaceClient(ctx)
|
||||||
|
|
||||||
if cmd.Flags().Changed("json") {
|
if cmd.Flags().Changed("json") {
|
||||||
diags := updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
err = updatePermissionsJson.Unmarshal(&updatePermissionsReq)
|
||||||
if len(diags) > 0 {
|
|
||||||
err := cmdio.RenderDiags(ctx, diags)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
response, err := w.Users.UpdatePermissions(ctx, updatePermissionsReq)
|
response, err := w.Users.UpdatePermissions(ctx, updatePermissionsReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue