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"
)
var Cmd = & cobra . Command {
Use : "settings" ,
2023-07-18 17:13:48 +00:00
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
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-06-13 15:20:42 +00:00
Annotations : map [ string ] string {
"package" : "settings" ,
} ,
2023-07-03 09:46:45 +00:00
// This service is being previewed; hide from help output.
Hidden : true ,
}
// start delete-personal-compute-setting command
var deletePersonalComputeSettingReq settings . DeletePersonalComputeSettingRequest
func init ( ) {
Cmd . AddCommand ( deletePersonalComputeSettingCmd )
// TODO: short flags
}
var deletePersonalComputeSettingCmd = & cobra . Command {
2023-07-18 17:13:48 +00:00
Use : "delete-personal-compute-setting ETAG" ,
2023-07-03 09:46:45 +00:00
Short : ` Delete Personal Compute setting. ` ,
Long : ` Delete Personal Compute setting .
2023-07-18 17:13:48 +00:00
Reverts back the Personal Compute setting value to default ( ON ) ` ,
2023-07-03 09:46:45 +00:00
Annotations : map [ string ] string { } ,
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 )
} ,
PreRunE : root . MustAccountClient ,
RunE : func ( cmd * cobra . Command , args [ ] string ) ( err error ) {
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 )
} ,
// Disable completions since they are not applicable.
// Can be overridden by manual implementation in `override.go`.
ValidArgsFunction : cobra . NoFileCompletions ,
2023-06-12 12:23:21 +00:00
}
// start read-personal-compute-setting command
var readPersonalComputeSettingReq settings . ReadPersonalComputeSettingRequest
func init ( ) {
Cmd . AddCommand ( readPersonalComputeSettingCmd )
// TODO: short flags
}
var readPersonalComputeSettingCmd = & cobra . Command {
2023-07-18 17:13:48 +00:00
Use : "read-personal-compute-setting ETAG" ,
2023-06-12 12:23:21 +00:00
Short : ` Get Personal Compute setting. ` ,
Long : ` Get Personal Compute setting .
2023-07-18 17:13:48 +00:00
Gets the value of the Personal Compute setting . ` ,
2023-06-12 12:23:21 +00:00
Annotations : map [ string ] string { } ,
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 )
} ,
PreRunE : root . MustAccountClient ,
RunE : func ( cmd * cobra . Command , args [ ] string ) ( err error ) {
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-06-15 14:56:36 +00:00
// Disable completions since they are not applicable.
// Can be overridden by manual implementation in `override.go`.
ValidArgsFunction : cobra . NoFileCompletions ,
2023-06-12 12:23:21 +00:00
}
2023-07-03 09:46:45 +00:00
// start update-personal-compute-setting command
var updatePersonalComputeSettingReq settings . UpdatePersonalComputeSettingRequest
var updatePersonalComputeSettingJson flags . JsonFlag
func init ( ) {
Cmd . AddCommand ( updatePersonalComputeSettingCmd )
// TODO: short flags
updatePersonalComputeSettingCmd . Flags ( ) . Var ( & updatePersonalComputeSettingJson , "json" , ` either inline JSON string or @path/to/file.json with request body ` )
2023-07-18 17:13:48 +00:00
updatePersonalComputeSettingCmd . 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
}
var updatePersonalComputeSettingCmd = & cobra . Command {
Use : "update-personal-compute-setting" ,
Short : ` Update Personal Compute setting. ` ,
Long : ` Update Personal Compute setting .
2023-07-18 17:13:48 +00:00
Updates the value of the Personal Compute setting . ` ,
2023-07-03 09:46:45 +00:00
Annotations : map [ string ] string { } ,
Args : func ( cmd * cobra . Command , args [ ] string ) error {
check := cobra . ExactArgs ( 0 )
if cmd . Flags ( ) . Changed ( "json" ) {
check = cobra . ExactArgs ( 0 )
}
return check ( cmd , args )
} ,
PreRunE : root . MustAccountClient ,
RunE : func ( cmd * cobra . Command , args [ ] string ) ( err error ) {
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
}
} else {
}
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`.
ValidArgsFunction : cobra . NoFileCompletions ,
}
2023-06-12 12:23:21 +00:00
// end service AccountSettings