Bump github.com/databricks/databricks-sdk-go from 0.9.1-0.20230614092458-b5bbc1c8dabb to 0.10.0 (#497)

This commit is contained in:
dependabot[bot] 2023-06-21 07:43:07 +00:00 committed by GitHub
parent d11128c638
commit 7fb34e4767
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 87 additions and 102 deletions

View File

@ -48,7 +48,7 @@ func (m *upload) Apply(ctx context.Context, b *bundle.Bundle) error {
err = b.WorkspaceClient().Workspace.Import(ctx, workspace.Import{
Path: artifact.RemotePath,
Overwrite: true,
Format: workspace.ExportFormatSource,
Format: workspace.ImportFormatSource,
Language: artifact.Language,
Content: base64.StdEncoding.EncodeToString(raw),
})

View File

@ -21,25 +21,75 @@ var Cmd = &cobra.Command{
Annotations: map[string]string{
"package": "iam",
},
// This service is being previewed; hide from help output.
Hidden: true,
}
// start get command
// start get-assignable-roles-for-resource command
var getReq iam.GetAccountAccessControlRequest
var getJson flags.JsonFlag
var getAssignableRolesForResourceReq iam.GetAssignableRolesForResourceRequest
var getAssignableRolesForResourceJson flags.JsonFlag
func init() {
Cmd.AddCommand(getCmd)
Cmd.AddCommand(getAssignableRolesForResourceCmd)
// TODO: short flags
getCmd.Flags().Var(&getJson, "json", `either inline JSON string or @path/to/file.json with request body`)
getAssignableRolesForResourceCmd.Flags().Var(&getAssignableRolesForResourceJson, "json", `either inline JSON string or @path/to/file.json with request body`)
}
var getCmd = &cobra.Command{
Use: "get NAME ETAG",
var getAssignableRolesForResourceCmd = &cobra.Command{
Use: "get-assignable-roles-for-resource RESOURCE",
Short: `Get assignable roles for a resource.`,
Long: `Get assignable roles for a resource.
Gets all the roles that can be granted on an account level resource. A role is
grantable if the rule set on the resource can contain an access rule of the
role.`,
Annotations: map[string]string{},
Args: func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1)
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)
if cmd.Flags().Changed("json") {
err = getAssignableRolesForResourceJson.Unmarshal(&getAssignableRolesForResourceReq)
if err != nil {
return err
}
} else {
getAssignableRolesForResourceReq.Resource = args[0]
}
response, err := a.AccessControl.GetAssignableRolesForResource(ctx, getAssignableRolesForResourceReq)
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,
}
// start get-rule-set command
var getRuleSetReq iam.GetRuleSetRequest
var getRuleSetJson flags.JsonFlag
func init() {
Cmd.AddCommand(getRuleSetCmd)
// TODO: short flags
getRuleSetCmd.Flags().Var(&getRuleSetJson, "json", `either inline JSON string or @path/to/file.json with request body`)
}
var getRuleSetCmd = &cobra.Command{
Use: "get-rule-set NAME ETAG",
Short: `Get a rule set.`,
Long: `Get a rule set.
@ -60,16 +110,16 @@ var getCmd = &cobra.Command{
ctx := cmd.Context()
a := root.AccountClient(ctx)
if cmd.Flags().Changed("json") {
err = getJson.Unmarshal(&getReq)
err = getRuleSetJson.Unmarshal(&getRuleSetReq)
if err != nil {
return err
}
} else {
getReq.Name = args[0]
getReq.Etag = args[1]
getRuleSetReq.Name = args[0]
getRuleSetReq.Etag = args[1]
}
response, err := a.AccessControl.Get(ctx, getReq)
response, err := a.AccessControl.GetRuleSet(ctx, getRuleSetReq)
if err != nil {
return err
}
@ -80,73 +130,20 @@ var getCmd = &cobra.Command{
ValidArgsFunction: cobra.NoFileCompletions,
}
// start list command
// start update-rule-set command
var listReq iam.ListAccountAccessControlRequest
var listJson flags.JsonFlag
var updateRuleSetReq iam.UpdateRuleSetRequest
var updateRuleSetJson flags.JsonFlag
func init() {
Cmd.AddCommand(listCmd)
Cmd.AddCommand(updateRuleSetCmd)
// TODO: short flags
listCmd.Flags().Var(&listJson, "json", `either inline JSON string or @path/to/file.json with request body`)
updateRuleSetCmd.Flags().Var(&updateRuleSetJson, "json", `either inline JSON string or @path/to/file.json with request body`)
}
var listCmd = &cobra.Command{
Use: "list NAME",
Short: `List assignable roles on a resource.`,
Long: `List assignable roles on a resource.
Gets all the roles that can be granted on an account level resource. A role is
grantable if the rule set on the resource can contain an access rule of the
role.`,
Annotations: map[string]string{},
Args: func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1)
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)
if cmd.Flags().Changed("json") {
err = listJson.Unmarshal(&listReq)
if err != nil {
return err
}
} else {
listReq.Name = args[0]
}
response, err := a.AccessControl.List(ctx, listReq)
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,
}
// start update command
var updateReq iam.UpdateRuleSetRequest
var updateJson flags.JsonFlag
func init() {
Cmd.AddCommand(updateCmd)
// TODO: short flags
updateCmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
}
var updateCmd = &cobra.Command{
Use: "update",
var updateRuleSetCmd = &cobra.Command{
Use: "update-rule-set",
Short: `Update a rule set.`,
Long: `Update a rule set.
@ -160,20 +157,15 @@ var updateCmd = &cobra.Command{
ctx := cmd.Context()
a := root.AccountClient(ctx)
if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq)
err = updateRuleSetJson.Unmarshal(&updateRuleSetReq)
if err != nil {
return err
}
} else {
updateReq.Name = args[0]
_, err = fmt.Sscan(args[1], &updateReq.RuleSet)
if err != nil {
return fmt.Errorf("invalid RULE_SET: %s", args[1])
}
updateReq.Etag = args[2]
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
}
response, err := a.AccessControl.Update(ctx, updateReq)
response, err := a.AccessControl.UpdateRuleSet(ctx, updateRuleSetReq)
if err != nil {
return err
}

View File

@ -295,11 +295,11 @@ var updateCmd = &cobra.Command{
updateReq.MetastoreId = args[1]
}
response, err := a.MetastoreAssignments.Update(ctx, updateReq)
err = a.MetastoreAssignments.Update(ctx, updateReq)
if err != nil {
return err
}
return cmdio.Render(ctx, response)
return nil
},
// Disable completions since they are not applicable.
// Can be overridden by manual implementation in `override.go`.

View File

@ -53,7 +53,6 @@ func init() {
// TODO: map via StringToStringVar: custom_tags
// TODO: complex arg: disk_spec
createCmd.Flags().BoolVar(&createReq.EnableElasticDisk, "enable-elastic-disk", createReq.EnableElasticDisk, `Autoscaling Local Storage: when enabled, this instances in this pool will dynamically acquire additional disk space when its Spark workers are running low on disk space.`)
// TODO: complex arg: gcp_attributes
createCmd.Flags().IntVar(&createReq.IdleInstanceAutoterminationMinutes, "idle-instance-autotermination-minutes", createReq.IdleInstanceAutoterminationMinutes, `Automatically terminates the extra instances in the pool cache after they are inactive for this time in minutes if min_idle_instances requirement is already met.`)
// TODO: complex arg: instance_pool_fleet_attributes
createCmd.Flags().IntVar(&createReq.MaxCapacity, "max-capacity", createReq.MaxCapacity, `Maximum number of outstanding instances to keep in the pool, including both instances used by clusters and idle instances.`)
@ -180,7 +179,6 @@ func init() {
// TODO: map via StringToStringVar: custom_tags
// TODO: complex arg: disk_spec
editCmd.Flags().BoolVar(&editReq.EnableElasticDisk, "enable-elastic-disk", editReq.EnableElasticDisk, `Autoscaling Local Storage: when enabled, this instances in this pool will dynamically acquire additional disk space when its Spark workers are running low on disk space.`)
// TODO: complex arg: gcp_attributes
editCmd.Flags().IntVar(&editReq.IdleInstanceAutoterminationMinutes, "idle-instance-autotermination-minutes", editReq.IdleInstanceAutoterminationMinutes, `Automatically terminates the extra instances in the pool cache after they are inactive for this time in minutes if min_idle_instances requirement is already met.`)
// TODO: complex arg: instance_pool_fleet_attributes
editCmd.Flags().IntVar(&editReq.MaxCapacity, "max-capacity", editReq.MaxCapacity, `Maximum number of outstanding instances to keep in the pool, including both instances used by clusters and idle instances.`)

View File

@ -312,7 +312,7 @@ var listSharesCmd = &cobra.Command{
listSharesReq.Name = args[0]
}
response, err := w.Providers.ListShares(ctx, listSharesReq)
response, err := w.Providers.ListSharesAll(ctx, listSharesReq)
if err != nil {
return err
}

View File

@ -42,8 +42,8 @@ func init() {
// TODO: short flags
createScopeCmd.Flags().Var(&createScopeJson, "json", `either inline JSON string or @path/to/file.json with request body`)
// TODO: complex arg: backend_azure_keyvault
createScopeCmd.Flags().StringVar(&createScopeReq.InitialManagePrincipal, "initial-manage-principal", createScopeReq.InitialManagePrincipal, `The principal that is initially granted MANAGE permission to the created scope.`)
// TODO: complex arg: keyvault_metadata
createScopeCmd.Flags().Var(&createScopeReq.ScopeBackendType, "scope-backend-type", `The backend type the scope will be created with.`)
}
@ -502,9 +502,9 @@ var putAclCmd = &cobra.Command{
Throws RESOURCE_DOES_NOT_EXIST if no such secret scope exists. Throws
RESOURCE_ALREADY_EXISTS if a permission for the principal already exists.
Throws INVALID_PARAMETER_VALUE if the permission or principal is invalid.
Throws PERMISSION_DENIED if the user does not have permission to make this
API call.`,
Throws INVALID_PARAMETER_VALUE if the permission is invalid. Throws
PERMISSION_DENIED if the user does not have permission to make this API
call.`,
Annotations: map[string]string{},
Args: func(cmd *cobra.Command, args []string) error {

View File

@ -3,8 +3,6 @@
package system_schemas
import (
"fmt"
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/flags"
@ -65,10 +63,7 @@ var disableCmd = &cobra.Command{
}
} else {
disableReq.MetastoreId = args[0]
_, err = fmt.Sscan(args[1], &disableReq.SchemaName)
if err != nil {
return fmt.Errorf("invalid SCHEMA_NAME: %s", args[1])
}
disableReq.SchemaName = args[1]
}
err = w.SystemSchemas.Disable(ctx, disableReq)

View File

@ -287,7 +287,7 @@ var listSummariesCmd = &cobra.Command{
listSummariesReq.CatalogName = args[0]
}
response, err := w.Tables.ListSummaries(ctx, listSummariesReq)
response, err := w.Tables.ListSummariesAll(ctx, listSummariesReq)
if err != nil {
return err
}

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.18
require (
github.com/briandowns/spinner v1.23.0 // Apache 2.0
github.com/databricks/databricks-sdk-go v0.9.1-0.20230614092458-b5bbc1c8dabb // Apache 2.0
github.com/databricks/databricks-sdk-go v0.10.0 // Apache 2.0
github.com/fatih/color v1.15.0 // MIT
github.com/ghodss/yaml v1.0.0 // MIT + NOTICE
github.com/google/uuid v1.3.0 // BSD-3-Clause

4
go.sum
View File

@ -34,8 +34,8 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/databricks/databricks-sdk-go v0.9.1-0.20230614092458-b5bbc1c8dabb h1:M4TAWTG9Cg205GQn84azS+jZIkE6eNdcGr04ZeBqQLA=
github.com/databricks/databricks-sdk-go v0.9.1-0.20230614092458-b5bbc1c8dabb/go.mod h1:KGnka35+ywspOGF6/t3okMzPZXLgLJtEIzAHWXy/eSg=
github.com/databricks/databricks-sdk-go v0.10.0 h1:sRPalhXBURnAYR0zC5emloux8XtwATzHLT98iQO732s=
github.com/databricks/databricks-sdk-go v0.10.0/go.mod h1:Ud9bmbMeVtus+CnFYeThHwav2kgdDZOqVV79Gd9qXt0=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=