Merge remote-tracking branch 'origin' into auth-validate

This commit is contained in:
Shreyas Goenka 2025-02-10 14:26:23 +01:00
commit 7e141f5184
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
29 changed files with 1116 additions and 27 deletions

View File

@ -1 +1 @@
0be1b914249781b5e903b7676fd02255755bc851
c72c58f97b950fcb924a90ef164bcb10cfcd5ece

5
.gitattributes vendored
View File

@ -1,11 +1,13 @@
cmd/account/access-control/access-control.go linguist-generated=true
cmd/account/billable-usage/billable-usage.go linguist-generated=true
cmd/account/budget-policy/budget-policy.go linguist-generated=true
cmd/account/budgets/budgets.go linguist-generated=true
cmd/account/cmd.go linguist-generated=true
cmd/account/credentials/credentials.go linguist-generated=true
cmd/account/csp-enablement-account/csp-enablement-account.go linguist-generated=true
cmd/account/custom-app-integration/custom-app-integration.go linguist-generated=true
cmd/account/disable-legacy-features/disable-legacy-features.go linguist-generated=true
cmd/account/enable-ip-access-lists/enable-ip-access-lists.go linguist-generated=true
cmd/account/encryption-keys/encryption-keys.go linguist-generated=true
cmd/account/esm-enablement-account/esm-enablement-account.go linguist-generated=true
cmd/account/federation-policy/federation-policy.go linguist-generated=true
@ -75,6 +77,7 @@ cmd/workspace/instance-pools/instance-pools.go linguist-generated=true
cmd/workspace/instance-profiles/instance-profiles.go linguist-generated=true
cmd/workspace/ip-access-lists/ip-access-lists.go linguist-generated=true
cmd/workspace/jobs/jobs.go linguist-generated=true
cmd/workspace/lakeview-embedded/lakeview-embedded.go linguist-generated=true
cmd/workspace/lakeview/lakeview.go linguist-generated=true
cmd/workspace/libraries/libraries.go linguist-generated=true
cmd/workspace/metastores/metastores.go linguist-generated=true
@ -99,11 +102,13 @@ cmd/workspace/providers/providers.go linguist-generated=true
cmd/workspace/quality-monitors/quality-monitors.go linguist-generated=true
cmd/workspace/queries-legacy/queries-legacy.go linguist-generated=true
cmd/workspace/queries/queries.go linguist-generated=true
cmd/workspace/query-execution/query-execution.go linguist-generated=true
cmd/workspace/query-history/query-history.go linguist-generated=true
cmd/workspace/query-visualizations-legacy/query-visualizations-legacy.go linguist-generated=true
cmd/workspace/query-visualizations/query-visualizations.go linguist-generated=true
cmd/workspace/recipient-activation/recipient-activation.go linguist-generated=true
cmd/workspace/recipients/recipients.go linguist-generated=true
cmd/workspace/redash-config/redash-config.go linguist-generated=true
cmd/workspace/registered-models/registered-models.go linguist-generated=true
cmd/workspace/repos/repos.go linguist-generated=true
cmd/workspace/resource-quotas/resource-quotas.go linguist-generated=true

View File

@ -23,6 +23,7 @@ Error: failed during request visitor: parse "https://${var.host}": invalid chara
"host": "${var.host}"
}
}
Exit code: 1
>>> errcode [CLI] bundle validate

View File

@ -281,6 +281,9 @@ github.com/databricks/cli/bundle/config/resources.Job:
"parameters":
"description": |-
Job-level parameter definitions
"performance_target":
"description": |-
PerformanceTarget defines how performant or cost efficient the execution of run on serverless should be.
"queue":
"description": |-
The queue settings of the job.
@ -1818,6 +1821,17 @@ github.com/databricks/databricks-sdk-go/service/jobs.PauseStatus:
UNPAUSED
- |-
PAUSED
github.com/databricks/databricks-sdk-go/service/jobs.PerformanceTarget:
"_":
"description": |-
PerformanceTarget defines how performant (lower latency) or cost efficient the execution of run on serverless compute should be.
The performance mode on the job or pipeline should map to a performance setting that is passed to Cluster Manager
(see cluster-common PerformanceTarget).
"enum":
- |-
PERFORMANCE_OPTIMIZED
- |-
COST_OPTIMIZED
github.com/databricks/databricks-sdk-go/service/jobs.PeriodicTriggerConfiguration:
"interval":
"description": |-

View File

@ -409,6 +409,10 @@
"description": "Job-level parameter definitions",
"$ref": "#/$defs/slice/github.com/databricks/databricks-sdk-go/service/jobs.JobParameterDefinition"
},
"performance_target": {
"description": "PerformanceTarget defines how performant or cost efficient the execution of run on serverless should be.",
"$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/jobs.PerformanceTarget"
},
"permissions": {
"$ref": "#/$defs/slice/github.com/databricks/cli/bundle/config/resources.Permission"
},
@ -3904,6 +3908,22 @@
}
]
},
"jobs.PerformanceTarget": {
"oneOf": [
{
"type": "string",
"description": "PerformanceTarget defines how performant (lower latency) or cost efficient the execution of run on serverless compute should be.\nThe performance mode on the job or pipeline should map to a performance setting that is passed to Cluster Manager\n(see cluster-common PerformanceTarget).",
"enum": [
"PERFORMANCE_OPTIMIZED",
"COST_OPTIMIZED"
]
},
{
"type": "string",
"pattern": "\\$\\{(var(\\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\\[[0-9]+\\])*)+)\\}"
}
]
},
"jobs.PeriodicTriggerConfiguration": {
"oneOf": [
{

373
cmd/account/budget-policy/budget-policy.go generated Executable file
View File

@ -0,0 +1,373 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package budget_policy
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/billing"
"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: "budget-policy",
Short: `A service serves REST API about Budget policies.`,
Long: `A service serves REST API about Budget policies`,
GroupID: "billing",
Annotations: map[string]string{
"package": "billing",
},
}
// Add methods
cmd.AddCommand(newCreate())
cmd.AddCommand(newDelete())
cmd.AddCommand(newGet())
cmd.AddCommand(newList())
cmd.AddCommand(newUpdate())
// 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,
*billing.CreateBudgetPolicyRequest,
)
func newCreate() *cobra.Command {
cmd := &cobra.Command{}
var createReq billing.CreateBudgetPolicyRequest
var createJson flags.JsonFlag
// TODO: short flags
cmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
// TODO: array: custom_tags
cmd.Flags().StringVar(&createReq.PolicyName, "policy-name", createReq.PolicyName, `The name of the policy.`)
cmd.Flags().StringVar(&createReq.RequestId, "request-id", createReq.RequestId, `A unique identifier for this request.`)
cmd.Use = "create"
cmd.Short = `Create a budget policy.`
cmd.Long = `Create a budget policy.
Creates a new policy.`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := root.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") {
diags := createJson.Unmarshal(&createReq)
if diags.HasError() {
return diags.Error()
}
if len(diags) > 0 {
err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags)
if err != nil {
return err
}
}
}
response, err := a.BudgetPolicy.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`.
cmd.ValidArgsFunction = cobra.NoFileCompletions
// Apply optional overrides to this command.
for _, fn := range createOverrides {
fn(cmd, &createReq)
}
return cmd
}
// start delete 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(
*cobra.Command,
*billing.DeleteBudgetPolicyRequest,
)
func newDelete() *cobra.Command {
cmd := &cobra.Command{}
var deleteReq billing.DeleteBudgetPolicyRequest
// TODO: short flags
cmd.Use = "delete POLICY_ID"
cmd.Short = `Delete a budget policy.`
cmd.Long = `Delete a budget policy.
Deletes a policy
Arguments:
POLICY_ID: The Id of the policy.`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := root.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)
deleteReq.PolicyId = args[0]
err = a.BudgetPolicy.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`.
cmd.ValidArgsFunction = cobra.NoFileCompletions
// Apply optional overrides to this command.
for _, fn := range deleteOverrides {
fn(cmd, &deleteReq)
}
return cmd
}
// 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,
*billing.GetBudgetPolicyRequest,
)
func newGet() *cobra.Command {
cmd := &cobra.Command{}
var getReq billing.GetBudgetPolicyRequest
// TODO: short flags
cmd.Use = "get POLICY_ID"
cmd.Short = `Get a budget policy.`
cmd.Long = `Get a budget policy.
Retrieves a policy by it's ID.
Arguments:
POLICY_ID: The Id of the policy.`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := root.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)
getReq.PolicyId = args[0]
response, err := a.BudgetPolicy.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`.
cmd.ValidArgsFunction = cobra.NoFileCompletions
// Apply optional overrides to this command.
for _, fn := range getOverrides {
fn(cmd, &getReq)
}
return cmd
}
// start list 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 listOverrides []func(
*cobra.Command,
*billing.ListBudgetPoliciesRequest,
)
func newList() *cobra.Command {
cmd := &cobra.Command{}
var listReq billing.ListBudgetPoliciesRequest
// TODO: short flags
// TODO: complex arg: filter_by
cmd.Flags().IntVar(&listReq.PageSize, "page-size", listReq.PageSize, `The maximum number of budget policies to return.`)
cmd.Flags().StringVar(&listReq.PageToken, "page-token", listReq.PageToken, `A page token, received from a previous ListServerlessPolicies call.`)
// TODO: complex arg: sort_spec
cmd.Use = "list"
cmd.Short = `List policies.`
cmd.Long = `List policies.
Lists all policies. Policies are returned in the alphabetically ascending
order of their names.`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := root.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)
response := a.BudgetPolicy.List(ctx, listReq)
return cmdio.RenderIterator(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 listOverrides {
fn(cmd, &listReq)
}
return cmd
}
// start update 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 updateOverrides []func(
*cobra.Command,
*billing.UpdateBudgetPolicyRequest,
)
func newUpdate() *cobra.Command {
cmd := &cobra.Command{}
var updateReq billing.UpdateBudgetPolicyRequest
updateReq.Policy = &billing.BudgetPolicy{}
var updateJson flags.JsonFlag
// TODO: short flags
cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
// TODO: array: custom_tags
cmd.Flags().StringVar(&updateReq.Policy.PolicyName, "policy-name", updateReq.Policy.PolicyName, `The name of the policy.`)
cmd.Use = "update POLICY_ID"
cmd.Short = `Update a budget policy.`
cmd.Long = `Update a budget policy.
Updates a policy
Arguments:
POLICY_ID: The Id of the policy. This field is generated by Databricks and globally
unique.`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") {
err := root.ExactArgs(0)(cmd, args)
if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'policy_id' in your JSON input")
}
return nil
}
check := root.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)
if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq.Policy)
if diags.HasError() {
return diags.Error()
}
if len(diags) > 0 {
err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags)
if err != nil {
return err
}
}
}
updateReq.PolicyId = args[0]
response, err := a.BudgetPolicy.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`.
cmd.ValidArgsFunction = cobra.NoFileCompletions
// Apply optional overrides to this command.
for _, fn := range updateOverrides {
fn(cmd, &updateReq)
}
return cmd
}
// end service BudgetPolicy

2
cmd/account/cmd.go generated
View File

@ -7,6 +7,7 @@ import (
account_access_control "github.com/databricks/cli/cmd/account/access-control"
billable_usage "github.com/databricks/cli/cmd/account/billable-usage"
budget_policy "github.com/databricks/cli/cmd/account/budget-policy"
budgets "github.com/databricks/cli/cmd/account/budgets"
credentials "github.com/databricks/cli/cmd/account/credentials"
custom_app_integration "github.com/databricks/cli/cmd/account/custom-app-integration"
@ -43,6 +44,7 @@ func New() *cobra.Command {
cmd.AddCommand(account_access_control.New())
cmd.AddCommand(billable_usage.New())
cmd.AddCommand(budget_policy.New())
cmd.AddCommand(credentials.New())
cmd.AddCommand(custom_app_integration.New())
cmd.AddCommand(encryption_keys.New())

View File

@ -65,6 +65,7 @@ func newCreate() *cobra.Command {
// TODO: array: redirect_urls
// TODO: array: scopes
// TODO: complex arg: token_access_policy
// TODO: array: user_authorized_scopes
cmd.Use = "create"
cmd.Short = `Create Custom OAuth App Integration.`
@ -309,6 +310,7 @@ func newUpdate() *cobra.Command {
// TODO: array: redirect_urls
// TODO: array: scopes
// TODO: complex arg: token_access_policy
// TODO: array: user_authorized_scopes
cmd.Use = "update INTEGRATION_ID"
cmd.Short = `Updates Custom OAuth App Integration.`

View File

@ -0,0 +1,218 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package enable_ip_access_lists
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: "enable-ip-access-lists",
Short: `Controls the enforcement of IP access lists for accessing the account console.`,
Long: `Controls the enforcement of IP access lists for accessing the account console.
Allowing you to enable or disable restricted access based on IP addresses.`,
// This service is being previewed; hide from help output.
Hidden: true,
}
// Add methods
cmd.AddCommand(newDelete())
cmd.AddCommand(newGet())
cmd.AddCommand(newUpdate())
// Apply optional overrides to this command.
for _, fn := range cmdOverrides {
fn(cmd)
}
return cmd
}
// start delete 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(
*cobra.Command,
*settings.DeleteAccountIpAccessEnableRequest,
)
func newDelete() *cobra.Command {
cmd := &cobra.Command{}
var deleteReq settings.DeleteAccountIpAccessEnableRequest
// TODO: short flags
cmd.Flags().StringVar(&deleteReq.Etag, "etag", deleteReq.Etag, `etag used for versioning.`)
cmd.Use = "delete"
cmd.Short = `Delete the account IP access toggle setting.`
cmd.Long = `Delete the account IP access toggle setting.
Reverts the value of the account IP access toggle setting to default (ON)`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := root.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)
response, err := a.Settings.EnableIpAccessLists().Delete(ctx, deleteReq)
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 deleteOverrides {
fn(cmd, &deleteReq)
}
return cmd
}
// 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,
*settings.GetAccountIpAccessEnableRequest,
)
func newGet() *cobra.Command {
cmd := &cobra.Command{}
var getReq settings.GetAccountIpAccessEnableRequest
// TODO: short flags
cmd.Flags().StringVar(&getReq.Etag, "etag", getReq.Etag, `etag used for versioning.`)
cmd.Use = "get"
cmd.Short = `Get the account IP access toggle setting.`
cmd.Long = `Get the account IP access toggle setting.
Gets the value of the account IP access toggle setting.`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := root.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)
response, err := a.Settings.EnableIpAccessLists().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`.
cmd.ValidArgsFunction = cobra.NoFileCompletions
// Apply optional overrides to this command.
for _, fn := range getOverrides {
fn(cmd, &getReq)
}
return cmd
}
// start update 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 updateOverrides []func(
*cobra.Command,
*settings.UpdateAccountIpAccessEnableRequest,
)
func newUpdate() *cobra.Command {
cmd := &cobra.Command{}
var updateReq settings.UpdateAccountIpAccessEnableRequest
var updateJson flags.JsonFlag
// TODO: short flags
cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
cmd.Use = "update"
cmd.Short = `Update the account IP access toggle setting.`
cmd.Long = `Update the account IP access toggle setting.
Updates the value of the account IP access toggle setting.`
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)
if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq)
if diags.HasError() {
return diags.Error()
}
if len(diags) > 0 {
err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags)
if err != nil {
return err
}
}
} else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
}
response, err := a.Settings.EnableIpAccessLists().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`.
cmd.ValidArgsFunction = cobra.NoFileCompletions
// Apply optional overrides to this command.
for _, fn := range updateOverrides {
fn(cmd, &updateReq)
}
return cmd
}
// end service EnableIpAccessLists

View File

@ -71,9 +71,6 @@ func New() *cobra.Command {
Annotations: map[string]string{
"package": "oauth2",
},
// This service is being previewed; hide from help output.
Hidden: true,
}
// Add methods

View File

@ -78,9 +78,6 @@ func New() *cobra.Command {
Annotations: map[string]string{
"package": "oauth2",
},
// This service is being previewed; hide from help output.
Hidden: true,
}
// Add methods

View File

@ -7,6 +7,7 @@ import (
csp_enablement_account "github.com/databricks/cli/cmd/account/csp-enablement-account"
disable_legacy_features "github.com/databricks/cli/cmd/account/disable-legacy-features"
enable_ip_access_lists "github.com/databricks/cli/cmd/account/enable-ip-access-lists"
esm_enablement_account "github.com/databricks/cli/cmd/account/esm-enablement-account"
personal_compute "github.com/databricks/cli/cmd/account/personal-compute"
)
@ -29,6 +30,7 @@ func New() *cobra.Command {
// Add subservices
cmd.AddCommand(csp_enablement_account.New())
cmd.AddCommand(disable_legacy_features.New())
cmd.AddCommand(enable_ip_access_lists.New())
cmd.AddCommand(esm_enablement_account.New())
cmd.AddCommand(personal_compute.New())

View File

@ -173,6 +173,7 @@ task or a Python wheel task, the second example applies.
if err != nil {
return err
}
_, _ = cmd.OutOrStdout().Write([]byte{'\n'})
default:
return fmt.Errorf("unknown output type %s", root.OutputType(cmd))
}

View File

@ -74,6 +74,7 @@ func newSummaryCommand() *cobra.Command {
return err
}
_, _ = cmd.OutOrStdout().Write(buf)
_, _ = cmd.OutOrStdout().Write([]byte{'\n'})
default:
return fmt.Errorf("unknown output type %s", root.OutputType(cmd))
}

View File

@ -20,7 +20,9 @@ func renderJsonOutput(cmd *cobra.Command, b *bundle.Bundle) error {
if err != nil {
return err
}
_, _ = cmd.OutOrStdout().Write(buf)
out := cmd.OutOrStdout()
_, _ = out.Write(buf)
_, _ = out.Write([]byte{'\n'})
return nil
}

View File

@ -335,10 +335,17 @@ func newUpdate() *cobra.Command {
Arguments:
ID:
UPDATE_MASK: Field mask is required to be passed into the PATCH request. Field mask
specifies which fields of the setting payload will be updated. The field
mask needs to be supplied as single string. To specify multiple fields in
the field mask, use comma as the separator (no space).`
UPDATE_MASK: The field mask must be a single string, with multiple fields separated by
commas (no spaces). The field path is relative to the resource object,
using a dot (.) to navigate sub-fields (e.g., author.given_name).
Specification of elements in sequence or map fields is not allowed, as
only the entire collection field can be specified. Field names must
exactly match the resource field names.
A field mask of * indicates full replacement. Its recommended to
always explicitly list the fields being updated and avoid using *
wildcards, as it can lead to unintended results if the API changes in the
future.`
cmd.Annotations = make(map[string]string)

View File

@ -342,6 +342,7 @@ func newUpdate() *cobra.Command {
cmd.Flags().Var(&updateReq.EnablePredictiveOptimization, "enable-predictive-optimization", `Whether predictive optimization should be enabled for this object and objects under it. Supported values: [DISABLE, ENABLE, INHERIT]`)
cmd.Flags().Var(&updateReq.IsolationMode, "isolation-mode", `Whether the current securable is accessible from all workspaces or a specific set of workspaces. Supported values: [ISOLATED, OPEN]`)
cmd.Flags().StringVar(&updateReq.NewName, "new-name", updateReq.NewName, `New name for the catalog.`)
// TODO: map via StringToStringVar: options
cmd.Flags().StringVar(&updateReq.Owner, "owner", updateReq.Owner, `Username of current owner of catalog.`)
// TODO: map via StringToStringVar: properties

View File

@ -75,8 +75,9 @@ func newCreate() *cobra.Command {
Create a new clean room with the specified collaborators. This method is
asynchronous; the returned name field inside the clean_room field can be used
to poll the clean room status, using the :method:cleanrooms/get method. When
this method returns, the cluster will be in a PROVISIONING state. The cluster
will be usable once it enters an ACTIVE state.
this method returns, the clean room will be in a PROVISIONING state, with only
name, owner, comment, created_at and status populated. The clean room will be
usable once it enters an ACTIVE state.
The caller must be a metastore admin or have the **CREATE_CLEAN_ROOM**
privilege on the metastore.`

6
cmd/workspace/cmd.go generated
View File

@ -39,6 +39,7 @@ import (
ip_access_lists "github.com/databricks/cli/cmd/workspace/ip-access-lists"
jobs "github.com/databricks/cli/cmd/workspace/jobs"
lakeview "github.com/databricks/cli/cmd/workspace/lakeview"
lakeview_embedded "github.com/databricks/cli/cmd/workspace/lakeview-embedded"
libraries "github.com/databricks/cli/cmd/workspace/libraries"
metastores "github.com/databricks/cli/cmd/workspace/metastores"
model_registry "github.com/databricks/cli/cmd/workspace/model-registry"
@ -62,11 +63,13 @@ import (
quality_monitors "github.com/databricks/cli/cmd/workspace/quality-monitors"
queries "github.com/databricks/cli/cmd/workspace/queries"
queries_legacy "github.com/databricks/cli/cmd/workspace/queries-legacy"
query_execution "github.com/databricks/cli/cmd/workspace/query-execution"
query_history "github.com/databricks/cli/cmd/workspace/query-history"
query_visualizations "github.com/databricks/cli/cmd/workspace/query-visualizations"
query_visualizations_legacy "github.com/databricks/cli/cmd/workspace/query-visualizations-legacy"
recipient_activation "github.com/databricks/cli/cmd/workspace/recipient-activation"
recipients "github.com/databricks/cli/cmd/workspace/recipients"
redash_config "github.com/databricks/cli/cmd/workspace/redash-config"
registered_models "github.com/databricks/cli/cmd/workspace/registered-models"
repos "github.com/databricks/cli/cmd/workspace/repos"
resource_quotas "github.com/databricks/cli/cmd/workspace/resource-quotas"
@ -133,6 +136,7 @@ func All() []*cobra.Command {
out = append(out, ip_access_lists.New())
out = append(out, jobs.New())
out = append(out, lakeview.New())
out = append(out, lakeview_embedded.New())
out = append(out, libraries.New())
out = append(out, metastores.New())
out = append(out, model_registry.New())
@ -156,11 +160,13 @@ func All() []*cobra.Command {
out = append(out, quality_monitors.New())
out = append(out, queries.New())
out = append(out, queries_legacy.New())
out = append(out, query_execution.New())
out = append(out, query_history.New())
out = append(out, query_visualizations.New())
out = append(out, query_visualizations_legacy.New())
out = append(out, recipient_activation.New())
out = append(out, recipients.New())
out = append(out, redash_config.New())
out = append(out, registered_models.New())
out = append(out, repos.New())
out = append(out, resource_quotas.New())

View File

@ -1354,6 +1354,7 @@ func newRunNow() *cobra.Command {
// TODO: map via StringToStringVar: job_parameters
// TODO: map via StringToStringVar: notebook_params
// TODO: array: only
cmd.Flags().Var(&runNowReq.PerformanceTarget, "performance-target", `PerformanceTarget defines how performant or cost efficient the execution of run on serverless compute should be. Supported values: [COST_OPTIMIZED, PERFORMANCE_OPTIMIZED]`)
// TODO: complex arg: pipeline_params
// TODO: map via StringToStringVar: python_named_params
// TODO: array: python_params

View File

@ -0,0 +1,98 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package lakeview_embedded
import (
"github.com/databricks/cli/cmd/root"
"github.com/databricks/databricks-sdk-go/service/dashboards"
"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: "lakeview-embedded",
Short: `Token-based Lakeview APIs for embedding dashboards in external applications.`,
Long: `Token-based Lakeview APIs for embedding dashboards in external applications.`,
GroupID: "dashboards",
Annotations: map[string]string{
"package": "dashboards",
},
}
// Add methods
cmd.AddCommand(newGetPublishedDashboardEmbedded())
// Apply optional overrides to this command.
for _, fn := range cmdOverrides {
fn(cmd)
}
return cmd
}
// start get-published-dashboard-embedded 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 getPublishedDashboardEmbeddedOverrides []func(
*cobra.Command,
*dashboards.GetPublishedDashboardEmbeddedRequest,
)
func newGetPublishedDashboardEmbedded() *cobra.Command {
cmd := &cobra.Command{}
var getPublishedDashboardEmbeddedReq dashboards.GetPublishedDashboardEmbeddedRequest
// TODO: short flags
cmd.Use = "get-published-dashboard-embedded DASHBOARD_ID"
cmd.Short = `Read a published dashboard in an embedded ui.`
cmd.Long = `Read a published dashboard in an embedded ui.
Get the current published dashboard within an embedded context.
Arguments:
DASHBOARD_ID: UUID identifying the published dashboard.`
// This command is being previewed; hide from help output.
cmd.Hidden = true
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := root.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)
getPublishedDashboardEmbeddedReq.DashboardId = args[0]
err = w.LakeviewEmbedded.GetPublishedDashboardEmbedded(ctx, getPublishedDashboardEmbeddedReq)
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 getPublishedDashboardEmbeddedOverrides {
fn(cmd, &getPublishedDashboardEmbeddedReq)
}
return cmd
}
// end service LakeviewEmbedded

View File

@ -406,10 +406,17 @@ func newUpdate() *cobra.Command {
Arguments:
ID:
UPDATE_MASK: Field mask is required to be passed into the PATCH request. Field mask
specifies which fields of the setting payload will be updated. The field
mask needs to be supplied as single string. To specify multiple fields in
the field mask, use comma as the separator (no space).`
UPDATE_MASK: The field mask must be a single string, with multiple fields separated by
commas (no spaces). The field path is relative to the resource object,
using a dot (.) to navigate sub-fields (e.g., author.given_name).
Specification of elements in sequence or map fields is not allowed, as
only the entire collection field can be specified. Field names must
exactly match the resource field names.
A field mask of * indicates full replacement. Its recommended to
always explicitly list the fields being updated and avoid using *
wildcards, as it can lead to unintended results if the API changes in the
future.`
cmd.Annotations = make(map[string]string)

245
cmd/workspace/query-execution/query-execution.go generated Executable file
View File

@ -0,0 +1,245 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package query_execution
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/dashboards"
"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: "query-execution",
Short: `Query execution APIs for AI / BI Dashboards.`,
Long: `Query execution APIs for AI / BI Dashboards`,
GroupID: "dashboards",
Annotations: map[string]string{
"package": "dashboards",
},
// This service is being previewed; hide from help output.
Hidden: true,
}
// Add methods
cmd.AddCommand(newCancelPublishedQueryExecution())
cmd.AddCommand(newExecutePublishedDashboardQuery())
cmd.AddCommand(newPollPublishedQueryStatus())
// Apply optional overrides to this command.
for _, fn := range cmdOverrides {
fn(cmd)
}
return cmd
}
// start cancel-published-query-execution 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 cancelPublishedQueryExecutionOverrides []func(
*cobra.Command,
*dashboards.CancelPublishedQueryExecutionRequest,
)
func newCancelPublishedQueryExecution() *cobra.Command {
cmd := &cobra.Command{}
var cancelPublishedQueryExecutionReq dashboards.CancelPublishedQueryExecutionRequest
// TODO: short flags
// TODO: array: tokens
cmd.Use = "cancel-published-query-execution DASHBOARD_NAME DASHBOARD_REVISION_ID"
cmd.Short = `Cancel the results for the a query for a published, embedded dashboard.`
cmd.Long = `Cancel the results for the a query for a published, embedded dashboard.`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := root.ExactArgs(2)
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)
cancelPublishedQueryExecutionReq.DashboardName = args[0]
cancelPublishedQueryExecutionReq.DashboardRevisionId = args[1]
response, err := w.QueryExecution.CancelPublishedQueryExecution(ctx, cancelPublishedQueryExecutionReq)
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 cancelPublishedQueryExecutionOverrides {
fn(cmd, &cancelPublishedQueryExecutionReq)
}
return cmd
}
// start execute-published-dashboard-query 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 executePublishedDashboardQueryOverrides []func(
*cobra.Command,
*dashboards.ExecutePublishedDashboardQueryRequest,
)
func newExecutePublishedDashboardQuery() *cobra.Command {
cmd := &cobra.Command{}
var executePublishedDashboardQueryReq dashboards.ExecutePublishedDashboardQueryRequest
var executePublishedDashboardQueryJson flags.JsonFlag
// TODO: short flags
cmd.Flags().Var(&executePublishedDashboardQueryJson, "json", `either inline JSON string or @path/to/file.json with request body`)
cmd.Flags().StringVar(&executePublishedDashboardQueryReq.OverrideWarehouseId, "override-warehouse-id", executePublishedDashboardQueryReq.OverrideWarehouseId, `A dashboard schedule can override the warehouse used as compute for processing the published dashboard queries.`)
cmd.Use = "execute-published-dashboard-query DASHBOARD_NAME DASHBOARD_REVISION_ID"
cmd.Short = `Execute a query for a published dashboard.`
cmd.Long = `Execute a query for a published dashboard.
Arguments:
DASHBOARD_NAME: Dashboard name and revision_id is required to retrieve
PublishedDatasetDataModel which contains the list of datasets,
warehouse_id, and embedded_credentials
DASHBOARD_REVISION_ID: `
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") {
err := root.ExactArgs(0)(cmd, args)
if err != nil {
return fmt.Errorf("when --json flag is specified, no positional arguments are required. Provide 'dashboard_name', 'dashboard_revision_id' in your JSON input")
}
return nil
}
check := root.ExactArgs(2)
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)
if cmd.Flags().Changed("json") {
diags := executePublishedDashboardQueryJson.Unmarshal(&executePublishedDashboardQueryReq)
if diags.HasError() {
return diags.Error()
}
if len(diags) > 0 {
err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags)
if err != nil {
return err
}
}
}
if !cmd.Flags().Changed("json") {
executePublishedDashboardQueryReq.DashboardName = args[0]
}
if !cmd.Flags().Changed("json") {
executePublishedDashboardQueryReq.DashboardRevisionId = args[1]
}
err = w.QueryExecution.ExecutePublishedDashboardQuery(ctx, executePublishedDashboardQueryReq)
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 executePublishedDashboardQueryOverrides {
fn(cmd, &executePublishedDashboardQueryReq)
}
return cmd
}
// start poll-published-query-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 pollPublishedQueryStatusOverrides []func(
*cobra.Command,
*dashboards.PollPublishedQueryStatusRequest,
)
func newPollPublishedQueryStatus() *cobra.Command {
cmd := &cobra.Command{}
var pollPublishedQueryStatusReq dashboards.PollPublishedQueryStatusRequest
// TODO: short flags
// TODO: array: tokens
cmd.Use = "poll-published-query-status DASHBOARD_NAME DASHBOARD_REVISION_ID"
cmd.Short = `Poll the results for the a query for a published, embedded dashboard.`
cmd.Long = `Poll the results for the a query for a published, embedded dashboard.`
cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := root.ExactArgs(2)
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)
pollPublishedQueryStatusReq.DashboardName = args[0]
pollPublishedQueryStatusReq.DashboardRevisionId = args[1]
response, err := w.QueryExecution.PollPublishedQueryStatus(ctx, pollPublishedQueryStatusReq)
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 pollPublishedQueryStatusOverrides {
fn(cmd, &pollPublishedQueryStatusReq)
}
return cmd
}
// end service QueryExecution

View File

@ -198,10 +198,17 @@ func newUpdate() *cobra.Command {
Arguments:
ID:
UPDATE_MASK: Field mask is required to be passed into the PATCH request. Field mask
specifies which fields of the setting payload will be updated. The field
mask needs to be supplied as single string. To specify multiple fields in
the field mask, use comma as the separator (no space).`
UPDATE_MASK: The field mask must be a single string, with multiple fields separated by
commas (no spaces). The field path is relative to the resource object,
using a dot (.) to navigate sub-fields (e.g., author.given_name).
Specification of elements in sequence or map fields is not allowed, as
only the entire collection field can be specified. Field names must
exactly match the resource field names.
A field mask of * indicates full replacement. Its recommended to
always explicitly list the fields being updated and avoid using *
wildcards, as it can lead to unintended results if the API changes in the
future.`
cmd.Annotations = make(map[string]string)

80
cmd/workspace/redash-config/redash-config.go generated Executable file
View File

@ -0,0 +1,80 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package redash_config
import (
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdio"
"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: "redash-config",
Short: `Redash V2 service for workspace configurations (internal).`,
Long: `Redash V2 service for workspace configurations (internal)`,
GroupID: "sql",
Annotations: map[string]string{
"package": "sql",
},
// This service is being previewed; hide from help output.
Hidden: true,
}
// Add methods
cmd.AddCommand(newGetConfig())
// Apply optional overrides to this command.
for _, fn := range cmdOverrides {
fn(cmd)
}
return cmd
}
// start get-config 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 getConfigOverrides []func(
*cobra.Command,
)
func newGetConfig() *cobra.Command {
cmd := &cobra.Command{}
cmd.Use = "get-config"
cmd.Short = `Read workspace configuration for Redash-v2.`
cmd.Long = `Read workspace configuration for Redash-v2.`
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.RedashConfig.GetConfig(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 getConfigOverrides {
fn(cmd)
}
return cmd
}
// end service RedashConfig

View File

@ -642,7 +642,8 @@ func newHttpRequest() *cobra.Command {
if err != nil {
return err
}
return cmdio.Render(ctx, response)
defer response.Contents.Close()
return cmdio.Render(ctx, response.Contents)
}
// Disable completions since they are not applicable.

2
go.mod
View File

@ -9,7 +9,7 @@ require (
github.com/BurntSushi/toml v1.4.0 // MIT
github.com/Masterminds/semver/v3 v3.3.1 // MIT
github.com/briandowns/spinner v1.23.1 // Apache 2.0
github.com/databricks/databricks-sdk-go v0.56.1 // Apache 2.0
github.com/databricks/databricks-sdk-go v0.57.0 // Apache 2.0
github.com/fatih/color v1.18.0 // MIT
github.com/google/uuid v1.6.0 // BSD-3-Clause
github.com/hashicorp/go-version v1.7.0 // MPL 2.0

4
go.sum generated
View File

@ -34,8 +34,8 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cyphar/filepath-securejoin v0.2.5 h1:6iR5tXJ/e6tJZzzdMc1km3Sa7RRIVBKAK32O2s7AYfo=
github.com/cyphar/filepath-securejoin v0.2.5/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
github.com/databricks/databricks-sdk-go v0.56.1 h1:sgweTRvAQaI8EPrfDnVdAB0lNX6L5uTT720SlMMQI2U=
github.com/databricks/databricks-sdk-go v0.56.1/go.mod h1:JpLizplEs+up9/Z4Xf2x++o3sM9eTTWFGzIXAptKJzI=
github.com/databricks/databricks-sdk-go v0.57.0 h1:Vs3a+Zmg403er4+xpD7ZTQWm7e51d2q3yYEyIIgvtYw=
github.com/databricks/databricks-sdk-go v0.57.0/go.mod h1:JpLizplEs+up9/Z4Xf2x++o3sM9eTTWFGzIXAptKJzI=
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=

View File

@ -76,7 +76,7 @@ Response.StatusCode = <response status-code here>
return apierr.APIError{
Message: "No stub found for pattern: " + pattern,
}, http.StatusNotFound
}, http.StatusNotImplemented
})
return s