From c3ced68c607e7376bc38a291e9706c8073ac40e5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 16:38:35 +0100 Subject: [PATCH] Bump github.com/databricks/databricks-sdk-go from 0.24.0 to 0.25.0 (#980) Bumps [github.com/databricks/databricks-sdk-go](https://github.com/databricks/databricks-sdk-go) from 0.24.0 to 0.25.0.
Changelog

Sourced from github.com/databricks/databricks-sdk-go's changelog.

0.25.0

API Changes:

OpenAPI SHA: e7b127cb07af8dd4d8c61c7cc045c8910cdbb02a, Date: 2023-11-08 Dependency updates:

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/databricks/databricks-sdk-go&package-manager=go_modules&previous-version=0.24.0&new-version=0.25.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
--------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Andrew Nester --- .codegen/_openapi_sha | 2 +- .gitattributes | 2 +- cmd/account/cmd.go | 4 +- .../network-connectivity.go | 483 ++++++++++++++++++ .../o-auth-enrollment/o-auth-enrollment.go | 169 ------ cmd/account/o-auth-enrollment/overrides.go | 107 ---- cmd/account/users/users.go | 4 +- cmd/account/workspaces/workspaces.go | 1 + cmd/workspace/apps/apps.go | 216 +++++++- .../cluster-policies/cluster-policies.go | 38 +- .../external-locations/external-locations.go | 1 + cmd/workspace/functions/functions.go | 10 +- cmd/workspace/jobs/jobs.go | 1 + cmd/workspace/metastores/metastores.go | 19 +- cmd/workspace/users/users.go | 4 +- go.mod | 10 +- go.sum | 20 +- 17 files changed, 735 insertions(+), 356 deletions(-) create mode 100755 cmd/account/network-connectivity/network-connectivity.go delete mode 100755 cmd/account/o-auth-enrollment/o-auth-enrollment.go delete mode 100644 cmd/account/o-auth-enrollment/overrides.go diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index 23aa4473..7c42f6dc 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -5903bb39137fd76ac384b2044e425f9c56840e00 \ No newline at end of file +e7b127cb07af8dd4d8c61c7cc045c8910cdbb02a \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index e94cfcd7..0a8a7191 100755 --- a/.gitattributes +++ b/.gitattributes @@ -10,9 +10,9 @@ cmd/account/ip-access-lists/ip-access-lists.go linguist-generated=true cmd/account/log-delivery/log-delivery.go linguist-generated=true cmd/account/metastore-assignments/metastore-assignments.go linguist-generated=true cmd/account/metastores/metastores.go linguist-generated=true +cmd/account/network-connectivity/network-connectivity.go linguist-generated=true cmd/account/network-policy/network-policy.go linguist-generated=true cmd/account/networks/networks.go linguist-generated=true -cmd/account/o-auth-enrollment/o-auth-enrollment.go linguist-generated=true cmd/account/o-auth-published-apps/o-auth-published-apps.go linguist-generated=true cmd/account/private-access/private-access.go linguist-generated=true cmd/account/published-app-integration/published-app-integration.go linguist-generated=true diff --git a/cmd/account/cmd.go b/cmd/account/cmd.go index 38be7314..72bf9107 100644 --- a/cmd/account/cmd.go +++ b/cmd/account/cmd.go @@ -16,9 +16,9 @@ import ( log_delivery "github.com/databricks/cli/cmd/account/log-delivery" account_metastore_assignments "github.com/databricks/cli/cmd/account/metastore-assignments" account_metastores "github.com/databricks/cli/cmd/account/metastores" + network_connectivity "github.com/databricks/cli/cmd/account/network-connectivity" account_network_policy "github.com/databricks/cli/cmd/account/network-policy" networks "github.com/databricks/cli/cmd/account/networks" - o_auth_enrollment "github.com/databricks/cli/cmd/account/o-auth-enrollment" o_auth_published_apps "github.com/databricks/cli/cmd/account/o-auth-published-apps" private_access "github.com/databricks/cli/cmd/account/private-access" published_app_integration "github.com/databricks/cli/cmd/account/published-app-integration" @@ -50,9 +50,9 @@ func New() *cobra.Command { cmd.AddCommand(log_delivery.New()) cmd.AddCommand(account_metastore_assignments.New()) cmd.AddCommand(account_metastores.New()) + cmd.AddCommand(network_connectivity.New()) cmd.AddCommand(account_network_policy.New()) cmd.AddCommand(networks.New()) - cmd.AddCommand(o_auth_enrollment.New()) cmd.AddCommand(o_auth_published_apps.New()) cmd.AddCommand(private_access.New()) cmd.AddCommand(published_app_integration.New()) diff --git a/cmd/account/network-connectivity/network-connectivity.go b/cmd/account/network-connectivity/network-connectivity.go new file mode 100755 index 00000000..3bc1e74e --- /dev/null +++ b/cmd/account/network-connectivity/network-connectivity.go @@ -0,0 +1,483 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package network_connectivity + +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/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: "network-connectivity", + Short: `These APIs provide configurations for the network connectivity of your workspaces for serverless compute resources.`, + Long: `These APIs provide configurations for the network connectivity of your + workspaces for serverless compute resources. This API provides stable subnets + for your workspace so that you can configure your firewalls on your Azure + Storage accounts to allow access from Databricks. You can also use the API to + provision private endpoints for Databricks to privately connect serverless + compute resources to your Azure resources using Azure Private Link. See + [configure serverless secure connectivity]. + + [configure serverless secure connectivity]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security`, + GroupID: "settings", + Annotations: map[string]string{ + "package": "settings", + }, + } + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start create-network-connectivity-configuration 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 createNetworkConnectivityConfigurationOverrides []func( + *cobra.Command, + *settings.CreateNetworkConnectivityConfigRequest, +) + +func newCreateNetworkConnectivityConfiguration() *cobra.Command { + cmd := &cobra.Command{} + + var createNetworkConnectivityConfigurationReq settings.CreateNetworkConnectivityConfigRequest + var createNetworkConnectivityConfigurationJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&createNetworkConnectivityConfigurationJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "create-network-connectivity-configuration NAME REGION" + cmd.Short = `Create a network connectivity configuration.` + cmd.Long = `Create a network connectivity configuration. + + Creates a network connectivity configuration (NCC), which provides stable + Azure service subnets when accessing your Azure Storage accounts. You can also + use a network connectivity configuration to create Databricks-managed private + endpoints so that Databricks serverless compute resources privately access + your resources. + + **IMPORTANT**: After you create the network connectivity configuration, you + must assign one or more workspaces to the new network connectivity + configuration. You can share one network connectivity configuration with + multiple workspaces from the same Azure region within the same Databricks + account. See [configure serverless secure connectivity]. + + [configure serverless secure connectivity]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + if cmd.Flags().Changed("json") { + err := cobra.ExactArgs(0)(cmd, args) + if err != nil { + return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'region' in your JSON input") + } + return nil + } + check := cobra.ExactArgs(2) + 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 = createNetworkConnectivityConfigurationJson.Unmarshal(&createNetworkConnectivityConfigurationReq) + if err != nil { + return err + } + } + if !cmd.Flags().Changed("json") { + createNetworkConnectivityConfigurationReq.Name = args[0] + } + if !cmd.Flags().Changed("json") { + createNetworkConnectivityConfigurationReq.Region = args[1] + } + + response, err := a.NetworkConnectivity.CreateNetworkConnectivityConfiguration(ctx, createNetworkConnectivityConfigurationReq) + 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 createNetworkConnectivityConfigurationOverrides { + fn(cmd, &createNetworkConnectivityConfigurationReq) + } + + return cmd +} + +func init() { + cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { + cmd.AddCommand(newCreateNetworkConnectivityConfiguration()) + }) +} + +// start create-private-endpoint-rule 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 createPrivateEndpointRuleOverrides []func( + *cobra.Command, + *settings.CreatePrivateEndpointRuleRequest, +) + +func newCreatePrivateEndpointRule() *cobra.Command { + cmd := &cobra.Command{} + + var createPrivateEndpointRuleReq settings.CreatePrivateEndpointRuleRequest + var createPrivateEndpointRuleJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&createPrivateEndpointRuleJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "create-private-endpoint-rule NETWORK_CONNECTIVITY_CONFIG_ID RESOURCE_ID GROUP_ID" + cmd.Short = `Create a private endpoint rule.` + cmd.Long = `Create a private endpoint rule. + + Create a private endpoint rule for the specified network connectivity config + object. Once the object is created, Databricks asynchronously provisions a new + Azure private endpoint to your specified Azure resource. + + **IMPORTANT**: You must use Azure portal or other Azure tools to approve the + private endpoint to complete the connection. To get the information of the + private endpoint created, make a GET request on the new private endpoint + rule. See [serverless private link]. + + [serverless private link]: https://learn.microsoft.com/azure/databricks/security/network/serverless-network-security/serverless-private-link` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + if cmd.Flags().Changed("json") { + err := cobra.ExactArgs(1)(cmd, args) + if err != nil { + return fmt.Errorf("when --json flag is specified, provide only NETWORK_CONNECTIVITY_CONFIG_ID as positional arguments. Provide 'resource_id', 'group_id' in your JSON input") + } + return nil + } + check := cobra.ExactArgs(3) + 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 = createPrivateEndpointRuleJson.Unmarshal(&createPrivateEndpointRuleReq) + if err != nil { + return err + } + } + createPrivateEndpointRuleReq.NetworkConnectivityConfigId = args[0] + if !cmd.Flags().Changed("json") { + createPrivateEndpointRuleReq.ResourceId = args[1] + } + if !cmd.Flags().Changed("json") { + _, err = fmt.Sscan(args[2], &createPrivateEndpointRuleReq.GroupId) + if err != nil { + return fmt.Errorf("invalid GROUP_ID: %s", args[2]) + } + } + + response, err := a.NetworkConnectivity.CreatePrivateEndpointRule(ctx, createPrivateEndpointRuleReq) + 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 createPrivateEndpointRuleOverrides { + fn(cmd, &createPrivateEndpointRuleReq) + } + + return cmd +} + +func init() { + cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { + cmd.AddCommand(newCreatePrivateEndpointRule()) + }) +} + +// start delete-network-connectivity-configuration 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 deleteNetworkConnectivityConfigurationOverrides []func( + *cobra.Command, + *settings.DeleteNetworkConnectivityConfigurationRequest, +) + +func newDeleteNetworkConnectivityConfiguration() *cobra.Command { + cmd := &cobra.Command{} + + var deleteNetworkConnectivityConfigurationReq settings.DeleteNetworkConnectivityConfigurationRequest + + // TODO: short flags + + cmd.Use = "delete-network-connectivity-configuration NETWORK_CONNECTIVITY_CONFIG_ID" + cmd.Short = `Delete a network connectivity configuration.` + cmd.Long = `Delete a network connectivity configuration. + + Deletes a network connectivity configuration.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + 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) + + deleteNetworkConnectivityConfigurationReq.NetworkConnectivityConfigId = args[0] + + err = a.NetworkConnectivity.DeleteNetworkConnectivityConfiguration(ctx, deleteNetworkConnectivityConfigurationReq) + if err != nil { + return err + } + return nil + } + + // 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 deleteNetworkConnectivityConfigurationOverrides { + fn(cmd, &deleteNetworkConnectivityConfigurationReq) + } + + return cmd +} + +func init() { + cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { + cmd.AddCommand(newDeleteNetworkConnectivityConfiguration()) + }) +} + +// start delete-private-endpoint-rule 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 deletePrivateEndpointRuleOverrides []func( + *cobra.Command, + *settings.DeletePrivateEndpointRuleRequest, +) + +func newDeletePrivateEndpointRule() *cobra.Command { + cmd := &cobra.Command{} + + var deletePrivateEndpointRuleReq settings.DeletePrivateEndpointRuleRequest + + // TODO: short flags + + cmd.Use = "delete-private-endpoint-rule NETWORK_CONNECTIVITY_CONFIG_ID PRIVATE_ENDPOINT_RULE_ID" + cmd.Short = `Delete a private endpoint rule.` + cmd.Long = `Delete a private endpoint rule. + + Initiates deleting a private endpoint rule. The private endpoint will be + deactivated and will be purged after seven days of deactivation. When a + private endpoint is in deactivated state, deactivated field is set to true + and the private endpoint is not available to your serverless compute + resources.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := cobra.ExactArgs(2) + 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) + + deletePrivateEndpointRuleReq.NetworkConnectivityConfigId = args[0] + deletePrivateEndpointRuleReq.PrivateEndpointRuleId = args[1] + + response, err := a.NetworkConnectivity.DeletePrivateEndpointRule(ctx, deletePrivateEndpointRuleReq) + 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 deletePrivateEndpointRuleOverrides { + fn(cmd, &deletePrivateEndpointRuleReq) + } + + return cmd +} + +func init() { + cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { + cmd.AddCommand(newDeletePrivateEndpointRule()) + }) +} + +// start get-network-connectivity-configuration 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 getNetworkConnectivityConfigurationOverrides []func( + *cobra.Command, + *settings.GetNetworkConnectivityConfigurationRequest, +) + +func newGetNetworkConnectivityConfiguration() *cobra.Command { + cmd := &cobra.Command{} + + var getNetworkConnectivityConfigurationReq settings.GetNetworkConnectivityConfigurationRequest + + // TODO: short flags + + cmd.Use = "get-network-connectivity-configuration NETWORK_CONNECTIVITY_CONFIG_ID" + cmd.Short = `Get a network connectivity configuration.` + cmd.Long = `Get a network connectivity configuration. + + Gets a network connectivity configuration.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + 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) + + getNetworkConnectivityConfigurationReq.NetworkConnectivityConfigId = args[0] + + response, err := a.NetworkConnectivity.GetNetworkConnectivityConfiguration(ctx, getNetworkConnectivityConfigurationReq) + 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 getNetworkConnectivityConfigurationOverrides { + fn(cmd, &getNetworkConnectivityConfigurationReq) + } + + return cmd +} + +func init() { + cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { + cmd.AddCommand(newGetNetworkConnectivityConfiguration()) + }) +} + +// start get-private-endpoint-rule 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 getPrivateEndpointRuleOverrides []func( + *cobra.Command, + *settings.GetPrivateEndpointRuleRequest, +) + +func newGetPrivateEndpointRule() *cobra.Command { + cmd := &cobra.Command{} + + var getPrivateEndpointRuleReq settings.GetPrivateEndpointRuleRequest + + // TODO: short flags + + cmd.Use = "get-private-endpoint-rule NETWORK_CONNECTIVITY_CONFIG_ID PRIVATE_ENDPOINT_RULE_ID" + cmd.Short = `Get a private endpoint rule.` + cmd.Long = `Get a private endpoint rule. + + Gets the private endpoint rule.` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := cobra.ExactArgs(2) + 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) + + getPrivateEndpointRuleReq.NetworkConnectivityConfigId = args[0] + getPrivateEndpointRuleReq.PrivateEndpointRuleId = args[1] + + response, err := a.NetworkConnectivity.GetPrivateEndpointRule(ctx, getPrivateEndpointRuleReq) + 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 getPrivateEndpointRuleOverrides { + fn(cmd, &getPrivateEndpointRuleReq) + } + + return cmd +} + +func init() { + cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { + cmd.AddCommand(newGetPrivateEndpointRule()) + }) +} + +// end service NetworkConnectivity diff --git a/cmd/account/o-auth-enrollment/o-auth-enrollment.go b/cmd/account/o-auth-enrollment/o-auth-enrollment.go deleted file mode 100755 index 7ba2e59a..00000000 --- a/cmd/account/o-auth-enrollment/o-auth-enrollment.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. - -package o_auth_enrollment - -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/oauth2" - "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: "o-auth-enrollment", - Short: `These APIs enable administrators to enroll OAuth for their accounts, which is required for adding/using any OAuth published/custom application integration.`, - Long: `These APIs enable administrators to enroll OAuth for their accounts, which is - required for adding/using any OAuth published/custom application integration. - - **Note:** Your account must be on the E2 version to use these APIs, this is - because OAuth is only supported on the E2 version.`, - GroupID: "oauth2", - Annotations: map[string]string{ - "package": "oauth2", - }, - } - - // Apply optional overrides to this command. - for _, fn := range cmdOverrides { - fn(cmd) - } - - return cmd -} - -// start create 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 createOverrides []func( - *cobra.Command, - *oauth2.CreateOAuthEnrollment, -) - -func newCreate() *cobra.Command { - cmd := &cobra.Command{} - - var createReq oauth2.CreateOAuthEnrollment - var createJson flags.JsonFlag - - // TODO: short flags - cmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) - - cmd.Flags().BoolVar(&createReq.EnableAllPublishedApps, "enable-all-published-apps", createReq.EnableAllPublishedApps, `If true, enable OAuth for all the published applications in the account.`) - - cmd.Use = "create" - cmd.Short = `Create OAuth Enrollment request.` - cmd.Long = `Create OAuth Enrollment request. - - Create an OAuth Enrollment request to enroll OAuth for this account and - optionally enable the OAuth integration for all the partner applications in - the account. - - The parter applications are: - Power BI - Tableau Desktop - Databricks CLI - - The enrollment is executed asynchronously, so the API will return 204 - immediately. The actual enrollment take a few minutes, you can check the - status via API :method:OAuthEnrollment/get.` - - 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 = createJson.Unmarshal(&createReq) - if err != nil { - return err - } - } - - err = a.OAuthEnrollment.Create(ctx, createReq) - if err != nil { - return err - } - return nil - } - - // 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 createOverrides { - fn(cmd, &createReq) - } - - return cmd -} - -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newCreate()) - }) -} - -// start get 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 getOverrides []func( - *cobra.Command, -) - -func newGet() *cobra.Command { - cmd := &cobra.Command{} - - cmd.Use = "get" - cmd.Short = `Get OAuth enrollment status.` - cmd.Long = `Get OAuth enrollment status. - - Gets the OAuth enrollment status for this Account. - - You can only add/use the OAuth published/custom application integrations when - OAuth enrollment status is enabled.` - - cmd.Annotations = make(map[string]string) - - cmd.PreRunE = root.MustAccountClient - cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { - ctx := cmd.Context() - a := root.AccountClient(ctx) - response, err := a.OAuthEnrollment.Get(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`. - cmd.ValidArgsFunction = cobra.NoFileCompletions - - // Apply optional overrides to this command. - for _, fn := range getOverrides { - fn(cmd) - } - - return cmd -} - -func init() { - cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) - }) -} - -// end service OAuthEnrollment diff --git a/cmd/account/o-auth-enrollment/overrides.go b/cmd/account/o-auth-enrollment/overrides.go deleted file mode 100644 index 1fc3aacc..00000000 --- a/cmd/account/o-auth-enrollment/overrides.go +++ /dev/null @@ -1,107 +0,0 @@ -package o_auth_enrollment - -import ( - "context" - "fmt" - "time" - - "github.com/databricks/cli/libs/cmdio" - "github.com/databricks/databricks-sdk-go" - "github.com/databricks/databricks-sdk-go/retries" - "github.com/databricks/databricks-sdk-go/service/oauth2" - "github.com/spf13/cobra" -) - -func promptForBasicAccountConfig(ctx context.Context) (*databricks.Config, error) { - if !cmdio.IsInTTY(ctx) { - return nil, fmt.Errorf("this command requires a TTY") - } - // OAuth Enrollment only works on AWS - host, err := cmdio.DefaultPrompt(ctx, "Host", "https://accounts.cloud.databricks.com") - if err != nil { - return nil, fmt.Errorf("host: %w", err) - } - accountID, err := cmdio.SimplePrompt(ctx, "Account ID") - if err != nil { - return nil, fmt.Errorf("account: %w", err) - } - username, err := cmdio.SimplePrompt(ctx, "Username") - if err != nil { - return nil, fmt.Errorf("username: %w", err) - } - password, err := cmdio.Secret(ctx, "Password") - if err != nil { - return nil, fmt.Errorf("password: %w", err) - } - return &databricks.Config{ - Host: host, - AccountID: accountID, - Username: username, - Password: password, - }, nil -} - -func enableOAuthForAccount(ctx context.Context, cfg *databricks.Config) error { - ac, err := databricks.NewAccountClient(cfg) - if err != nil { - return fmt.Errorf("failed to instantiate account client: %w", err) - } - // The enrollment is executed asynchronously, so the API returns HTTP 204 immediately - err = ac.OAuthEnrollment.Create(ctx, oauth2.CreateOAuthEnrollment{ - EnableAllPublishedApps: true, - }) - if err != nil { - return fmt.Errorf("failed to create oauth enrollment: %w", err) - } - enableSpinner := cmdio.Spinner(ctx) - // The actual enrollment take a few minutes - err = retries.Wait(ctx, 10*time.Minute, func() *retries.Err { - status, err := ac.OAuthEnrollment.Get(ctx) - if err != nil { - return retries.Halt(err) - } - if !status.IsEnabled { - msg := "Enabling OAuth..." - enableSpinner <- msg - return retries.Continues(msg) - } - enableSpinner <- "OAuth is enabled" - close(enableSpinner) - return nil - }) - if err != nil { - return fmt.Errorf("wait for enrollment: %w", err) - } - // enable Databricks CLI, so that `databricks auth login` works - _, err = ac.PublishedAppIntegration.Create(ctx, oauth2.CreatePublishedAppIntegration{ - AppId: "databricks-cli", - }) - if err != nil { - return fmt.Errorf("failed to enable databricks CLI: %w", err) - } - return nil -} - -func newEnable() *cobra.Command { - return &cobra.Command{ - Use: "enable", - Short: "Enable Databricks CLI, Tableau Desktop, and PowerBI for this account.", - Long: `Before you can do 'databricks auth login', you have to enable OAuth for this account. - -This command prompts you for Account ID, username, and password and waits until OAuth is enabled.`, - RunE: func(cmd *cobra.Command, args []string) error { - ctx := cmd.Context() - cfg, err := promptForBasicAccountConfig(ctx) - if err != nil { - return fmt.Errorf("account config: %w", err) - } - return enableOAuthForAccount(ctx, cfg) - }, - } -} - -func init() { - cmdOverrides = append(cmdOverrides, func(c *cobra.Command) { - c.AddCommand(newEnable()) - }) -} diff --git a/cmd/account/users/users.go b/cmd/account/users/users.go index 20769699..730f3fc1 100755 --- a/cmd/account/users/users.go +++ b/cmd/account/users/users.go @@ -67,7 +67,7 @@ func newCreate() *cobra.Command { cmd.Flags().StringVar(&createReq.DisplayName, "display-name", createReq.DisplayName, `String that represents a concatenation of given and family names.`) // TODO: array: emails // TODO: array: entitlements - cmd.Flags().StringVar(&createReq.ExternalId, "external-id", createReq.ExternalId, ``) + cmd.Flags().StringVar(&createReq.ExternalId, "external-id", createReq.ExternalId, `External ID is not currently supported.`) // TODO: array: groups cmd.Flags().StringVar(&createReq.Id, "id", createReq.Id, `Databricks user ID.`) // TODO: complex arg: name @@ -455,7 +455,7 @@ func newUpdate() *cobra.Command { cmd.Flags().StringVar(&updateReq.DisplayName, "display-name", updateReq.DisplayName, `String that represents a concatenation of given and family names.`) // TODO: array: emails // TODO: array: entitlements - cmd.Flags().StringVar(&updateReq.ExternalId, "external-id", updateReq.ExternalId, ``) + cmd.Flags().StringVar(&updateReq.ExternalId, "external-id", updateReq.ExternalId, `External ID is not currently supported.`) // TODO: array: groups cmd.Flags().StringVar(&updateReq.Id, "id", updateReq.Id, `Databricks user ID.`) // TODO: complex arg: name diff --git a/cmd/account/workspaces/workspaces.go b/cmd/account/workspaces/workspaces.go index 1a6aa90d..60eeb505 100755 --- a/cmd/account/workspaces/workspaces.go +++ b/cmd/account/workspaces/workspaces.go @@ -413,6 +413,7 @@ func newUpdate() *cobra.Command { cmd.Flags().StringVar(&updateReq.CredentialsId, "credentials-id", updateReq.CredentialsId, `ID of the workspace's credential configuration object.`) // TODO: map via StringToStringVar: custom_tags cmd.Flags().StringVar(&updateReq.ManagedServicesCustomerManagedKeyId, "managed-services-customer-managed-key-id", updateReq.ManagedServicesCustomerManagedKeyId, `The ID of the workspace's managed services encryption key configuration object.`) + cmd.Flags().StringVar(&updateReq.NetworkConnectivityConfigId, "network-connectivity-config-id", updateReq.NetworkConnectivityConfigId, `The ID of the network connectivity configuration object, which is the parent resource of this private endpoint rule object.`) cmd.Flags().StringVar(&updateReq.NetworkId, "network-id", updateReq.NetworkId, `The ID of the workspace's network configuration object.`) cmd.Flags().StringVar(&updateReq.StorageConfigurationId, "storage-configuration-id", updateReq.StorageConfigurationId, `The ID of the workspace's storage configuration object.`) cmd.Flags().StringVar(&updateReq.StorageCustomerManagedKeyId, "storage-customer-managed-key-id", updateReq.StorageCustomerManagedKeyId, `The ID of the key configuration object for workspace storage.`) diff --git a/cmd/workspace/apps/apps.go b/cmd/workspace/apps/apps.go index 69222bfe..ff5433d1 100755 --- a/cmd/workspace/apps/apps.go +++ b/cmd/workspace/apps/apps.go @@ -107,23 +107,23 @@ func init() { }) } -// start delete command +// start delete-app 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 deleteOverrides []func( +var deleteAppOverrides []func( *cobra.Command, *serving.DeleteAppRequest, ) -func newDelete() *cobra.Command { +func newDeleteApp() *cobra.Command { cmd := &cobra.Command{} - var deleteReq serving.DeleteAppRequest + var deleteAppReq serving.DeleteAppRequest // TODO: short flags - cmd.Use = "delete NAME" + cmd.Use = "delete-app NAME" cmd.Short = `Delete an application.` cmd.Long = `Delete an application. @@ -141,13 +141,13 @@ func newDelete() *cobra.Command { ctx := cmd.Context() w := root.WorkspaceClient(ctx) - deleteReq.Name = args[0] + deleteAppReq.Name = args[0] - err = w.Apps.Delete(ctx, deleteReq) + response, err := w.Apps.DeleteApp(ctx, deleteAppReq) if err != nil { return err } - return nil + return cmdio.Render(ctx, response) } // Disable completions since they are not applicable. @@ -155,8 +155,8 @@ func newDelete() *cobra.Command { cmd.ValidArgsFunction = cobra.NoFileCompletions // Apply optional overrides to this command. - for _, fn := range deleteOverrides { - fn(cmd, &deleteReq) + for _, fn := range deleteAppOverrides { + fn(cmd, &deleteAppReq) } return cmd @@ -164,27 +164,27 @@ func newDelete() *cobra.Command { func init() { cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newDelete()) + cmd.AddCommand(newDeleteApp()) }) } -// start get command +// start get-app 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 getOverrides []func( +var getAppOverrides []func( *cobra.Command, *serving.GetAppRequest, ) -func newGet() *cobra.Command { +func newGetApp() *cobra.Command { cmd := &cobra.Command{} - var getReq serving.GetAppRequest + var getAppReq serving.GetAppRequest // TODO: short flags - cmd.Use = "get NAME" + cmd.Use = "get-app NAME" cmd.Short = `Get definition for an application.` cmd.Long = `Get definition for an application. @@ -202,13 +202,13 @@ func newGet() *cobra.Command { ctx := cmd.Context() w := root.WorkspaceClient(ctx) - getReq.Name = args[0] + getAppReq.Name = args[0] - err = w.Apps.Get(ctx, getReq) + response, err := w.Apps.GetApp(ctx, getAppReq) if err != nil { return err } - return nil + return cmdio.Render(ctx, response) } // Disable completions since they are not applicable. @@ -216,8 +216,8 @@ func newGet() *cobra.Command { cmd.ValidArgsFunction = cobra.NoFileCompletions // Apply optional overrides to this command. - for _, fn := range getOverrides { - fn(cmd, &getReq) + for _, fn := range getAppOverrides { + fn(cmd, &getAppReq) } return cmd @@ -225,7 +225,179 @@ func newGet() *cobra.Command { func init() { cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { - cmd.AddCommand(newGet()) + cmd.AddCommand(newGetApp()) + }) +} + +// start get-app-deployment-status 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 getAppDeploymentStatusOverrides []func( + *cobra.Command, + *serving.GetAppDeploymentStatusRequest, +) + +func newGetAppDeploymentStatus() *cobra.Command { + cmd := &cobra.Command{} + + var getAppDeploymentStatusReq serving.GetAppDeploymentStatusRequest + + // TODO: short flags + + cmd.Flags().StringVar(&getAppDeploymentStatusReq.IncludeAppLog, "include-app-log", getAppDeploymentStatusReq.IncludeAppLog, `Boolean flag to include application logs.`) + + cmd.Use = "get-app-deployment-status DEPLOYMENT_ID" + cmd.Short = `Get deployment status for an application.` + cmd.Long = `Get deployment status for an application. + + Get deployment status for an application` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := cobra.ExactArgs(1) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := root.WorkspaceClient(ctx) + + getAppDeploymentStatusReq.DeploymentId = args[0] + + response, err := w.Apps.GetAppDeploymentStatus(ctx, getAppDeploymentStatusReq) + 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 getAppDeploymentStatusOverrides { + fn(cmd, &getAppDeploymentStatusReq) + } + + return cmd +} + +func init() { + cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { + cmd.AddCommand(newGetAppDeploymentStatus()) + }) +} + +// start get-apps 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 getAppsOverrides []func( + *cobra.Command, +) + +func newGetApps() *cobra.Command { + cmd := &cobra.Command{} + + cmd.Use = "get-apps" + cmd.Short = `List all applications.` + cmd.Long = `List all applications. + + List all available applications` + + cmd.Annotations = make(map[string]string) + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := root.WorkspaceClient(ctx) + response, err := w.Apps.GetApps(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`. + cmd.ValidArgsFunction = cobra.NoFileCompletions + + // Apply optional overrides to this command. + for _, fn := range getAppsOverrides { + fn(cmd) + } + + return cmd +} + +func init() { + cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { + cmd.AddCommand(newGetApps()) + }) +} + +// start get-events 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 getEventsOverrides []func( + *cobra.Command, + *serving.GetEventsRequest, +) + +func newGetEvents() *cobra.Command { + cmd := &cobra.Command{} + + var getEventsReq serving.GetEventsRequest + + // TODO: short flags + + cmd.Use = "get-events NAME" + cmd.Short = `Get deployment events for an application.` + cmd.Long = `Get deployment events for an application. + + Get deployment events for an application` + + cmd.Annotations = make(map[string]string) + + cmd.Args = func(cmd *cobra.Command, args []string) error { + check := cobra.ExactArgs(1) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := root.WorkspaceClient(ctx) + + getEventsReq.Name = args[0] + + response, err := w.Apps.GetEvents(ctx, getEventsReq) + 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 getEventsOverrides { + fn(cmd, &getEventsReq) + } + + return cmd +} + +func init() { + cmdOverrides = append(cmdOverrides, func(cmd *cobra.Command) { + cmd.AddCommand(newGetEvents()) }) } diff --git a/cmd/workspace/cluster-policies/cluster-policies.go b/cmd/workspace/cluster-policies/cluster-policies.go index 1412b460..80608718 100755 --- a/cmd/workspace/cluster-policies/cluster-policies.go +++ b/cmd/workspace/cluster-policies/cluster-policies.go @@ -19,29 +19,27 @@ var cmdOverrides []func(*cobra.Command) func New() *cobra.Command { cmd := &cobra.Command{ Use: "cluster-policies", - Short: `Cluster policy limits the ability to configure clusters based on a set of rules.`, - Long: `Cluster policy limits the ability to configure clusters based on a set of - rules. The policy rules limit the attributes or attribute values available for - cluster creation. Cluster policies have ACLs that limit their use to specific - users and groups. + Short: `You can use cluster policies to control users' ability to configure clusters based on a set of rules.`, + Long: `You can use cluster policies to control users' ability to configure clusters + based on a set of rules. These rules specify which attributes or attribute + values can be used during cluster creation. Cluster policies have ACLs that + limit their use to specific users and groups. - Cluster policies let you limit users to create clusters with prescribed - settings, simplify the user interface and enable more users to create their - own clusters (by fixing and hiding some values), control cost by limiting per - cluster maximum cost (by setting limits on attributes whose values contribute - to hourly price). + With cluster policies, you can: - Auto-install cluster libraries on the next + restart by listing them in the policy's "libraries" field. - Limit users to + creating clusters with the prescribed settings. - Simplify the user interface, + enabling more users to create clusters, by fixing and hiding some fields. - + Manage costs by setting limits on attributes that impact the hourly rate. Cluster policy permissions limit which policies a user can select in the - Policy drop-down when the user creates a cluster: - A user who has cluster - create permission can select the Unrestricted policy and create - fully-configurable clusters. - A user who has both cluster create permission - and access to cluster policies can select the Unrestricted policy and policies - they have access to. - A user that has access to only cluster policies, can - select the policies they have access to. - - If no policies have been created in the workspace, the Policy drop-down does - not display. + Policy drop-down when the user creates a cluster: - A user who has + unrestricted cluster create permission can select the Unrestricted policy and + create fully-configurable clusters. - A user who has both unrestricted cluster + create permission and access to cluster policies can select the Unrestricted + policy and policies they have access to. - A user that has access to only + cluster policies, can select the policies they have access to. + If no policies exist in the workspace, the Policy drop-down doesn't appear. Only admin users can create, edit, and delete policies. Admin users also have access to all policies.`, GroupID: "compute", @@ -78,6 +76,7 @@ func newCreate() *cobra.Command { cmd.Flags().StringVar(&createReq.Definition, "definition", createReq.Definition, `Policy definition document expressed in Databricks Cluster Policy Definition Language.`) cmd.Flags().StringVar(&createReq.Description, "description", createReq.Description, `Additional human-readable description of the cluster policy.`) + // TODO: array: libraries cmd.Flags().Int64Var(&createReq.MaxClustersPerUser, "max-clusters-per-user", createReq.MaxClustersPerUser, `Max number of clusters per user that can be active using this policy.`) cmd.Flags().StringVar(&createReq.PolicyFamilyDefinitionOverrides, "policy-family-definition-overrides", createReq.PolicyFamilyDefinitionOverrides, `Policy definition JSON document expressed in Databricks Policy Definition Language.`) cmd.Flags().StringVar(&createReq.PolicyFamilyId, "policy-family-id", createReq.PolicyFamilyId, `ID of the policy family.`) @@ -245,6 +244,7 @@ func newEdit() *cobra.Command { cmd.Flags().StringVar(&editReq.Definition, "definition", editReq.Definition, `Policy definition document expressed in Databricks Cluster Policy Definition Language.`) cmd.Flags().StringVar(&editReq.Description, "description", editReq.Description, `Additional human-readable description of the cluster policy.`) + // TODO: array: libraries cmd.Flags().Int64Var(&editReq.MaxClustersPerUser, "max-clusters-per-user", editReq.MaxClustersPerUser, `Max number of clusters per user that can be active using this policy.`) cmd.Flags().StringVar(&editReq.PolicyFamilyDefinitionOverrides, "policy-family-definition-overrides", editReq.PolicyFamilyDefinitionOverrides, `Policy definition JSON document expressed in Databricks Policy Definition Language.`) cmd.Flags().StringVar(&editReq.PolicyFamilyId, "policy-family-id", editReq.PolicyFamilyId, `ID of the policy family.`) diff --git a/cmd/workspace/external-locations/external-locations.go b/cmd/workspace/external-locations/external-locations.go index a5c69259..2803f186 100755 --- a/cmd/workspace/external-locations/external-locations.go +++ b/cmd/workspace/external-locations/external-locations.go @@ -343,6 +343,7 @@ func newUpdate() *cobra.Command { cmd.Flags().StringVar(&updateReq.Name, "name", updateReq.Name, `Name of the external location.`) cmd.Flags().StringVar(&updateReq.Owner, "owner", updateReq.Owner, `The owner of the external location.`) cmd.Flags().BoolVar(&updateReq.ReadOnly, "read-only", updateReq.ReadOnly, `Indicates whether the external location is read-only.`) + cmd.Flags().BoolVar(&updateReq.SkipValidation, "skip-validation", updateReq.SkipValidation, `Skips validation of the storage credential associated with the external location.`) cmd.Flags().StringVar(&updateReq.Url, "url", updateReq.Url, `Path URL of the external location.`) cmd.Use = "update NAME" diff --git a/cmd/workspace/functions/functions.go b/cmd/workspace/functions/functions.go index 911c6d14..6510fce6 100755 --- a/cmd/workspace/functions/functions.go +++ b/cmd/workspace/functions/functions.go @@ -46,24 +46,18 @@ func New() *cobra.Command { // Functions can be added from the `init()` function in manually curated files in this directory. var createOverrides []func( *cobra.Command, - *catalog.CreateFunction, + *catalog.CreateFunctionRequest, ) func newCreate() *cobra.Command { cmd := &cobra.Command{} - var createReq catalog.CreateFunction + var createReq catalog.CreateFunctionRequest var createJson flags.JsonFlag // TODO: short flags cmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) - cmd.Flags().StringVar(&createReq.Comment, "comment", createReq.Comment, `User-provided free-form text description.`) - cmd.Flags().StringVar(&createReq.ExternalLanguage, "external-language", createReq.ExternalLanguage, `External function language.`) - cmd.Flags().StringVar(&createReq.ExternalName, "external-name", createReq.ExternalName, `External function name.`) - // TODO: map via StringToStringVar: properties - cmd.Flags().StringVar(&createReq.SqlPath, "sql-path", createReq.SqlPath, `List of schemes whose objects can be referenced without qualification.`) - cmd.Use = "create" cmd.Short = `Create a function.` cmd.Long = `Create a function. diff --git a/cmd/workspace/jobs/jobs.go b/cmd/workspace/jobs/jobs.go index 7759539e..218975ec 100755 --- a/cmd/workspace/jobs/jobs.go +++ b/cmd/workspace/jobs/jobs.go @@ -793,6 +793,7 @@ func newGetRun() *cobra.Command { // TODO: short flags cmd.Flags().BoolVar(&getRunReq.IncludeHistory, "include-history", getRunReq.IncludeHistory, `Whether to include the repair history in the response.`) + cmd.Flags().BoolVar(&getRunReq.IncludeResolvedValues, "include-resolved-values", getRunReq.IncludeResolvedValues, `Whether to include resolved parameter values in the response.`) cmd.Use = "get-run RUN_ID" cmd.Short = `Get a single job run.` diff --git a/cmd/workspace/metastores/metastores.go b/cmd/workspace/metastores/metastores.go index d74c9bbc..ef473df2 100755 --- a/cmd/workspace/metastores/metastores.go +++ b/cmd/workspace/metastores/metastores.go @@ -153,12 +153,17 @@ func newCreate() *cobra.Command { cmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) cmd.Flags().StringVar(&createReq.Region, "region", createReq.Region, `Cloud region which the metastore serves (e.g., us-west-2, westus).`) + cmd.Flags().StringVar(&createReq.StorageRoot, "storage-root", createReq.StorageRoot, `The storage root URL for metastore.`) - cmd.Use = "create NAME STORAGE_ROOT" + cmd.Use = "create NAME" cmd.Short = `Create a metastore.` cmd.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 optional storage root + path. By default (if the __owner__ field is not set), the owner of the new + metastore is the user calling the __createMetastore__ API. If the __owner__ + field is set to the empty string (**""**), the ownership is assigned to the + System User instead.` cmd.Annotations = make(map[string]string) @@ -166,11 +171,11 @@ func newCreate() *cobra.Command { if cmd.Flags().Changed("json") { err := cobra.ExactArgs(0)(cmd, args) if err != nil { - return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name', 'storage_root' in your JSON input") + return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'name' in your JSON input") } return nil } - check := cobra.ExactArgs(2) + check := cobra.ExactArgs(1) return check(cmd, args) } @@ -188,9 +193,6 @@ func newCreate() *cobra.Command { if !cmd.Flags().Changed("json") { createReq.Name = args[0] } - if !cmd.Flags().Changed("json") { - createReq.StorageRoot = args[1] - } response, err := w.Metastores.Create(ctx, createReq) if err != nil { @@ -696,7 +698,8 @@ func newUpdate() *cobra.Command { cmd.Long = `Update a metastore. Updates information for a specific metastore. The caller must be a metastore - admin.` + admin. If the __owner__ field is set to the empty string (**""**), the + ownership is updated to the System User.` cmd.Annotations = make(map[string]string) diff --git a/cmd/workspace/users/users.go b/cmd/workspace/users/users.go index 97b6dcde..daa95df3 100755 --- a/cmd/workspace/users/users.go +++ b/cmd/workspace/users/users.go @@ -67,7 +67,7 @@ func newCreate() *cobra.Command { cmd.Flags().StringVar(&createReq.DisplayName, "display-name", createReq.DisplayName, `String that represents a concatenation of given and family names.`) // TODO: array: emails // TODO: array: entitlements - cmd.Flags().StringVar(&createReq.ExternalId, "external-id", createReq.ExternalId, ``) + cmd.Flags().StringVar(&createReq.ExternalId, "external-id", createReq.ExternalId, `External ID is not currently supported.`) // TODO: array: groups cmd.Flags().StringVar(&createReq.Id, "id", createReq.Id, `Databricks user ID.`) // TODO: complex arg: name @@ -623,7 +623,7 @@ func newUpdate() *cobra.Command { cmd.Flags().StringVar(&updateReq.DisplayName, "display-name", updateReq.DisplayName, `String that represents a concatenation of given and family names.`) // TODO: array: emails // TODO: array: entitlements - cmd.Flags().StringVar(&updateReq.ExternalId, "external-id", updateReq.ExternalId, ``) + cmd.Flags().StringVar(&updateReq.ExternalId, "external-id", updateReq.ExternalId, `External ID is not currently supported.`) // TODO: array: groups cmd.Flags().StringVar(&updateReq.Id, "id", updateReq.Id, `Databricks user ID.`) // TODO: complex arg: name diff --git a/go.mod b/go.mod index 5b108a52..7cef4cd4 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/briandowns/spinner v1.23.0 // Apache 2.0 - github.com/databricks/databricks-sdk-go v0.24.0 // Apache 2.0 + github.com/databricks/databricks-sdk-go v0.25.0 // Apache 2.0 github.com/fatih/color v1.16.0 // MIT github.com/ghodss/yaml v1.0.0 // MIT + NOTICE github.com/google/uuid v1.4.0 // BSD-3-Clause @@ -55,11 +55,11 @@ require ( golang.org/x/crypto v0.15.0 // indirect golang.org/x/net v0.18.0 // indirect golang.org/x/sys v0.14.0 // indirect - golang.org/x/time v0.3.0 // indirect - google.golang.org/api v0.148.0 // indirect + golang.org/x/time v0.4.0 // indirect + google.golang.org/api v0.150.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231012201019-e917dd12ba7a // indirect - google.golang.org/grpc v1.58.3 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect + google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 3959456d..25409bd6 100644 --- a/go.sum +++ b/go.sum @@ -31,8 +31,8 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= -github.com/databricks/databricks-sdk-go v0.24.0 h1:fx34MOGYXVc72QBSFnKuDa/H3ekDMqZYH4jKZF8mrXk= -github.com/databricks/databricks-sdk-go v0.24.0/go.mod h1:a6rErRNh5bz+IJbO07nwW70iGyvtWidy1p/S5thepXI= +github.com/databricks/databricks-sdk-go v0.25.0 h1:qEpYHQ18HHqLIsIXXHhixakTtt6Q0tT3m34xws6BuZ8= +github.com/databricks/databricks-sdk-go v0.25.0/go.mod h1:s3/f2T8UGyKkcMywIyporj/Kb/lsiWkiksT/C84Swrs= 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= @@ -234,8 +234,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.4.0 h1:Z81tqI5ddIoXDPvVQ7/7CC9TnLM7ubaFG2qXYd5BbYY= +golang.org/x/time v0.4.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -248,8 +248,8 @@ golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.148.0 h1:HBq4TZlN4/1pNcu0geJZ/Q50vIwIXT532UIMYoo0vOs= -google.golang.org/api v0.148.0/go.mod h1:8/TBgwaKjfqTdacOJrOv2+2Q6fBDU1uHKK06oGSkxzU= +google.golang.org/api v0.150.0 h1:Z9k22qD289SZ8gCJrk4DrWXkNjtfvKAUo/l1ma8eBYE= +google.golang.org/api v0.150.0/go.mod h1:ccy+MJ6nrYFgE3WgRx/AMXOxOmU8Q4hSa+jjibzhxcg= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= @@ -257,15 +257,15 @@ google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231012201019-e917dd12ba7a h1:a2MQQVoTo96JC9PMGtGBymLp7+/RzpFc2yX/9WfFg1c= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:4cYg8o5yUbm77w8ZX00LhMVNl/YVBFJRYWDc0uYWMs0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 h1:AB/lmRny7e2pLhFEYIbl5qkDAUt2h0ZRO4wGPhZf+ik= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405/go.mod h1:67X1fPuzjcrkymZzZV1vvkFeTn2Rvc6lYF9MYFGCcwE= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=