2023-06-12 12:23:21 +00:00
// 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"
)
2023-07-25 18:19:07 +00:00
// 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
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 . ` ,
2023-07-25 18:19:07 +00:00
GroupID : "settings" ,
Annotations : map [ string ] string {
"package" : "settings" ,
} ,
2023-07-03 09:46:45 +00:00
2023-07-25 18:19:07 +00:00
// 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
2023-07-03 09:46:45 +00:00
}
// start delete-personal-compute-setting command
2023-07-25 18:19:07 +00:00
// 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 ,
)
2023-07-03 09:46:45 +00:00
2023-07-25 18:19:07 +00:00
func newDeletePersonalComputeSetting ( ) * cobra . Command {
cmd := & cobra . Command { }
2023-07-03 09:46:45 +00:00
2023-07-25 18:19:07 +00:00
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 .
2023-07-03 09:46:45 +00:00
2023-11-30 16:22:23 +00:00
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 . `
2023-07-03 09:46:45 +00:00
2023-07-25 18:19:07 +00:00
cmd . Annotations = make ( map [ string ] string )
cmd . Args = func ( cmd * cobra . Command , args [ ] string ) error {
2023-07-18 17:13:48 +00:00
check := cobra . ExactArgs ( 1 )
2023-07-03 09:46:45 +00:00
return check ( cmd , args )
2023-07-25 18:19:07 +00:00
}
cmd . PreRunE = root . MustAccountClient
cmd . RunE = func ( cmd * cobra . Command , args [ ] string ) ( err error ) {
2023-07-03 09:46:45 +00:00
ctx := cmd . Context ( )
a := root . AccountClient ( ctx )
2023-07-03 11:20:30 +00:00
2023-07-18 17:13:48 +00:00
deletePersonalComputeSettingReq . Etag = args [ 0 ]
2023-07-03 09:46:45 +00:00
response , err := a . Settings . DeletePersonalComputeSetting ( ctx , deletePersonalComputeSettingReq )
if err != nil {
return err
}
return cmdio . Render ( ctx , response )
2023-07-25 18:19:07 +00:00
}
2023-07-03 09:46:45 +00:00
// Disable completions since they are not applicable.
// Can be overridden by manual implementation in `override.go`.
2023-07-25 18:19:07 +00:00
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 ( ) )
} )
2023-06-12 12:23:21 +00:00
}
// start read-personal-compute-setting command
2023-07-25 18:19:07 +00:00
// 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 ,
)
2023-06-12 12:23:21 +00:00
2023-07-25 18:19:07 +00:00
func newReadPersonalComputeSetting ( ) * cobra . Command {
cmd := & cobra . Command { }
var readPersonalComputeSettingReq settings . ReadPersonalComputeSettingRequest
// TODO: short flags
2023-06-12 12:23:21 +00:00
2023-07-25 18:19:07 +00:00
cmd . Use = "read-personal-compute-setting ETAG"
cmd . Short = ` Get Personal Compute setting. `
cmd . Long = ` Get Personal Compute setting .
2023-06-12 12:23:21 +00:00
2023-11-30 16:22:23 +00:00
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 . `
2023-06-12 12:23:21 +00:00
2023-07-25 18:19:07 +00:00
cmd . Annotations = make ( map [ string ] string )
cmd . Args = func ( cmd * cobra . Command , args [ ] string ) error {
2023-07-18 17:13:48 +00:00
check := cobra . ExactArgs ( 1 )
2023-06-12 12:23:21 +00:00
return check ( cmd , args )
2023-07-25 18:19:07 +00:00
}
cmd . PreRunE = root . MustAccountClient
cmd . RunE = func ( cmd * cobra . Command , args [ ] string ) ( err error ) {
2023-06-12 12:23:21 +00:00
ctx := cmd . Context ( )
a := root . AccountClient ( ctx )
2023-07-03 11:20:30 +00:00
2023-07-18 17:13:48 +00:00
readPersonalComputeSettingReq . Etag = args [ 0 ]
2023-06-12 12:23:21 +00:00
response , err := a . Settings . ReadPersonalComputeSetting ( ctx , readPersonalComputeSettingReq )
if err != nil {
return err
}
return cmdio . Render ( ctx , response )
2023-07-25 18:19:07 +00:00
}
2023-06-15 14:56:36 +00:00
// Disable completions since they are not applicable.
// Can be overridden by manual implementation in `override.go`.
2023-07-25 18:19:07 +00:00
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 ( ) )
} )
2023-06-12 12:23:21 +00:00
}
2023-07-03 09:46:45 +00:00
// start update-personal-compute-setting command
2023-07-25 18:19:07 +00:00
// 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
2023-07-03 09:46:45 +00:00
// TODO: short flags
2023-07-25 18:19:07 +00:00
cmd . Flags ( ) . Var ( & updatePersonalComputeSettingJson , "json" , ` either inline JSON string or @path/to/file.json with request body ` )
2023-07-03 09:46:45 +00:00
2023-07-25 18:19:07 +00:00
cmd . Flags ( ) . BoolVar ( & updatePersonalComputeSettingReq . AllowMissing , "allow-missing" , updatePersonalComputeSettingReq . AllowMissing , ` This should always be set to true for Settings RPCs. ` )
2023-07-03 09:46:45 +00:00
// TODO: complex arg: setting
2023-07-25 18:19:07 +00:00
cmd . Use = "update-personal-compute-setting"
cmd . Short = ` Update Personal Compute setting. `
cmd . Long = ` Update Personal Compute setting .
2023-07-03 09:46:45 +00:00
2023-07-25 18:19:07 +00:00
Updates the value of the Personal Compute setting . `
2023-07-03 09:46:45 +00:00
2023-07-25 18:19:07 +00:00
cmd . Annotations = make ( map [ string ] string )
cmd . Args = func ( cmd * cobra . Command , args [ ] string ) error {
2023-07-03 09:46:45 +00:00
check := cobra . ExactArgs ( 0 )
return check ( cmd , args )
2023-07-25 18:19:07 +00:00
}
cmd . PreRunE = root . MustAccountClient
cmd . RunE = func ( cmd * cobra . Command , args [ ] string ) ( err error ) {
2023-07-03 09:46:45 +00:00
ctx := cmd . Context ( )
a := root . AccountClient ( ctx )
2023-07-03 11:20:30 +00:00
2023-07-03 09:46:45 +00:00
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 )
2023-07-25 18:19:07 +00:00
}
2023-07-03 09:46:45 +00:00
// Disable completions since they are not applicable.
// Can be overridden by manual implementation in `override.go`.
2023-07-25 18:19:07 +00:00
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 ( ) )
} )
2023-07-03 09:46:45 +00:00
}
2023-06-12 12:23:21 +00:00
// end service AccountSettings