databricks-cli/cmd/account/settings/settings.go

259 lines
8.3 KiB
Go
Raw Normal View History

// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package settings
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/settings"
"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: "settings",
Short: `The Personal Compute enablement setting lets you control which users can use the Personal Compute default policy to create compute resources.`,
Long: `The Personal Compute enablement setting lets you control which users can use
Release v0.201.0 (#586) * Add development runs ([#522](https://github.com/databricks/cli/pull/522)). * Support tab completion for profiles ([#572](https://github.com/databricks/cli/pull/572)). * Correctly use --profile flag passed for all bundle commands ([#571](https://github.com/databricks/cli/pull/571)). * Disallow notebooks in paths where files are expected ([#573](https://github.com/databricks/cli/pull/573)). * Improve auth login experience ([#570](https://github.com/databricks/cli/pull/570)). * Remove base path checks during sync ([#576](https://github.com/databricks/cli/pull/576)). * First look for databricks.yml before falling back to bundle.yml ([#580](https://github.com/databricks/cli/pull/580)). * Integrate with auto-release infra ([#581](https://github.com/databricks/cli/pull/581)). API Changes: * Removed `databricks metastores maintenance` command. * Added `databricks metastores enable-optimization` command. * Added `databricks tables update` command. * Changed `databricks account settings delete-personal-compute-setting` command with new required argument order. * Changed `databricks account settings read-personal-compute-setting` command with new required argument order. * Added `databricks clean-rooms` command group. OpenAPI SHA: 850a075ed9758d21a6bc4409506b48c8b9f93ab4, Date: 2023-07-18 Dependency updates: * Bump golang.org/x/term from 0.9.0 to 0.10.0 ([#567](https://github.com/databricks/cli/pull/567)). * Bump golang.org/x/oauth2 from 0.9.0 to 0.10.0 ([#566](https://github.com/databricks/cli/pull/566)). * Bump golang.org/x/mod from 0.11.0 to 0.12.0 ([#568](https://github.com/databricks/cli/pull/568)). * Bump github.com/databricks/databricks-sdk-go from 0.12.0 to 0.13.0 ([#585](https://github.com/databricks/cli/pull/585)).
2023-07-18 17:13:48 +00:00
the Personal Compute default policy to create compute resources. By default
all users in all workspaces have access (ON), but you can change the setting
to instead let individual workspaces configure access control (DELEGATE).
There is only one instance of this setting per account. Since this setting has
a default value, this setting is present on all accounts even though it's
never set on a given account. Deletion reverts the value of the setting back
to the default value.`,
GroupID: "settings",
Annotations: map[string]string{
"package": "settings",
},
// This service is being previewed; hide from help output.
Hidden: true,
}
// Apply optional overrides to this command.
for _, fn := range cmdOverrides {
fn(cmd)
}
return cmd
}
// start delete-personal-compute-setting 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 deletePersonalComputeSettingOverrides []func(
*cobra.Command,
*settings.DeletePersonalComputeSettingRequest,
)
func newDeletePersonalComputeSetting() *cobra.Command {
cmd := &cobra.Command{}
var deletePersonalComputeSettingReq settings.DeletePersonalComputeSettingRequest
// TODO: short flags
cmd.Use = "delete-personal-compute-setting ETAG"
cmd.Short = `Delete Personal Compute setting.`
cmd.Long = `Delete Personal Compute setting.
Reverts back the Personal Compute setting value to default (ON)
Arguments:
ETAG: etag used for versioning. The response is at least as fresh as the eTag
provided. This is used for optimistic concurrency control as a way to help
prevent simultaneous writes of a setting overwriting each other. It is
strongly suggested that systems make use of the etag in the read -> delete
pattern to perform setting deletions in order to avoid race conditions.
That is, get an etag from a GET request, and pass it with the DELETE
request to identify the rule set version you are deleting.`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
Release v0.201.0 (#586) * Add development runs ([#522](https://github.com/databricks/cli/pull/522)). * Support tab completion for profiles ([#572](https://github.com/databricks/cli/pull/572)). * Correctly use --profile flag passed for all bundle commands ([#571](https://github.com/databricks/cli/pull/571)). * Disallow notebooks in paths where files are expected ([#573](https://github.com/databricks/cli/pull/573)). * Improve auth login experience ([#570](https://github.com/databricks/cli/pull/570)). * Remove base path checks during sync ([#576](https://github.com/databricks/cli/pull/576)). * First look for databricks.yml before falling back to bundle.yml ([#580](https://github.com/databricks/cli/pull/580)). * Integrate with auto-release infra ([#581](https://github.com/databricks/cli/pull/581)). API Changes: * Removed `databricks metastores maintenance` command. * Added `databricks metastores enable-optimization` command. * Added `databricks tables update` command. * Changed `databricks account settings delete-personal-compute-setting` command with new required argument order. * Changed `databricks account settings read-personal-compute-setting` command with new required argument order. * Added `databricks clean-rooms` command group. OpenAPI SHA: 850a075ed9758d21a6bc4409506b48c8b9f93ab4, Date: 2023-07-18 Dependency updates: * Bump golang.org/x/term from 0.9.0 to 0.10.0 ([#567](https://github.com/databricks/cli/pull/567)). * Bump golang.org/x/oauth2 from 0.9.0 to 0.10.0 ([#566](https://github.com/databricks/cli/pull/566)). * Bump golang.org/x/mod from 0.11.0 to 0.12.0 ([#568](https://github.com/databricks/cli/pull/568)). * Bump github.com/databricks/databricks-sdk-go from 0.12.0 to 0.13.0 ([#585](https://github.com/databricks/cli/pull/585)).
2023-07-18 17:13:48 +00:00
check := cobra.ExactArgs(1)
return check(cmd, args)
}
cmd.PreRunE = root.MustAccountClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
a := root.AccountClient(ctx)
Release v0.201.0 (#586) * Add development runs ([#522](https://github.com/databricks/cli/pull/522)). * Support tab completion for profiles ([#572](https://github.com/databricks/cli/pull/572)). * Correctly use --profile flag passed for all bundle commands ([#571](https://github.com/databricks/cli/pull/571)). * Disallow notebooks in paths where files are expected ([#573](https://github.com/databricks/cli/pull/573)). * Improve auth login experience ([#570](https://github.com/databricks/cli/pull/570)). * Remove base path checks during sync ([#576](https://github.com/databricks/cli/pull/576)). * First look for databricks.yml before falling back to bundle.yml ([#580](https://github.com/databricks/cli/pull/580)). * Integrate with auto-release infra ([#581](https://github.com/databricks/cli/pull/581)). API Changes: * Removed `databricks metastores maintenance` command. * Added `databricks metastores enable-optimization` command. * Added `databricks tables update` command. * Changed `databricks account settings delete-personal-compute-setting` command with new required argument order. * Changed `databricks account settings read-personal-compute-setting` command with new required argument order. * Added `databricks clean-rooms` command group. OpenAPI SHA: 850a075ed9758d21a6bc4409506b48c8b9f93ab4, Date: 2023-07-18 Dependency updates: * Bump golang.org/x/term from 0.9.0 to 0.10.0 ([#567](https://github.com/databricks/cli/pull/567)). * Bump golang.org/x/oauth2 from 0.9.0 to 0.10.0 ([#566](https://github.com/databricks/cli/pull/566)). * Bump golang.org/x/mod from 0.11.0 to 0.12.0 ([#568](https://github.com/databricks/cli/pull/568)). * Bump github.com/databricks/databricks-sdk-go from 0.12.0 to 0.13.0 ([#585](https://github.com/databricks/cli/pull/585)).
2023-07-18 17:13:48 +00:00
deletePersonalComputeSettingReq.Etag = args[0]
response, err := a.Settings.DeletePersonalComputeSetting(ctx, deletePersonalComputeSettingReq)
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 deletePersonalComputeSettingOverrides {
fn(cmd, &deletePersonalComputeSettingReq)
}
return cmd
}
func init() {
cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) {
cmd.AddCommand(newDeletePersonalComputeSetting())
})
}
// start read-personal-compute-setting 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 readPersonalComputeSettingOverrides []func(
*cobra.Command,
*settings.ReadPersonalComputeSettingRequest,
)
func newReadPersonalComputeSetting() *cobra.Command {
cmd := &cobra.Command{}
var readPersonalComputeSettingReq settings.ReadPersonalComputeSettingRequest
// TODO: short flags
cmd.Use = "read-personal-compute-setting ETAG"
cmd.Short = `Get Personal Compute setting.`
cmd.Long = `Get Personal Compute setting.
Gets the value of the Personal Compute setting.
Arguments:
ETAG: etag used for versioning. The response is at least as fresh as the eTag
provided. This is used for optimistic concurrency control as a way to help
prevent simultaneous writes of a setting overwriting each other. It is
strongly suggested that systems make use of the etag in the read -> delete
pattern to perform setting deletions in order to avoid race conditions.
That is, get an etag from a GET request, and pass it with the DELETE
request to identify the rule set version you are deleting.`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
Release v0.201.0 (#586) * Add development runs ([#522](https://github.com/databricks/cli/pull/522)). * Support tab completion for profiles ([#572](https://github.com/databricks/cli/pull/572)). * Correctly use --profile flag passed for all bundle commands ([#571](https://github.com/databricks/cli/pull/571)). * Disallow notebooks in paths where files are expected ([#573](https://github.com/databricks/cli/pull/573)). * Improve auth login experience ([#570](https://github.com/databricks/cli/pull/570)). * Remove base path checks during sync ([#576](https://github.com/databricks/cli/pull/576)). * First look for databricks.yml before falling back to bundle.yml ([#580](https://github.com/databricks/cli/pull/580)). * Integrate with auto-release infra ([#581](https://github.com/databricks/cli/pull/581)). API Changes: * Removed `databricks metastores maintenance` command. * Added `databricks metastores enable-optimization` command. * Added `databricks tables update` command. * Changed `databricks account settings delete-personal-compute-setting` command with new required argument order. * Changed `databricks account settings read-personal-compute-setting` command with new required argument order. * Added `databricks clean-rooms` command group. OpenAPI SHA: 850a075ed9758d21a6bc4409506b48c8b9f93ab4, Date: 2023-07-18 Dependency updates: * Bump golang.org/x/term from 0.9.0 to 0.10.0 ([#567](https://github.com/databricks/cli/pull/567)). * Bump golang.org/x/oauth2 from 0.9.0 to 0.10.0 ([#566](https://github.com/databricks/cli/pull/566)). * Bump golang.org/x/mod from 0.11.0 to 0.12.0 ([#568](https://github.com/databricks/cli/pull/568)). * Bump github.com/databricks/databricks-sdk-go from 0.12.0 to 0.13.0 ([#585](https://github.com/databricks/cli/pull/585)).
2023-07-18 17:13:48 +00:00
check := cobra.ExactArgs(1)
return check(cmd, args)
}
cmd.PreRunE = root.MustAccountClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
a := root.AccountClient(ctx)
Release v0.201.0 (#586) * Add development runs ([#522](https://github.com/databricks/cli/pull/522)). * Support tab completion for profiles ([#572](https://github.com/databricks/cli/pull/572)). * Correctly use --profile flag passed for all bundle commands ([#571](https://github.com/databricks/cli/pull/571)). * Disallow notebooks in paths where files are expected ([#573](https://github.com/databricks/cli/pull/573)). * Improve auth login experience ([#570](https://github.com/databricks/cli/pull/570)). * Remove base path checks during sync ([#576](https://github.com/databricks/cli/pull/576)). * First look for databricks.yml before falling back to bundle.yml ([#580](https://github.com/databricks/cli/pull/580)). * Integrate with auto-release infra ([#581](https://github.com/databricks/cli/pull/581)). API Changes: * Removed `databricks metastores maintenance` command. * Added `databricks metastores enable-optimization` command. * Added `databricks tables update` command. * Changed `databricks account settings delete-personal-compute-setting` command with new required argument order. * Changed `databricks account settings read-personal-compute-setting` command with new required argument order. * Added `databricks clean-rooms` command group. OpenAPI SHA: 850a075ed9758d21a6bc4409506b48c8b9f93ab4, Date: 2023-07-18 Dependency updates: * Bump golang.org/x/term from 0.9.0 to 0.10.0 ([#567](https://github.com/databricks/cli/pull/567)). * Bump golang.org/x/oauth2 from 0.9.0 to 0.10.0 ([#566](https://github.com/databricks/cli/pull/566)). * Bump golang.org/x/mod from 0.11.0 to 0.12.0 ([#568](https://github.com/databricks/cli/pull/568)). * Bump github.com/databricks/databricks-sdk-go from 0.12.0 to 0.13.0 ([#585](https://github.com/databricks/cli/pull/585)).
2023-07-18 17:13:48 +00:00
readPersonalComputeSettingReq.Etag = args[0]
response, err := a.Settings.ReadPersonalComputeSetting(ctx, readPersonalComputeSettingReq)
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 readPersonalComputeSettingOverrides {
fn(cmd, &readPersonalComputeSettingReq)
}
return cmd
}
func init() {
cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) {
cmd.AddCommand(newReadPersonalComputeSetting())
})
}
// start update-personal-compute-setting 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 updatePersonalComputeSettingOverrides []func(
*cobra.Command,
*settings.UpdatePersonalComputeSettingRequest,
)
func newUpdatePersonalComputeSetting() *cobra.Command {
cmd := &cobra.Command{}
var updatePersonalComputeSettingReq settings.UpdatePersonalComputeSettingRequest
var updatePersonalComputeSettingJson flags.JsonFlag
// TODO: short flags
cmd.Flags().Var(&updatePersonalComputeSettingJson, "json", `either inline JSON string or @path/to/file.json with request body`)
cmd.Flags().BoolVar(&updatePersonalComputeSettingReq.AllowMissing, "allow-missing", updatePersonalComputeSettingReq.AllowMissing, `This should always be set to true for Settings RPCs.`)
// TODO: complex arg: setting
cmd.Use = "update-personal-compute-setting"
cmd.Short = `Update Personal Compute setting.`
cmd.Long = `Update Personal Compute setting.
Updates the value of the Personal Compute setting.`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0)
return check(cmd, args)
}
cmd.PreRunE = root.MustAccountClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
a := root.AccountClient(ctx)
if cmd.Flags().Changed("json") {
err = updatePersonalComputeSettingJson.Unmarshal(&updatePersonalComputeSettingReq)
if err != nil {
return err
}
}
response, err := a.Settings.UpdatePersonalComputeSetting(ctx, updatePersonalComputeSettingReq)
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 updatePersonalComputeSettingOverrides {
fn(cmd, &updatePersonalComputeSettingReq)
}
return cmd
}
func init() {
cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) {
cmd.AddCommand(newUpdatePersonalComputeSetting())
})
}
// end service AccountSettings