databricks-cli/cmd/workspace/provider-provider-analytics.../provider-provider-analytics...

241 lines
6.5 KiB
Go
Executable File

// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package provider_provider_analytics_dashboards
import (
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/marketplace"
"github.com/spf13/cobra"
)
// Slice with functions to override default command behavior.
// Functions can be added from the `init()` function in manually curated files in this directory.
var cmdOverrides []func(*cobra.Command)
func New() *cobra.Command {
cmd := &cobra.Command{
Use: "provider-provider-analytics-dashboards",
Short: `Manage templated analytics solution for providers.`,
Long: `Manage templated analytics solution for providers.`,
GroupID: "marketplace",
Annotations: map[string]string{
"package": "marketplace",
},
// This service is being previewed; hide from help output.
Hidden: true,
}
// Add methods
cmd.AddCommand(newCreate())
cmd.AddCommand(newGet())
cmd.AddCommand(newGetLatestVersion())
cmd.AddCommand(newUpdate())
// Apply optional overrides to this command.
for _, fn := range cmdOverrides {
fn(cmd)
}
return cmd
}
// start create command
// Slice with functions to override default command behavior.
// Functions can be added from the `init()` function in manually curated files in this directory.
var createOverrides []func(
*cobra.Command,
)
func newCreate() *cobra.Command {
cmd := &cobra.Command{}
cmd.Use = "create"
cmd.Short = `Create provider analytics dashboard.`
cmd.Long = `Create provider analytics dashboard.
Create provider analytics dashboard. Returns Marketplace specific id. Not to
be confused with the Lakeview dashboard id.`
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := root.WorkspaceClient(ctx)
response, err := w.ProviderProviderAnalyticsDashboards.Create(ctx)
if err != nil {
return err
}
return cmdio.Render(ctx, response)
}
// Disable completions since they are not applicable.
// Can be overridden by manual implementation in `override.go`.
cmd.ValidArgsFunction = cobra.NoFileCompletions
// Apply optional overrides to this command.
for _, fn := range createOverrides {
fn(cmd)
}
return cmd
}
// start get command
// Slice with functions to override default command behavior.
// Functions can be added from the `init()` function in manually curated files in this directory.
var getOverrides []func(
*cobra.Command,
)
func newGet() *cobra.Command {
cmd := &cobra.Command{}
cmd.Use = "get"
cmd.Short = `Get provider analytics dashboard.`
cmd.Long = `Get provider analytics dashboard.
Get provider analytics dashboard.`
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := root.WorkspaceClient(ctx)
response, err := w.ProviderProviderAnalyticsDashboards.Get(ctx)
if err != nil {
return err
}
return cmdio.Render(ctx, response)
}
// Disable completions since they are not applicable.
// Can be overridden by manual implementation in `override.go`.
cmd.ValidArgsFunction = cobra.NoFileCompletions
// Apply optional overrides to this command.
for _, fn := range getOverrides {
fn(cmd)
}
return cmd
}
// start get-latest-version command
// Slice with functions to override default command behavior.
// Functions can be added from the `init()` function in manually curated files in this directory.
var getLatestVersionOverrides []func(
*cobra.Command,
)
func newGetLatestVersion() *cobra.Command {
cmd := &cobra.Command{}
cmd.Use = "get-latest-version"
cmd.Short = `Get latest version of provider analytics dashboard.`
cmd.Long = `Get latest version of provider analytics dashboard.
Get latest version of provider analytics dashboard.`
cmd.Annotations = make(map[string]string)
cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := root.WorkspaceClient(ctx)
response, err := w.ProviderProviderAnalyticsDashboards.GetLatestVersion(ctx)
if err != nil {
return err
}
return cmdio.Render(ctx, response)
}
// Disable completions since they are not applicable.
// Can be overridden by manual implementation in `override.go`.
cmd.ValidArgsFunction = cobra.NoFileCompletions
// Apply optional overrides to this command.
for _, fn := range getLatestVersionOverrides {
fn(cmd)
}
return cmd
}
// start update command
// Slice with functions to override default command behavior.
// Functions can be added from the `init()` function in manually curated files in this directory.
var updateOverrides []func(
*cobra.Command,
*marketplace.UpdateProviderAnalyticsDashboardRequest,
)
func newUpdate() *cobra.Command {
cmd := &cobra.Command{}
var updateReq marketplace.UpdateProviderAnalyticsDashboardRequest
var updateJson flags.JsonFlag
// TODO: short flags
cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
cmd.Flags().Int64Var(&updateReq.Version, "version", updateReq.Version, `this is the version of the dashboard template we want to update our user to current expectation is that it should be equal to latest version of the dashboard template.`)
cmd.Use = "update ID"
cmd.Short = `Update provider analytics dashboard.`
cmd.Long = `Update provider analytics dashboard.
Update provider analytics dashboard.
Arguments:
ID: id is immutable property and can't be updated.`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := root.ExactArgs(1)
return check(cmd, args)
}
cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := root.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq)
if err != nil {
return err
}
}
updateReq.Id = args[0]
response, err := w.ProviderProviderAnalyticsDashboards.Update(ctx, updateReq)
if err != nil {
return err
}
return cmdio.Render(ctx, response)
}
// Disable completions since they are not applicable.
// Can be overridden by manual implementation in `override.go`.
cmd.ValidArgsFunction = cobra.NoFileCompletions
// Apply optional overrides to this command.
for _, fn := range updateOverrides {
fn(cmd, &updateReq)
}
return cmd
}
// end service ProviderProviderAnalyticsDashboards