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)).
This commit is contained in:
Serge Smertin 2023-07-18 19:13:48 +02:00 committed by GitHub
parent ff98096208
commit acf292da37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 482 additions and 174 deletions

1
.codegen/_openapi_sha Normal file
View File

@ -0,0 +1 @@
850a075ed9758d21a6bc4409506b48c8b9f93ab4

1
.gitattributes vendored
View File

@ -25,6 +25,7 @@ cmd/account/workspace-assignment/workspace-assignment.go linguist-generated=true
cmd/account/workspaces/workspaces.go linguist-generated=true cmd/account/workspaces/workspaces.go linguist-generated=true
cmd/workspace/alerts/alerts.go linguist-generated=true cmd/workspace/alerts/alerts.go linguist-generated=true
cmd/workspace/catalogs/catalogs.go linguist-generated=true cmd/workspace/catalogs/catalogs.go linguist-generated=true
cmd/workspace/clean-rooms/clean-rooms.go linguist-generated=true
cmd/workspace/cluster-policies/cluster-policies.go linguist-generated=true cmd/workspace/cluster-policies/cluster-policies.go linguist-generated=true
cmd/workspace/clusters/clusters.go linguist-generated=true cmd/workspace/clusters/clusters.go linguist-generated=true
cmd/workspace/cmd.go linguist-generated=true cmd/workspace/cmd.go linguist-generated=true

View File

@ -1,5 +1,33 @@
# Version changelog # Version changelog
## 0.201.0
* 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)).
## 0.200.2 ## 0.200.2
CLI: CLI:

View File

@ -258,7 +258,8 @@ func init() {
// TODO: short flags // TODO: short flags
patchCmd.Flags().Var(&patchJson, "json", `either inline JSON string or @path/to/file.json with request body`) patchCmd.Flags().Var(&patchJson, "json", `either inline JSON string or @path/to/file.json with request body`)
// TODO: array: operations // TODO: array: Operations
// TODO: array: schema
} }

View File

@ -80,6 +80,8 @@ func init() {
Cmd.AddCommand(deleteCmd) Cmd.AddCommand(deleteCmd)
// TODO: short flags // TODO: short flags
deleteCmd.Flags().BoolVar(&deleteReq.Force, "force", deleteReq.Force, `Force deletion even if the metastore is not empty.`)
} }
var deleteCmd = &cobra.Command{ var deleteCmd = &cobra.Command{

View File

@ -257,7 +257,8 @@ func init() {
// TODO: short flags // TODO: short flags
patchCmd.Flags().Var(&patchJson, "json", `either inline JSON string or @path/to/file.json with request body`) patchCmd.Flags().Var(&patchJson, "json", `either inline JSON string or @path/to/file.json with request body`)
// TODO: array: operations // TODO: array: Operations
// TODO: array: schema
} }

View File

@ -12,8 +12,16 @@ import (
var Cmd = &cobra.Command{ var Cmd = &cobra.Command{
Use: "settings", Use: "settings",
Short: `TBD.`, Short: `The Personal Compute enablement setting lets you control which users can use the Personal Compute default policy to create compute resources.`,
Long: `TBD`, 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.`,
Annotations: map[string]string{ Annotations: map[string]string{
"package": "settings", "package": "settings",
}, },
@ -24,30 +32,23 @@ var Cmd = &cobra.Command{
// start delete-personal-compute-setting command // start delete-personal-compute-setting command
var deletePersonalComputeSettingReq settings.DeletePersonalComputeSettingRequest var deletePersonalComputeSettingReq settings.DeletePersonalComputeSettingRequest
var deletePersonalComputeSettingJson flags.JsonFlag
func init() { func init() {
Cmd.AddCommand(deletePersonalComputeSettingCmd) Cmd.AddCommand(deletePersonalComputeSettingCmd)
// TODO: short flags // TODO: short flags
deletePersonalComputeSettingCmd.Flags().Var(&deletePersonalComputeSettingJson, "json", `either inline JSON string or @path/to/file.json with request body`)
deletePersonalComputeSettingCmd.Flags().StringVar(&deletePersonalComputeSettingReq.Etag, "etag", deletePersonalComputeSettingReq.Etag, `TBD.`)
} }
var deletePersonalComputeSettingCmd = &cobra.Command{ var deletePersonalComputeSettingCmd = &cobra.Command{
Use: "delete-personal-compute-setting", Use: "delete-personal-compute-setting ETAG",
Short: `Delete Personal Compute setting.`, Short: `Delete Personal Compute setting.`,
Long: `Delete Personal Compute setting. Long: `Delete Personal Compute setting.
TBD`, Reverts back the Personal Compute setting value to default (ON)`,
Annotations: map[string]string{}, Annotations: map[string]string{},
Args: func(cmd *cobra.Command, args []string) error { Args: func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := cobra.ExactArgs(1)
if cmd.Flags().Changed("json") {
check = cobra.ExactArgs(0)
}
return check(cmd, args) return check(cmd, args)
}, },
PreRunE: root.MustAccountClient, PreRunE: root.MustAccountClient,
@ -55,13 +56,7 @@ var deletePersonalComputeSettingCmd = &cobra.Command{
ctx := cmd.Context() ctx := cmd.Context()
a := root.AccountClient(ctx) a := root.AccountClient(ctx)
if cmd.Flags().Changed("json") { deletePersonalComputeSettingReq.Etag = args[0]
err = deletePersonalComputeSettingJson.Unmarshal(&deletePersonalComputeSettingReq)
if err != nil {
return err
}
} else {
}
response, err := a.Settings.DeletePersonalComputeSetting(ctx, deletePersonalComputeSettingReq) response, err := a.Settings.DeletePersonalComputeSetting(ctx, deletePersonalComputeSettingReq)
if err != nil { if err != nil {
@ -76,30 +71,23 @@ var deletePersonalComputeSettingCmd = &cobra.Command{
// start read-personal-compute-setting command // start read-personal-compute-setting command
var readPersonalComputeSettingReq settings.ReadPersonalComputeSettingRequest var readPersonalComputeSettingReq settings.ReadPersonalComputeSettingRequest
var readPersonalComputeSettingJson flags.JsonFlag
func init() { func init() {
Cmd.AddCommand(readPersonalComputeSettingCmd) Cmd.AddCommand(readPersonalComputeSettingCmd)
// TODO: short flags // TODO: short flags
readPersonalComputeSettingCmd.Flags().Var(&readPersonalComputeSettingJson, "json", `either inline JSON string or @path/to/file.json with request body`)
readPersonalComputeSettingCmd.Flags().StringVar(&readPersonalComputeSettingReq.Etag, "etag", readPersonalComputeSettingReq.Etag, `TBD.`)
} }
var readPersonalComputeSettingCmd = &cobra.Command{ var readPersonalComputeSettingCmd = &cobra.Command{
Use: "read-personal-compute-setting", Use: "read-personal-compute-setting ETAG",
Short: `Get Personal Compute setting.`, Short: `Get Personal Compute setting.`,
Long: `Get Personal Compute setting. Long: `Get Personal Compute setting.
TBD`, Gets the value of the Personal Compute setting.`,
Annotations: map[string]string{}, Annotations: map[string]string{},
Args: func(cmd *cobra.Command, args []string) error { Args: func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(0) check := cobra.ExactArgs(1)
if cmd.Flags().Changed("json") {
check = cobra.ExactArgs(0)
}
return check(cmd, args) return check(cmd, args)
}, },
PreRunE: root.MustAccountClient, PreRunE: root.MustAccountClient,
@ -107,13 +95,7 @@ var readPersonalComputeSettingCmd = &cobra.Command{
ctx := cmd.Context() ctx := cmd.Context()
a := root.AccountClient(ctx) a := root.AccountClient(ctx)
if cmd.Flags().Changed("json") { readPersonalComputeSettingReq.Etag = args[0]
err = readPersonalComputeSettingJson.Unmarshal(&readPersonalComputeSettingReq)
if err != nil {
return err
}
} else {
}
response, err := a.Settings.ReadPersonalComputeSetting(ctx, readPersonalComputeSettingReq) response, err := a.Settings.ReadPersonalComputeSetting(ctx, readPersonalComputeSettingReq)
if err != nil { if err != nil {
@ -135,7 +117,7 @@ func init() {
// TODO: short flags // TODO: short flags
updatePersonalComputeSettingCmd.Flags().Var(&updatePersonalComputeSettingJson, "json", `either inline JSON string or @path/to/file.json with request body`) updatePersonalComputeSettingCmd.Flags().Var(&updatePersonalComputeSettingJson, "json", `either inline JSON string or @path/to/file.json with request body`)
updatePersonalComputeSettingCmd.Flags().BoolVar(&updatePersonalComputeSettingReq.AllowMissing, "allow-missing", updatePersonalComputeSettingReq.AllowMissing, `TBD.`) updatePersonalComputeSettingCmd.Flags().BoolVar(&updatePersonalComputeSettingReq.AllowMissing, "allow-missing", updatePersonalComputeSettingReq.AllowMissing, `This should always be set to true for Settings RPCs.`)
// TODO: complex arg: setting // TODO: complex arg: setting
} }
@ -145,7 +127,7 @@ var updatePersonalComputeSettingCmd = &cobra.Command{
Short: `Update Personal Compute setting.`, Short: `Update Personal Compute setting.`,
Long: `Update Personal Compute setting. Long: `Update Personal Compute setting.
TBD`, Updates the value of the Personal Compute setting.`,
Annotations: map[string]string{}, Annotations: map[string]string{},
Args: func(cmd *cobra.Command, args []string) error { Args: func(cmd *cobra.Command, args []string) error {

View File

@ -81,6 +81,8 @@ func init() {
Cmd.AddCommand(deleteCmd) Cmd.AddCommand(deleteCmd)
// TODO: short flags // TODO: short flags
deleteCmd.Flags().BoolVar(&deleteReq.Force, "force", deleteReq.Force, `Force deletion even if the Storage Credential is not empty.`)
} }
var deleteCmd = &cobra.Command{ var deleteCmd = &cobra.Command{

View File

@ -265,7 +265,8 @@ func init() {
// TODO: short flags // TODO: short flags
patchCmd.Flags().Var(&patchJson, "json", `either inline JSON string or @path/to/file.json with request body`) patchCmd.Flags().Var(&patchJson, "json", `either inline JSON string or @path/to/file.json with request body`)
// TODO: array: operations // TODO: array: Operations
// TODO: array: schema
} }

View File

@ -34,7 +34,7 @@ func init() {
// TODO: short flags // TODO: short flags
createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
createCmd.Flags().StringVar(&createReq.Parent, "parent", createReq.Parent, `The identifier of the workspace folder containing the alert.`) createCmd.Flags().StringVar(&createReq.Parent, "parent", createReq.Parent, `The identifier of the workspace folder containing the object.`)
createCmd.Flags().IntVar(&createReq.Rearm, "rearm", createReq.Rearm, `Number of seconds after being triggered before the alert rearms itself and can be triggered again.`) createCmd.Flags().IntVar(&createReq.Rearm, "rearm", createReq.Rearm, `Number of seconds after being triggered before the alert rearms itself and can be triggered again.`)
} }

258
cmd/workspace/clean-rooms/clean-rooms.go generated Executable file
View File

@ -0,0 +1,258 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package clean_rooms
import (
"fmt"
"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/sharing"
"github.com/spf13/cobra"
)
var Cmd = &cobra.Command{
Use: "clean-rooms",
Short: `A clean room is a secure, privacy-protecting environment where two or more parties can share sensitive enterprise data, including customer data, for measurements, insights, activation and other use cases.`,
Long: `A clean room is a secure, privacy-protecting environment where two or more
parties can share sensitive enterprise data, including customer data, for
measurements, insights, activation and other use cases.
To create clean rooms, you must be a metastore admin or a user with the
**CREATE_CLEAN_ROOM** privilege.`,
Annotations: map[string]string{
"package": "sharing",
},
// This service is being previewed; hide from help output.
Hidden: true,
}
// start create command
var createReq sharing.CreateCleanRoom
var createJson flags.JsonFlag
func init() {
Cmd.AddCommand(createCmd)
// TODO: short flags
createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
createCmd.Flags().StringVar(&createReq.Comment, "comment", createReq.Comment, `User-provided free-form text description.`)
}
var createCmd = &cobra.Command{
Use: "create",
Short: `Create a clean room.`,
Long: `Create a clean room.
Creates a new clean room with specified colaborators. The caller must be a
metastore admin or have the **CREATE_CLEAN_ROOM** privilege on the metastore.`,
Annotations: map[string]string{},
PreRunE: root.MustWorkspaceClient,
RunE: func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := root.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") {
err = createJson.Unmarshal(&createReq)
if err != nil {
return err
}
} else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
}
response, err := w.CleanRooms.Create(ctx, createReq)
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 delete command
var deleteReq sharing.DeleteCleanRoomRequest
func init() {
Cmd.AddCommand(deleteCmd)
// TODO: short flags
}
var deleteCmd = &cobra.Command{
Use: "delete NAME_ARG",
Short: `Delete a clean room.`,
Long: `Delete a clean room.
Deletes a data object clean room from the metastore. The caller must be an
owner of the clean room.`,
Annotations: map[string]string{},
Args: func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1)
return check(cmd, args)
},
PreRunE: root.MustWorkspaceClient,
RunE: func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := root.WorkspaceClient(ctx)
deleteReq.NameArg = args[0]
err = w.CleanRooms.Delete(ctx, deleteReq)
if err != nil {
return err
}
return nil
},
// Disable completions since they are not applicable.
// Can be overridden by manual implementation in `override.go`.
ValidArgsFunction: cobra.NoFileCompletions,
}
// start get command
var getReq sharing.GetCleanRoomRequest
func init() {
Cmd.AddCommand(getCmd)
// TODO: short flags
getCmd.Flags().BoolVar(&getReq.IncludeRemoteDetails, "include-remote-details", getReq.IncludeRemoteDetails, `Whether to include remote details (central) on the clean room.`)
}
var getCmd = &cobra.Command{
Use: "get NAME_ARG",
Short: `Get a clean room.`,
Long: `Get a clean room.
Gets a data object clean room from the metastore. The caller must be a
metastore admin or the owner of the clean room.`,
Annotations: map[string]string{},
Args: func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1)
return check(cmd, args)
},
PreRunE: root.MustWorkspaceClient,
RunE: func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := root.WorkspaceClient(ctx)
getReq.NameArg = args[0]
response, err := w.CleanRooms.Get(ctx, getReq)
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 list command
func init() {
Cmd.AddCommand(listCmd)
}
var listCmd = &cobra.Command{
Use: "list",
Short: `List clean rooms.`,
Long: `List clean rooms.
Gets an array of data object clean rooms from the metastore. The caller must
be a metastore admin or the owner of the clean room. There is no guarantee of
a specific ordering of the elements in the array.`,
Annotations: map[string]string{},
PreRunE: root.MustWorkspaceClient,
RunE: func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := root.WorkspaceClient(ctx)
response, err := w.CleanRooms.ListAll(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`.
ValidArgsFunction: cobra.NoFileCompletions,
}
// start update command
var updateReq sharing.UpdateCleanRoom
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`)
// TODO: array: catalog_updates
updateCmd.Flags().StringVar(&updateReq.Comment, "comment", updateReq.Comment, `User-provided free-form text description.`)
updateCmd.Flags().StringVar(&updateReq.Name, "name", updateReq.Name, `Name of the clean room.`)
updateCmd.Flags().StringVar(&updateReq.Owner, "owner", updateReq.Owner, `Username of current owner of clean room.`)
}
var updateCmd = &cobra.Command{
Use: "update NAME_ARG",
Short: `Update a clean room.`,
Long: `Update a clean room.
Updates the clean room with the changes and data objects in the request. The
caller must be the owner of the clean room or a metastore admin.
When the caller is a metastore admin, only the __owner__ field can be updated.
In the case that the clean room name is changed **updateCleanRoom** requires
that the caller is both the clean room owner and a metastore admin.
For each table that is added through this method, the clean room owner must
also have **SELECT** privilege on the table. The privilege must be maintained
indefinitely for recipients to be able to access the table. Typically, you
should use a group as the clean room owner.
Table removals through **update** do not require additional privileges.`,
Annotations: map[string]string{},
Args: func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(1)
return check(cmd, args)
},
PreRunE: root.MustWorkspaceClient,
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.NameArg = args[0]
response, err := w.CleanRooms.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`.
ValidArgsFunction: cobra.NoFileCompletions,
}
// end service CleanRooms

3
cmd/workspace/cmd.go generated
View File

@ -7,6 +7,7 @@ import (
alerts "github.com/databricks/cli/cmd/workspace/alerts" alerts "github.com/databricks/cli/cmd/workspace/alerts"
catalogs "github.com/databricks/cli/cmd/workspace/catalogs" catalogs "github.com/databricks/cli/cmd/workspace/catalogs"
clean_rooms "github.com/databricks/cli/cmd/workspace/clean-rooms"
cluster_policies "github.com/databricks/cli/cmd/workspace/cluster-policies" cluster_policies "github.com/databricks/cli/cmd/workspace/cluster-policies"
clusters "github.com/databricks/cli/cmd/workspace/clusters" clusters "github.com/databricks/cli/cmd/workspace/clusters"
connections "github.com/databricks/cli/cmd/workspace/connections" connections "github.com/databricks/cli/cmd/workspace/connections"
@ -58,6 +59,7 @@ import (
func init() { func init() {
root.RootCmd.AddCommand(alerts.Cmd) root.RootCmd.AddCommand(alerts.Cmd)
root.RootCmd.AddCommand(catalogs.Cmd) root.RootCmd.AddCommand(catalogs.Cmd)
root.RootCmd.AddCommand(clean_rooms.Cmd)
root.RootCmd.AddCommand(cluster_policies.Cmd) root.RootCmd.AddCommand(cluster_policies.Cmd)
root.RootCmd.AddCommand(clusters.Cmd) root.RootCmd.AddCommand(clusters.Cmd)
root.RootCmd.AddCommand(connections.Cmd) root.RootCmd.AddCommand(connections.Cmd)
@ -108,6 +110,7 @@ func init() {
// Register commands with groups // Register commands with groups
alerts.Cmd.GroupID = "sql" alerts.Cmd.GroupID = "sql"
catalogs.Cmd.GroupID = "catalog" catalogs.Cmd.GroupID = "catalog"
clean_rooms.Cmd.GroupID = "sharing"
cluster_policies.Cmd.GroupID = "compute" cluster_policies.Cmd.GroupID = "compute"
clusters.Cmd.GroupID = "compute" clusters.Cmd.GroupID = "compute"
connections.Cmd.GroupID = "catalog" connections.Cmd.GroupID = "catalog"

View File

@ -35,11 +35,6 @@ func init() {
// TODO: short flags // TODO: short flags
createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
createCmd.Flags().BoolVar(&createReq.IsFavorite, "is-favorite", createReq.IsFavorite, `Indicates whether this query object should appear in the current user's favorites list.`)
createCmd.Flags().StringVar(&createReq.Name, "name", createReq.Name, `The title of this dashboard that appears in list views and at the top of the dashboard page.`)
createCmd.Flags().StringVar(&createReq.Parent, "parent", createReq.Parent, `The identifier of the workspace folder containing the dashboard.`)
// TODO: array: tags
} }
var createCmd = &cobra.Command{ var createCmd = &cobra.Command{
@ -66,6 +61,7 @@ var createCmd = &cobra.Command{
return err return err
} }
} else { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
} }
response, err := w.Dashboards.Create(ctx, createReq) response, err := w.Dashboards.Create(ctx, createReq)

View File

@ -645,7 +645,7 @@ var logBatchCmd = &cobra.Command{
The following limits also apply to metric, param, and tag keys and values: The following limits also apply to metric, param, and tag keys and values:
* Metric keyes, param keys, and tag keys can be up to 250 characters in length * Metric keys, param keys, and tag keys can be up to 250 characters in length
* Parameter and tag values can be up to 250 characters in length`, * Parameter and tag values can be up to 250 characters in length`,
Annotations: map[string]string{}, Annotations: map[string]string{},

View File

@ -258,7 +258,8 @@ func init() {
// TODO: short flags // TODO: short flags
patchCmd.Flags().Var(&patchJson, "json", `either inline JSON string or @path/to/file.json with request body`) patchCmd.Flags().Var(&patchJson, "json", `either inline JSON string or @path/to/file.json with request body`)
// TODO: array: operations // TODO: array: Operations
// TODO: array: schema
} }

View File

@ -34,7 +34,7 @@ func init() {
addCmd.Flags().Var(&addJson, "json", `either inline JSON string or @path/to/file.json with request body`) addCmd.Flags().Var(&addJson, "json", `either inline JSON string or @path/to/file.json with request body`)
addCmd.Flags().StringVar(&addReq.IamRoleArn, "iam-role-arn", addReq.IamRoleArn, `The AWS IAM role ARN of the role associated with the instance profile.`) addCmd.Flags().StringVar(&addReq.IamRoleArn, "iam-role-arn", addReq.IamRoleArn, `The AWS IAM role ARN of the role associated with the instance profile.`)
addCmd.Flags().BoolVar(&addReq.IsMetaInstanceProfile, "is-meta-instance-profile", addReq.IsMetaInstanceProfile, `By default, Databricks validates that it has sufficient permissions to launch instances with the instance profile.`) addCmd.Flags().BoolVar(&addReq.IsMetaInstanceProfile, "is-meta-instance-profile", addReq.IsMetaInstanceProfile, `Boolean flag indicating whether the instance profile should only be used in credential passthrough scenarios.`)
addCmd.Flags().BoolVar(&addReq.SkipValidation, "skip-validation", addReq.SkipValidation, `By default, Databricks validates that it has sufficient permissions to launch instances with the instance profile.`) addCmd.Flags().BoolVar(&addReq.SkipValidation, "skip-validation", addReq.SkipValidation, `By default, Databricks validates that it has sufficient permissions to launch instances with the instance profile.`)
} }
@ -90,7 +90,7 @@ func init() {
editCmd.Flags().Var(&editJson, "json", `either inline JSON string or @path/to/file.json with request body`) editCmd.Flags().Var(&editJson, "json", `either inline JSON string or @path/to/file.json with request body`)
editCmd.Flags().StringVar(&editReq.IamRoleArn, "iam-role-arn", editReq.IamRoleArn, `The AWS IAM role ARN of the role associated with the instance profile.`) editCmd.Flags().StringVar(&editReq.IamRoleArn, "iam-role-arn", editReq.IamRoleArn, `The AWS IAM role ARN of the role associated with the instance profile.`)
editCmd.Flags().BoolVar(&editReq.IsMetaInstanceProfile, "is-meta-instance-profile", editReq.IsMetaInstanceProfile, `By default, Databricks validates that it has sufficient permissions to launch instances with the instance profile.`) editCmd.Flags().BoolVar(&editReq.IsMetaInstanceProfile, "is-meta-instance-profile", editReq.IsMetaInstanceProfile, `Boolean flag indicating whether the instance profile should only be used in credential passthrough scenarios.`)
} }

View File

@ -203,25 +203,6 @@ func init() {
// TODO: short flags // TODO: short flags
createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
// TODO: array: access_control_list
// TODO: array: compute
// TODO: complex arg: continuous
// TODO: complex arg: email_notifications
createCmd.Flags().Var(&createReq.Format, "format", `Used to tell what is the format of the job.`)
// TODO: complex arg: git_source
// TODO: array: job_clusters
createCmd.Flags().IntVar(&createReq.MaxConcurrentRuns, "max-concurrent-runs", createReq.MaxConcurrentRuns, `An optional maximum allowed number of concurrent runs of the job.`)
createCmd.Flags().StringVar(&createReq.Name, "name", createReq.Name, `An optional name for the job.`)
// TODO: complex arg: notification_settings
// TODO: array: parameters
// TODO: complex arg: run_as
// TODO: complex arg: schedule
// TODO: map via StringToStringVar: tags
// TODO: array: tasks
createCmd.Flags().IntVar(&createReq.TimeoutSeconds, "timeout-seconds", createReq.TimeoutSeconds, `An optional timeout applied to each run of this job.`)
// TODO: complex arg: trigger
// TODO: complex arg: webhook_notifications
} }
var createCmd = &cobra.Command{ var createCmd = &cobra.Command{
@ -250,6 +231,7 @@ var createCmd = &cobra.Command{
return err return err
} }
} else { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
} }
response, err := w.Jobs.Create(ctx, createReq) response, err := w.Jobs.Create(ctx, createReq)
@ -1012,7 +994,9 @@ func init() {
submitCmd.Flags().Var(&submitJson, "json", `either inline JSON string or @path/to/file.json with request body`) submitCmd.Flags().Var(&submitJson, "json", `either inline JSON string or @path/to/file.json with request body`)
// TODO: array: access_control_list // TODO: array: access_control_list
// TODO: complex arg: email_notifications
// TODO: complex arg: git_source // TODO: complex arg: git_source
// TODO: complex arg: health
submitCmd.Flags().StringVar(&submitReq.IdempotencyToken, "idempotency-token", submitReq.IdempotencyToken, `An optional token that can be used to guarantee the idempotency of job run requests.`) submitCmd.Flags().StringVar(&submitReq.IdempotencyToken, "idempotency-token", submitReq.IdempotencyToken, `An optional token that can be used to guarantee the idempotency of job run requests.`)
// TODO: complex arg: notification_settings // TODO: complex arg: notification_settings
submitCmd.Flags().StringVar(&submitReq.RunName, "run-name", submitReq.RunName, `An optional name for the run.`) submitCmd.Flags().StringVar(&submitReq.RunName, "run-name", submitReq.RunName, `An optional name for the run.`)

View File

@ -20,10 +20,10 @@ var Cmd = &cobra.Command{
Databricks account admins can create metastores and assign them to Databricks Databricks account admins can create metastores and assign them to Databricks
workspaces to control which workloads use each metastore. For a workspace to workspaces to control which workloads use each metastore. For a workspace to
use Unity Catalog, it must have a Unity Catalog metastore attached. use Unity Catalog, it must have a Unity Catalog metastore attached.
Each metastore is configured with a root storage location in a cloud storage Each metastore is configured with a root storage location in a cloud storage
account. This storage location is used for metadata and managed tables data. account. This storage location is used for metadata and managed tables data.
NOTE: This metastore is distinct from the metastore included in Databricks NOTE: This metastore is distinct from the metastore included in Databricks
workspaces created before Unity Catalog was released. If your workspace workspaces created before Unity Catalog was released. If your workspace
includes a legacy Hive metastore, the data in that metastore is available in a includes a legacy Hive metastore, the data in that metastore is available in a
@ -46,7 +46,7 @@ var assignCmd = &cobra.Command{
Use: "assign METASTORE_ID DEFAULT_CATALOG_NAME WORKSPACE_ID", Use: "assign METASTORE_ID DEFAULT_CATALOG_NAME WORKSPACE_ID",
Short: `Create an assignment.`, Short: `Create an assignment.`,
Long: `Create an assignment. Long: `Create an assignment.
Creates a new metastore assignment. If an assignment for the same Creates a new metastore assignment. If an assignment for the same
__workspace_id__ exists, it will be overwritten by the new __metastore_id__ __workspace_id__ exists, it will be overwritten by the new __metastore_id__
and __default_catalog_name__. The caller must be an account admin.`, and __default_catalog_name__. The caller must be an account admin.`,
@ -96,7 +96,7 @@ var createCmd = &cobra.Command{
Use: "create NAME STORAGE_ROOT", Use: "create NAME STORAGE_ROOT",
Short: `Create a metastore.`, Short: `Create a metastore.`,
Long: `Create a metastore. Long: `Create a metastore.
Creates a new metastore based on a provided name and storage root path.`, Creates a new metastore based on a provided name and storage root path.`,
Annotations: map[string]string{}, Annotations: map[string]string{},
@ -144,7 +144,7 @@ var currentCmd = &cobra.Command{
Use: "current", Use: "current",
Short: `Get metastore assignment for workspace.`, Short: `Get metastore assignment for workspace.`,
Long: `Get metastore assignment for workspace. Long: `Get metastore assignment for workspace.
Gets the metastore assignment for the workspace being accessed.`, Gets the metastore assignment for the workspace being accessed.`,
Annotations: map[string]string{}, Annotations: map[string]string{},
@ -178,7 +178,7 @@ var deleteCmd = &cobra.Command{
Use: "delete ID", Use: "delete ID",
Short: `Delete a metastore.`, Short: `Delete a metastore.`,
Long: `Delete a metastore. Long: `Delete a metastore.
Deletes a metastore. The caller must be a metastore admin.`, Deletes a metastore. The caller must be a metastore admin.`,
Annotations: map[string]string{}, Annotations: map[string]string{},
@ -217,6 +217,64 @@ var deleteCmd = &cobra.Command{
ValidArgsFunction: cobra.NoFileCompletions, ValidArgsFunction: cobra.NoFileCompletions,
} }
// start enable-optimization command
var enableOptimizationReq catalog.UpdatePredictiveOptimization
var enableOptimizationJson flags.JsonFlag
func init() {
Cmd.AddCommand(enableOptimizationCmd)
// TODO: short flags
enableOptimizationCmd.Flags().Var(&enableOptimizationJson, "json", `either inline JSON string or @path/to/file.json with request body`)
}
var enableOptimizationCmd = &cobra.Command{
Use: "enable-optimization METASTORE_ID ENABLE",
Short: `Toggle predictive optimization on the metastore.`,
Long: `Toggle predictive optimization on the metastore.
Enables or disables predictive optimization on the metastore.`,
// This command is being previewed; hide from help output.
Hidden: true,
Annotations: map[string]string{},
Args: func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2)
if cmd.Flags().Changed("json") {
check = cobra.ExactArgs(0)
}
return check(cmd, args)
},
PreRunE: root.MustWorkspaceClient,
RunE: func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := root.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") {
err = enableOptimizationJson.Unmarshal(&enableOptimizationReq)
if err != nil {
return err
}
} else {
enableOptimizationReq.MetastoreId = args[0]
_, err = fmt.Sscan(args[1], &enableOptimizationReq.Enable)
if err != nil {
return fmt.Errorf("invalid ENABLE: %s", args[1])
}
}
response, err := w.Metastores.EnableOptimization(ctx, enableOptimizationReq)
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 command // start get command
var getReq catalog.GetMetastoreRequest var getReq catalog.GetMetastoreRequest
@ -230,7 +288,7 @@ var getCmd = &cobra.Command{
Use: "get ID", Use: "get ID",
Short: `Get a metastore.`, Short: `Get a metastore.`,
Long: `Get a metastore. Long: `Get a metastore.
Gets a metastore that matches the supplied ID. The caller must be a metastore Gets a metastore that matches the supplied ID. The caller must be a metastore
admin to retrieve this info.`, admin to retrieve this info.`,
@ -281,7 +339,7 @@ var listCmd = &cobra.Command{
Use: "list", Use: "list",
Short: `List metastores.`, Short: `List metastores.`,
Long: `List metastores. Long: `List metastores.
Gets an array of the available metastores (as __MetastoreInfo__ objects). The Gets an array of the available metastores (as __MetastoreInfo__ objects). The
caller must be an admin to retrieve this info. There is no guarantee of a caller must be an admin to retrieve this info. There is no guarantee of a
specific ordering of the elements in the array.`, specific ordering of the elements in the array.`,
@ -302,64 +360,6 @@ var listCmd = &cobra.Command{
ValidArgsFunction: cobra.NoFileCompletions, ValidArgsFunction: cobra.NoFileCompletions,
} }
// start maintenance command
var maintenanceReq catalog.UpdatePredictiveOptimization
var maintenanceJson flags.JsonFlag
func init() {
Cmd.AddCommand(maintenanceCmd)
// TODO: short flags
maintenanceCmd.Flags().Var(&maintenanceJson, "json", `either inline JSON string or @path/to/file.json with request body`)
}
var maintenanceCmd = &cobra.Command{
Use: "maintenance METASTORE_ID ENABLE",
Short: `Enables or disables auto maintenance on the metastore.`,
Long: `Enables or disables auto maintenance on the metastore.
Enables or disables auto maintenance on the metastore.`,
// This command is being previewed; hide from help output.
Hidden: true,
Annotations: map[string]string{},
Args: func(cmd *cobra.Command, args []string) error {
check := cobra.ExactArgs(2)
if cmd.Flags().Changed("json") {
check = cobra.ExactArgs(0)
}
return check(cmd, args)
},
PreRunE: root.MustWorkspaceClient,
RunE: func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := root.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") {
err = maintenanceJson.Unmarshal(&maintenanceReq)
if err != nil {
return err
}
} else {
maintenanceReq.MetastoreId = args[0]
_, err = fmt.Sscan(args[1], &maintenanceReq.Enable)
if err != nil {
return fmt.Errorf("invalid ENABLE: %s", args[1])
}
}
response, err := w.Metastores.EnableOptimization(ctx, maintenanceReq)
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 summary command // start summary command
func init() { func init() {
@ -371,7 +371,7 @@ var summaryCmd = &cobra.Command{
Use: "summary", Use: "summary",
Short: `Get a metastore summary.`, Short: `Get a metastore summary.`,
Long: `Get a metastore summary. Long: `Get a metastore summary.
Gets information about a metastore. This summary includes the storage Gets information about a metastore. This summary includes the storage
credential, the cloud vendor, the cloud region, and the global metastore ID.`, credential, the cloud vendor, the cloud region, and the global metastore ID.`,
@ -404,7 +404,7 @@ var unassignCmd = &cobra.Command{
Use: "unassign WORKSPACE_ID METASTORE_ID", Use: "unassign WORKSPACE_ID METASTORE_ID",
Short: `Delete an assignment.`, Short: `Delete an assignment.`,
Long: `Delete an assignment. Long: `Delete an assignment.
Deletes a metastore assignment. The caller must be an account administrator.`, Deletes a metastore assignment. The caller must be an account administrator.`,
Annotations: map[string]string{}, Annotations: map[string]string{},
@ -455,7 +455,7 @@ var updateCmd = &cobra.Command{
Use: "update ID", Use: "update ID",
Short: `Update a metastore.`, Short: `Update a metastore.`,
Long: `Update a metastore. Long: `Update a metastore.
Updates information for a specific metastore. The caller must be a metastore Updates information for a specific metastore. The caller must be a metastore
admin.`, admin.`,
@ -511,7 +511,7 @@ var updateAssignmentCmd = &cobra.Command{
Use: "update-assignment WORKSPACE_ID", Use: "update-assignment WORKSPACE_ID",
Short: `Update an assignment.`, Short: `Update an assignment.`,
Long: `Update an assignment. Long: `Update an assignment.
Updates a metastore assignment. This operation can be used to update Updates a metastore assignment. This operation can be used to update
__metastore_id__ or __default_catalog_name__ for a specified Workspace, if the __metastore_id__ or __default_catalog_name__ for a specified Workspace, if the
Workspace is already assigned a metastore. The caller must be an account admin Workspace is already assigned a metastore. The caller must be an account admin

View File

@ -44,25 +44,6 @@ func init() {
// TODO: short flags // TODO: short flags
createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
createCmd.Flags().BoolVar(&createReq.AllowDuplicateNames, "allow-duplicate-names", createReq.AllowDuplicateNames, `If false, deployment will fail if name conflicts with that of another pipeline.`)
createCmd.Flags().StringVar(&createReq.Catalog, "catalog", createReq.Catalog, `A catalog in Unity Catalog to publish data from this pipeline to.`)
createCmd.Flags().StringVar(&createReq.Channel, "channel", createReq.Channel, `DLT Release Channel that specifies which version to use.`)
// TODO: array: clusters
// TODO: map via StringToStringVar: configuration
createCmd.Flags().BoolVar(&createReq.Continuous, "continuous", createReq.Continuous, `Whether the pipeline is continuous or triggered.`)
createCmd.Flags().BoolVar(&createReq.Development, "development", createReq.Development, `Whether the pipeline is in Development mode.`)
createCmd.Flags().BoolVar(&createReq.DryRun, "dry-run", createReq.DryRun, ``)
createCmd.Flags().StringVar(&createReq.Edition, "edition", createReq.Edition, `Pipeline product edition.`)
// TODO: complex arg: filters
createCmd.Flags().StringVar(&createReq.Id, "id", createReq.Id, `Unique identifier for this pipeline.`)
// TODO: array: libraries
createCmd.Flags().StringVar(&createReq.Name, "name", createReq.Name, `Friendly identifier for this pipeline.`)
createCmd.Flags().BoolVar(&createReq.Photon, "photon", createReq.Photon, `Whether Photon is enabled for this pipeline.`)
createCmd.Flags().BoolVar(&createReq.Serverless, "serverless", createReq.Serverless, `Whether serverless compute is enabled for this pipeline.`)
createCmd.Flags().StringVar(&createReq.Storage, "storage", createReq.Storage, `DBFS root directory for storing checkpoints and tables.`)
createCmd.Flags().StringVar(&createReq.Target, "target", createReq.Target, `Target schema (database) to add tables in this pipeline to.`)
// TODO: complex arg: trigger
} }
var createCmd = &cobra.Command{ var createCmd = &cobra.Command{
@ -92,6 +73,7 @@ var createCmd = &cobra.Command{
return err return err
} }
} else { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
} }
response, err := w.Pipelines.Create(ctx, createReq) response, err := w.Pipelines.Create(ctx, createReq)

View File

@ -37,7 +37,11 @@ func init() {
} }
var getCmd = &cobra.Command{ var getCmd = &cobra.Command{
Use: "get POLICY_FAMILY_ID", Use: "get POLICY_FAMILY_ID",
Short: `Get policy family information.`,
Long: `Get policy family information.
Retrieve the information for an policy family based on its identifier.`,
Annotations: map[string]string{}, Annotations: map[string]string{},
Args: func(cmd *cobra.Command, args []string) error { Args: func(cmd *cobra.Command, args []string) error {
@ -77,7 +81,11 @@ func init() {
} }
var listCmd = &cobra.Command{ var listCmd = &cobra.Command{
Use: "list", Use: "list",
Short: `List policy families.`,
Long: `List policy families.
Retrieve a list of policy families. This API is paginated.`,
Annotations: map[string]string{}, Annotations: map[string]string{},
Args: func(cmd *cobra.Command, args []string) error { Args: func(cmd *cobra.Command, args []string) error {

View File

@ -33,13 +33,6 @@ func init() {
// TODO: short flags // TODO: short flags
createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) createCmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
createCmd.Flags().StringVar(&createReq.DataSourceId, "data-source-id", createReq.DataSourceId, `The ID of the data source / SQL warehouse where this query will run.`)
createCmd.Flags().StringVar(&createReq.Description, "description", createReq.Description, `General description that can convey additional information about this query such as usage notes.`)
createCmd.Flags().StringVar(&createReq.Name, "name", createReq.Name, `The name or title of this query to display in list views.`)
// TODO: any: options
createCmd.Flags().StringVar(&createReq.Parent, "parent", createReq.Parent, `The identifier of the workspace folder containing the query.`)
createCmd.Flags().StringVar(&createReq.Query, "query", createReq.Query, `The text of the query.`)
} }
var createCmd = &cobra.Command{ var createCmd = &cobra.Command{
@ -76,6 +69,7 @@ var createCmd = &cobra.Command{
return err return err
} }
} else { } else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
} }
response, err := w.Queries.Create(ctx, createReq) response, err := w.Queries.Create(ctx, createReq)
@ -314,11 +308,11 @@ func init() {
// TODO: short flags // TODO: short flags
updateCmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`) updateCmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
updateCmd.Flags().StringVar(&updateReq.DataSourceId, "data-source-id", updateReq.DataSourceId, `The ID of the data source / SQL warehouse where this query will run.`) updateCmd.Flags().StringVar(&updateReq.DataSourceId, "data-source-id", updateReq.DataSourceId, `Data source ID.`)
updateCmd.Flags().StringVar(&updateReq.Description, "description", updateReq.Description, `General description that can convey additional information about this query such as usage notes.`) updateCmd.Flags().StringVar(&updateReq.Description, "description", updateReq.Description, `General description that conveys additional information about this query such as usage notes.`)
updateCmd.Flags().StringVar(&updateReq.Name, "name", updateReq.Name, `The name or title of this query to display in list views.`) updateCmd.Flags().StringVar(&updateReq.Name, "name", updateReq.Name, `The title of this query that appears in list views, widget headings, and on the query page.`)
// TODO: any: options // TODO: any: options
updateCmd.Flags().StringVar(&updateReq.Query, "query", updateReq.Query, `The text of the query.`) updateCmd.Flags().StringVar(&updateReq.Query, "query", updateReq.Query, `The text of the query to be run.`)
} }

View File

@ -257,7 +257,8 @@ func init() {
// TODO: short flags // TODO: short flags
patchCmd.Flags().Var(&patchJson, "json", `either inline JSON string or @path/to/file.json with request body`) patchCmd.Flags().Var(&patchJson, "json", `either inline JSON string or @path/to/file.json with request body`)
// TODO: array: operations // TODO: array: Operations
// TODO: array: schema
} }

View File

@ -258,4 +258,65 @@ var listSummariesCmd = &cobra.Command{
ValidArgsFunction: cobra.NoFileCompletions, ValidArgsFunction: cobra.NoFileCompletions,
} }
// start update command
var updateReq catalog.UpdateTableRequest
func init() {
Cmd.AddCommand(updateCmd)
// TODO: short flags
updateCmd.Flags().StringVar(&updateReq.Owner, "owner", updateReq.Owner, ``)
}
var updateCmd = &cobra.Command{
Use: "update FULL_NAME",
Short: `Update a table owner.`,
Long: `Update a table owner.
Change the owner of the table. The caller must be the owner of the parent
catalog, have the **USE_CATALOG** privilege on the parent catalog and be the
owner of the parent schema, or be the owner of the table and have the
**USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA**
privilege on the parent schema.`,
// This command is being previewed; hide from help output.
Hidden: true,
Annotations: map[string]string{},
PreRunE: root.MustWorkspaceClient,
RunE: func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := root.WorkspaceClient(ctx)
if len(args) == 0 {
promptSpinner := cmdio.Spinner(ctx)
promptSpinner <- "No FULL_NAME argument specified. Loading names for Tables drop-down."
names, err := w.Tables.TableInfoNameToTableIdMap(ctx, catalog.ListTablesRequest{})
close(promptSpinner)
if err != nil {
return fmt.Errorf("failed to load names for Tables drop-down. Please manually specify required arguments. Original error: %w", err)
}
id, err := cmdio.Select(ctx, names, "Full name of the table")
if err != nil {
return err
}
args = append(args, id)
}
if len(args) != 1 {
return fmt.Errorf("expected to have full name of the table")
}
updateReq.FullName = args[0]
err = w.Tables.Update(ctx, updateReq)
if err != nil {
return err
}
return nil
},
// Disable completions since they are not applicable.
// Can be overridden by manual implementation in `override.go`.
ValidArgsFunction: cobra.NoFileCompletions,
}
// end service Tables // end service Tables

View File

@ -265,7 +265,8 @@ func init() {
// TODO: short flags // TODO: short flags
patchCmd.Flags().Var(&patchJson, "json", `either inline JSON string or @path/to/file.json with request body`) patchCmd.Flags().Var(&patchJson, "json", `either inline JSON string or @path/to/file.json with request body`)
// TODO: array: operations // TODO: array: Operations
// TODO: array: schema
} }