mirror of https://github.com/databricks/cli.git
fixes
This commit is contained in:
parent
b452f53ccf
commit
9d193fb921
|
@ -147,8 +147,8 @@ func new{{.PascalName}}() *cobra.Command {
|
||||||
{{else if .Entity.ArrayValue }}// TODO: array: {{.Name}}
|
{{else if .Entity.ArrayValue }}// TODO: array: {{.Name}}
|
||||||
{{else if .Entity.MapValue }}// TODO: map via StringToStringVar: {{.Name}}
|
{{else if .Entity.MapValue }}// TODO: map via StringToStringVar: {{.Name}}
|
||||||
{{else if .Entity.IsEmpty }}// TODO: output-only field
|
{{else if .Entity.IsEmpty }}// TODO: output-only field
|
||||||
{{else if .Entity.Enum }}cmd.Flags().Var(&{{- template "request-body-obj" (dict "Method" $method)}}.{{.PascalName}}, "{{.KebabName}}", `{{.Summary | without "`" | trimSuffix "."}}. Supported values: {{template "printArray" .Entity.Enum}}`)
|
{{else if .Entity.Enum }}cmd.Flags().Var(&{{- template "request-body-obj" (dict "Method" $method "Field" .)}}, "{{.KebabName}}", `{{.Summary | without "`" | trimSuffix "."}}. Supported values: {{template "printArray" .Entity.Enum}}`)
|
||||||
{{else}}cmd.Flags().{{template "arg-type" .Entity}}(&{{- template "request-body-obj" (dict "Method" $method)}}.{{.PascalName}}, "{{.KebabName}}", {{- template "request-body-obj" (dict "Method" $method)}}.{{.PascalName}}, `{{.Summary | without "`"}}`)
|
{{else}}cmd.Flags().{{template "arg-type" .Entity}}(&{{- template "request-body-obj" (dict "Method" $method "Field" .)}}, "{{.KebabName}}", {{- template "request-body-obj" (dict "Method" $method "Field" .)}}, `{{.Summary | without "`"}}`)
|
||||||
{{end}}
|
{{end}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
|
@ -395,11 +395,11 @@ func new{{.PascalName}}() *cobra.Command {
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{if not $field.Entity.IsString -}}
|
{{if not $field.Entity.IsString -}}
|
||||||
_, err = fmt.Sscan(args[{{$arg}}], &{{- template "request-body-obj" (dict "Method" $method)}}.{{$field.PascalName}})
|
_, err = fmt.Sscan(args[{{$arg}}], &{{- template "request-body-obj" (dict "Method" $method "Field" $field)}})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("invalid {{$field.ConstantName}}: %s", args[{{$arg}}])
|
return fmt.Errorf("invalid {{$field.ConstantName}}: %s", args[{{$arg}}])
|
||||||
}{{else -}}
|
}{{else -}}
|
||||||
{{- template "request-body-obj" (dict "Method" $method)}}.{{$field.PascalName}} = args[{{$arg}}]
|
{{- template "request-body-obj" (dict "Method" $method "Field" $field)}} = args[{{$arg}}]
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- if $optionalIfJsonIsUsed }}
|
{{- if $optionalIfJsonIsUsed }}
|
||||||
}
|
}
|
||||||
|
@ -408,5 +408,6 @@ func new{{.PascalName}}() *cobra.Command {
|
||||||
|
|
||||||
{{- define "request-body-obj" -}}
|
{{- define "request-body-obj" -}}
|
||||||
{{- $method := .Method -}}
|
{{- $method := .Method -}}
|
||||||
{{$method.CamelName}}Req{{ if $method.RequestBodyField }}.{{$method.RequestBodyField.PascalName}}{{end}}
|
{{- $field := .Field -}}
|
||||||
|
{{$method.CamelName}}Req{{ if (and $method.RequestBodyField (not $field.IsPath)) }}.{{$method.RequestBodyField.PascalName}}{{end}}.{{$field.PascalName}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
|
@ -267,16 +267,19 @@ func newDeploy() *cobra.Command {
|
||||||
// TODO: complex arg: status
|
// TODO: complex arg: status
|
||||||
cmd.Flags().StringVar(&deployReq.AppDeployment.UpdateTime, "update-time", deployReq.AppDeployment.UpdateTime, `The update time of the deployment.`)
|
cmd.Flags().StringVar(&deployReq.AppDeployment.UpdateTime, "update-time", deployReq.AppDeployment.UpdateTime, `The update time of the deployment.`)
|
||||||
|
|
||||||
cmd.Use = "deploy"
|
cmd.Use = "deploy APP_NAME"
|
||||||
cmd.Short = `Create an app deployment.`
|
cmd.Short = `Create an app deployment.`
|
||||||
cmd.Long = `Create an app deployment.
|
cmd.Long = `Create an app deployment.
|
||||||
|
|
||||||
Creates an app deployment for the app with the supplied name.`
|
Creates an app deployment for the app with the supplied name.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
APP_NAME: The name of the app.`
|
||||||
|
|
||||||
cmd.Annotations = make(map[string]string)
|
cmd.Annotations = make(map[string]string)
|
||||||
|
|
||||||
cmd.Args = func(cmd *cobra.Command, args []string) error {
|
cmd.Args = func(cmd *cobra.Command, args []string) error {
|
||||||
check := root.ExactArgs(0)
|
check := root.ExactArgs(1)
|
||||||
return check(cmd, args)
|
return check(cmd, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,6 +300,7 @@ func newDeploy() *cobra.Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
deployReq.AppName = args[0]
|
||||||
|
|
||||||
wait, err := w.Apps.Deploy(ctx, deployReq)
|
wait, err := w.Apps.Deploy(ctx, deployReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -956,13 +960,14 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.Flags().StringVar(&updateReq.App.Updater, "updater", updateReq.App.Updater, `The email of the user that last updated the app.`)
|
cmd.Flags().StringVar(&updateReq.App.Updater, "updater", updateReq.App.Updater, `The email of the user that last updated the app.`)
|
||||||
cmd.Flags().StringVar(&updateReq.App.Url, "url", updateReq.App.Url, `The URL of the app once it is deployed.`)
|
cmd.Flags().StringVar(&updateReq.App.Url, "url", updateReq.App.Url, `The URL of the app once it is deployed.`)
|
||||||
|
|
||||||
cmd.Use = "update NAME"
|
cmd.Use = "update NAME NAME"
|
||||||
cmd.Short = `Update an app.`
|
cmd.Short = `Update an app.`
|
||||||
cmd.Long = `Update an app.
|
cmd.Long = `Update an app.
|
||||||
|
|
||||||
Updates the app with the supplied name.
|
Updates the app with the supplied name.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
NAME: The name of the app.
|
||||||
NAME: The name of the app. The name must contain only lowercase alphanumeric
|
NAME: The name of the app. The name must contain only lowercase alphanumeric
|
||||||
characters and hyphens. It must be unique within the workspace.`
|
characters and hyphens. It must be unique within the workspace.`
|
||||||
|
|
||||||
|
@ -976,7 +981,7 @@ func newUpdate() *cobra.Command {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
check := root.ExactArgs(1)
|
check := root.ExactArgs(2)
|
||||||
return check(cmd, args)
|
return check(cmd, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -997,8 +1002,9 @@ func newUpdate() *cobra.Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateReq.Name = args[0]
|
||||||
if !cmd.Flags().Changed("json") {
|
if !cmd.Flags().Changed("json") {
|
||||||
updateReq.App.Name = args[0]
|
updateReq.App.Name = args[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
response, err := w.Apps.Update(ctx, updateReq)
|
response, err := w.Apps.Update(ctx, updateReq)
|
||||||
|
|
|
@ -164,15 +164,30 @@ func newCreateSchedule() *cobra.Command {
|
||||||
cmd.Flags().StringVar(&createScheduleReq.Schedule.ScheduleId, "schedule-id", createScheduleReq.Schedule.ScheduleId, `UUID identifying the schedule.`)
|
cmd.Flags().StringVar(&createScheduleReq.Schedule.ScheduleId, "schedule-id", createScheduleReq.Schedule.ScheduleId, `UUID identifying the schedule.`)
|
||||||
cmd.Flags().StringVar(&createScheduleReq.Schedule.UpdateTime, "update-time", createScheduleReq.Schedule.UpdateTime, `A timestamp indicating when the schedule was last updated.`)
|
cmd.Flags().StringVar(&createScheduleReq.Schedule.UpdateTime, "update-time", createScheduleReq.Schedule.UpdateTime, `A timestamp indicating when the schedule was last updated.`)
|
||||||
|
|
||||||
cmd.Use = "create-schedule"
|
cmd.Use = "create-schedule DASHBOARD_ID"
|
||||||
cmd.Short = `Create dashboard schedule.`
|
cmd.Short = `Create dashboard schedule.`
|
||||||
cmd.Long = `Create dashboard schedule.`
|
cmd.Long = `Create dashboard schedule.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
DASHBOARD_ID: UUID identifying the dashboard to which the schedule belongs.`
|
||||||
|
|
||||||
// This command is being previewed; hide from help output.
|
// This command is being previewed; hide from help output.
|
||||||
cmd.Hidden = true
|
cmd.Hidden = true
|
||||||
|
|
||||||
cmd.Annotations = make(map[string]string)
|
cmd.Annotations = make(map[string]string)
|
||||||
|
|
||||||
|
cmd.Args = func(cmd *cobra.Command, args []string) error {
|
||||||
|
if cmd.Flags().Changed("json") {
|
||||||
|
err := root.ExactArgs(0)(cmd, args)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cron_schedule' in your JSON input")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
check := root.ExactArgs(1)
|
||||||
|
return check(cmd, args)
|
||||||
|
}
|
||||||
|
|
||||||
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()
|
||||||
|
@ -190,6 +205,7 @@ func newCreateSchedule() *cobra.Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
createScheduleReq.DashboardId = args[0]
|
||||||
|
|
||||||
response, err := w.Lakeview.CreateSchedule(ctx, createScheduleReq)
|
response, err := w.Lakeview.CreateSchedule(ctx, createScheduleReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -237,15 +253,31 @@ func newCreateSubscription() *cobra.Command {
|
||||||
cmd.Flags().StringVar(&createSubscriptionReq.Subscription.SubscriptionId, "subscription-id", createSubscriptionReq.Subscription.SubscriptionId, `UUID identifying the subscription.`)
|
cmd.Flags().StringVar(&createSubscriptionReq.Subscription.SubscriptionId, "subscription-id", createSubscriptionReq.Subscription.SubscriptionId, `UUID identifying the subscription.`)
|
||||||
cmd.Flags().StringVar(&createSubscriptionReq.Subscription.UpdateTime, "update-time", createSubscriptionReq.Subscription.UpdateTime, `A timestamp indicating when the subscription was last updated.`)
|
cmd.Flags().StringVar(&createSubscriptionReq.Subscription.UpdateTime, "update-time", createSubscriptionReq.Subscription.UpdateTime, `A timestamp indicating when the subscription was last updated.`)
|
||||||
|
|
||||||
cmd.Use = "create-subscription"
|
cmd.Use = "create-subscription DASHBOARD_ID SCHEDULE_ID"
|
||||||
cmd.Short = `Create schedule subscription.`
|
cmd.Short = `Create schedule subscription.`
|
||||||
cmd.Long = `Create schedule subscription.`
|
cmd.Long = `Create schedule subscription.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
DASHBOARD_ID: UUID identifying the dashboard to which the subscription belongs.
|
||||||
|
SCHEDULE_ID: UUID identifying the schedule to which the subscription belongs.`
|
||||||
|
|
||||||
// This command is being previewed; hide from help output.
|
// This command is being previewed; hide from help output.
|
||||||
cmd.Hidden = true
|
cmd.Hidden = true
|
||||||
|
|
||||||
cmd.Annotations = make(map[string]string)
|
cmd.Annotations = make(map[string]string)
|
||||||
|
|
||||||
|
cmd.Args = func(cmd *cobra.Command, args []string) error {
|
||||||
|
if cmd.Flags().Changed("json") {
|
||||||
|
err := root.ExactArgs(0)(cmd, args)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'subscriber' in your JSON input")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
check := root.ExactArgs(2)
|
||||||
|
return check(cmd, args)
|
||||||
|
}
|
||||||
|
|
||||||
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()
|
||||||
|
@ -263,6 +295,8 @@ func newCreateSubscription() *cobra.Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
createSubscriptionReq.DashboardId = args[0]
|
||||||
|
createSubscriptionReq.ScheduleId = args[1]
|
||||||
|
|
||||||
response, err := w.Lakeview.CreateSubscription(ctx, createSubscriptionReq)
|
response, err := w.Lakeview.CreateSubscription(ctx, createSubscriptionReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1129,16 +1163,19 @@ func newUpdate() *cobra.Command {
|
||||||
cmd.Flags().StringVar(&updateReq.Dashboard.UpdateTime, "update-time", updateReq.Dashboard.UpdateTime, `The timestamp of when the dashboard was last updated by the user.`)
|
cmd.Flags().StringVar(&updateReq.Dashboard.UpdateTime, "update-time", updateReq.Dashboard.UpdateTime, `The timestamp of when the dashboard was last updated by the user.`)
|
||||||
cmd.Flags().StringVar(&updateReq.Dashboard.WarehouseId, "warehouse-id", updateReq.Dashboard.WarehouseId, `The warehouse ID used to run the dashboard.`)
|
cmd.Flags().StringVar(&updateReq.Dashboard.WarehouseId, "warehouse-id", updateReq.Dashboard.WarehouseId, `The warehouse ID used to run the dashboard.`)
|
||||||
|
|
||||||
cmd.Use = "update"
|
cmd.Use = "update DASHBOARD_ID"
|
||||||
cmd.Short = `Update dashboard.`
|
cmd.Short = `Update dashboard.`
|
||||||
cmd.Long = `Update dashboard.
|
cmd.Long = `Update dashboard.
|
||||||
|
|
||||||
Update a draft dashboard.`
|
Update a draft dashboard.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
DASHBOARD_ID: UUID identifying the dashboard.`
|
||||||
|
|
||||||
cmd.Annotations = make(map[string]string)
|
cmd.Annotations = make(map[string]string)
|
||||||
|
|
||||||
cmd.Args = func(cmd *cobra.Command, args []string) error {
|
cmd.Args = func(cmd *cobra.Command, args []string) error {
|
||||||
check := root.ExactArgs(0)
|
check := root.ExactArgs(1)
|
||||||
return check(cmd, args)
|
return check(cmd, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1159,6 +1196,7 @@ func newUpdate() *cobra.Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateReq.DashboardId = args[0]
|
||||||
|
|
||||||
response, err := w.Lakeview.Update(ctx, updateReq)
|
response, err := w.Lakeview.Update(ctx, updateReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1206,15 +1244,31 @@ func newUpdateSchedule() *cobra.Command {
|
||||||
cmd.Flags().StringVar(&updateScheduleReq.Schedule.ScheduleId, "schedule-id", updateScheduleReq.Schedule.ScheduleId, `UUID identifying the schedule.`)
|
cmd.Flags().StringVar(&updateScheduleReq.Schedule.ScheduleId, "schedule-id", updateScheduleReq.Schedule.ScheduleId, `UUID identifying the schedule.`)
|
||||||
cmd.Flags().StringVar(&updateScheduleReq.Schedule.UpdateTime, "update-time", updateScheduleReq.Schedule.UpdateTime, `A timestamp indicating when the schedule was last updated.`)
|
cmd.Flags().StringVar(&updateScheduleReq.Schedule.UpdateTime, "update-time", updateScheduleReq.Schedule.UpdateTime, `A timestamp indicating when the schedule was last updated.`)
|
||||||
|
|
||||||
cmd.Use = "update-schedule"
|
cmd.Use = "update-schedule DASHBOARD_ID SCHEDULE_ID"
|
||||||
cmd.Short = `Update dashboard schedule.`
|
cmd.Short = `Update dashboard schedule.`
|
||||||
cmd.Long = `Update dashboard schedule.`
|
cmd.Long = `Update dashboard schedule.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
DASHBOARD_ID: UUID identifying the dashboard to which the schedule belongs.
|
||||||
|
SCHEDULE_ID: UUID identifying the schedule.`
|
||||||
|
|
||||||
// This command is being previewed; hide from help output.
|
// This command is being previewed; hide from help output.
|
||||||
cmd.Hidden = true
|
cmd.Hidden = true
|
||||||
|
|
||||||
cmd.Annotations = make(map[string]string)
|
cmd.Annotations = make(map[string]string)
|
||||||
|
|
||||||
|
cmd.Args = func(cmd *cobra.Command, args []string) error {
|
||||||
|
if cmd.Flags().Changed("json") {
|
||||||
|
err := root.ExactArgs(0)(cmd, args)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'cron_schedule' in your JSON input")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
check := root.ExactArgs(2)
|
||||||
|
return check(cmd, args)
|
||||||
|
}
|
||||||
|
|
||||||
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()
|
||||||
|
@ -1232,6 +1286,8 @@ func newUpdateSchedule() *cobra.Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateScheduleReq.DashboardId = args[0]
|
||||||
|
updateScheduleReq.ScheduleId = args[1]
|
||||||
|
|
||||||
response, err := w.Lakeview.UpdateSchedule(ctx, updateScheduleReq)
|
response, err := w.Lakeview.UpdateSchedule(ctx, updateScheduleReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue