Upgrade to Go SDK 0.47.0 (#1799)

## Changes
Upgrade to Go SDK 0.47.0

## Tests
<!-- How is this tested? -->
This commit is contained in:
Andrew Nester 2024-10-01 12:44:47 +02:00 committed by GitHub
parent da3b4f7c72
commit 84fc1ed131
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 851 additions and 49 deletions

View File

@ -1 +1 @@
d05898328669a3f8ab0c2ecee37db2673d3ea3f7 6f6b1371e640f2dfeba72d365ac566368656f6b6

3
.gitattributes vendored
View File

@ -6,6 +6,7 @@ cmd/account/cmd.go linguist-generated=true
cmd/account/credentials/credentials.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/csp-enablement-account/csp-enablement-account.go linguist-generated=true
cmd/account/custom-app-integration/custom-app-integration.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/encryption-keys/encryption-keys.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/esm-enablement-account/esm-enablement-account.go linguist-generated=true
cmd/account/groups/groups.go linguist-generated=true cmd/account/groups/groups.go linguist-generated=true
@ -52,6 +53,7 @@ cmd/workspace/dashboard-widgets/dashboard-widgets.go linguist-generated=true
cmd/workspace/dashboards/dashboards.go linguist-generated=true cmd/workspace/dashboards/dashboards.go linguist-generated=true
cmd/workspace/data-sources/data-sources.go linguist-generated=true cmd/workspace/data-sources/data-sources.go linguist-generated=true
cmd/workspace/default-namespace/default-namespace.go linguist-generated=true cmd/workspace/default-namespace/default-namespace.go linguist-generated=true
cmd/workspace/disable-legacy-access/disable-legacy-access.go linguist-generated=true
cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go linguist-generated=true cmd/workspace/enhanced-security-monitoring/enhanced-security-monitoring.go linguist-generated=true
cmd/workspace/experiments/experiments.go linguist-generated=true cmd/workspace/experiments/experiments.go linguist-generated=true
cmd/workspace/external-locations/external-locations.go linguist-generated=true cmd/workspace/external-locations/external-locations.go linguist-generated=true
@ -108,6 +110,7 @@ cmd/workspace/storage-credentials/storage-credentials.go linguist-generated=true
cmd/workspace/system-schemas/system-schemas.go linguist-generated=true cmd/workspace/system-schemas/system-schemas.go linguist-generated=true
cmd/workspace/table-constraints/table-constraints.go linguist-generated=true cmd/workspace/table-constraints/table-constraints.go linguist-generated=true
cmd/workspace/tables/tables.go linguist-generated=true cmd/workspace/tables/tables.go linguist-generated=true
cmd/workspace/temporary-table-credentials/temporary-table-credentials.go linguist-generated=true
cmd/workspace/token-management/token-management.go linguist-generated=true cmd/workspace/token-management/token-management.go linguist-generated=true
cmd/workspace/tokens/tokens.go linguist-generated=true cmd/workspace/tokens/tokens.go linguist-generated=true
cmd/workspace/users/users.go linguist-generated=true cmd/workspace/users/users.go linguist-generated=true

View File

@ -59,6 +59,127 @@
"cli": { "cli": {
"bundle": { "bundle": {
"config": { "config": {
"resources.Cluster": {
"anyOf": [
{
"type": "object",
"properties": {
"apply_policy_default_values": {
"description": "When set to true, fixed and default values from the policy will be used for fields that are omitted. When set to false, only fixed values from the policy will be applied.",
"$ref": "#/$defs/bool"
},
"autoscale": {
"description": "Parameters needed in order to automatically scale clusters up and down based on load.\nNote: autoscaling works best with DB runtime versions 3.0 or later.",
"$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/compute.AutoScale"
},
"autotermination_minutes": {
"description": "Automatically terminates the cluster after it is inactive for this time in minutes. If not set,\nthis cluster will not be automatically terminated. If specified, the threshold must be between\n10 and 10000 minutes.\nUsers can also set this value to 0 to explicitly disable automatic termination.",
"$ref": "#/$defs/int"
},
"aws_attributes": {
"description": "Attributes related to clusters running on Amazon Web Services.\nIf not specified at cluster creation, a set of default values will be used.",
"$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/compute.AwsAttributes"
},
"azure_attributes": {
"description": "Attributes related to clusters running on Microsoft Azure.\nIf not specified at cluster creation, a set of default values will be used.",
"$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/compute.AzureAttributes"
},
"cluster_log_conf": {
"description": "The configuration for delivering spark logs to a long-term storage destination.\nTwo kinds of destinations (dbfs and s3) are supported. Only one destination can be specified\nfor one cluster. If the conf is given, the logs will be delivered to the destination every\n`5 mins`. The destination of driver logs is `$destination/$clusterId/driver`, while\nthe destination of executor logs is `$destination/$clusterId/executor`.",
"$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/compute.ClusterLogConf"
},
"cluster_name": {
"description": "Cluster name requested by the user. This doesn't have to be unique.\nIf not specified at creation, the cluster name will be an empty string.\n",
"$ref": "#/$defs/string"
},
"custom_tags": {
"description": "Additional tags for cluster resources. Databricks will tag all cluster resources (e.g., AWS\ninstances and EBS volumes) with these tags in addition to `default_tags`. Notes:\n\n- Currently, Databricks allows at most 45 custom tags\n\n- Clusters can only reuse cloud resources if the resources' tags are a subset of the cluster tags",
"$ref": "#/$defs/map/string"
},
"data_security_mode": {
"$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/compute.DataSecurityMode"
},
"docker_image": {
"$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/compute.DockerImage"
},
"driver_instance_pool_id": {
"description": "The optional ID of the instance pool for the driver of the cluster belongs.\nThe pool cluster uses the instance pool with id (instance_pool_id) if the driver pool is not\nassigned.",
"$ref": "#/$defs/string"
},
"driver_node_type_id": {
"description": "The node type of the Spark driver. Note that this field is optional;\nif unset, the driver node type will be set as the same value\nas `node_type_id` defined above.\n",
"$ref": "#/$defs/string"
},
"enable_elastic_disk": {
"description": "Autoscaling Local Storage: when enabled, this cluster will dynamically acquire additional disk\nspace when its Spark workers are running low on disk space. This feature requires specific AWS\npermissions to function correctly - refer to the User Guide for more details.",
"$ref": "#/$defs/bool"
},
"enable_local_disk_encryption": {
"description": "Whether to enable LUKS on cluster VMs' local disks",
"$ref": "#/$defs/bool"
},
"gcp_attributes": {
"description": "Attributes related to clusters running on Google Cloud Platform.\nIf not specified at cluster creation, a set of default values will be used.",
"$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/compute.GcpAttributes"
},
"init_scripts": {
"description": "The configuration for storing init scripts. Any number of destinations can be specified. The scripts are executed sequentially in the order provided. If `cluster_log_conf` is specified, init script logs are sent to `\u003cdestination\u003e/\u003ccluster-ID\u003e/init_scripts`.",
"$ref": "#/$defs/slice/github.com/databricks/databricks-sdk-go/service/compute.InitScriptInfo"
},
"instance_pool_id": {
"description": "The optional ID of the instance pool to which the cluster belongs.",
"$ref": "#/$defs/string"
},
"node_type_id": {
"description": "This field encodes, through a single value, the resources available to each of\nthe Spark nodes in this cluster. For example, the Spark nodes can be provisioned\nand optimized for memory or compute intensive workloads. A list of available node\ntypes can be retrieved by using the :method:clusters/listNodeTypes API call.\n",
"$ref": "#/$defs/string"
},
"num_workers": {
"description": "Number of worker nodes that this cluster should have. A cluster has one Spark Driver\nand `num_workers` Executors for a total of `num_workers` + 1 Spark nodes.\n\nNote: When reading the properties of a cluster, this field reflects the desired number\nof workers rather than the actual current number of workers. For instance, if a cluster\nis resized from 5 to 10 workers, this field will immediately be updated to reflect\nthe target size of 10 workers, whereas the workers listed in `spark_info` will gradually\nincrease from 5 to 10 as the new nodes are provisioned.",
"$ref": "#/$defs/int"
},
"permissions": {
"$ref": "#/$defs/slice/github.com/databricks/cli/bundle/config/resources.Permission"
},
"policy_id": {
"description": "The ID of the cluster policy used to create the cluster if applicable.",
"$ref": "#/$defs/string"
},
"runtime_engine": {
"$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/compute.RuntimeEngine"
},
"single_user_name": {
"description": "Single user name if data_security_mode is `SINGLE_USER`",
"$ref": "#/$defs/string"
},
"spark_conf": {
"description": "An object containing a set of optional, user-specified Spark configuration key-value pairs.\nUsers can also pass in a string of extra JVM options to the driver and the executors via\n`spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` respectively.\n",
"$ref": "#/$defs/map/string"
},
"spark_env_vars": {
"description": "An object containing a set of optional, user-specified environment variable key-value pairs.\nPlease note that key-value pair of the form (X,Y) will be exported as is (i.e.,\n`export X='Y'`) while launching the driver and workers.\n\nIn order to specify an additional set of `SPARK_DAEMON_JAVA_OPTS`, we recommend appending\nthem to `$SPARK_DAEMON_JAVA_OPTS` as shown in the example below. This ensures that all\ndefault databricks managed environmental variables are included as well.\n\nExample Spark environment variables:\n`{\"SPARK_WORKER_MEMORY\": \"28000m\", \"SPARK_LOCAL_DIRS\": \"/local_disk0\"}` or\n`{\"SPARK_DAEMON_JAVA_OPTS\": \"$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true\"}`",
"$ref": "#/$defs/map/string"
},
"spark_version": {
"description": "The Spark version of the cluster, e.g. `3.3.x-scala2.11`.\nA list of available Spark versions can be retrieved by using\nthe :method:clusters/sparkVersions API call.\n",
"$ref": "#/$defs/string"
},
"ssh_public_keys": {
"description": "SSH public key contents that will be added to each Spark node in this cluster. The\ncorresponding private keys can be used to login with the user name `ubuntu` on port `2200`.\nUp to 10 keys can be specified.",
"$ref": "#/$defs/slice/string"
},
"workload_type": {
"$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/compute.WorkloadType"
}
},
"additionalProperties": false
},
{
"type": "string",
"pattern": "\\$\\{(var(\\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\\[[0-9]+\\])*)+)\\}"
}
]
},
"resources.Grant": { "resources.Grant": {
"anyOf": [ "anyOf": [
{ {
@ -109,7 +230,7 @@
"$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/jobs.JobEmailNotifications" "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/jobs.JobEmailNotifications"
}, },
"environments": { "environments": {
"description": "A list of task execution environment specifications that can be referenced by tasks of this job.", "description": "A list of task execution environment specifications that can be referenced by serverless tasks of this job.\nAn environment is required to be present for serverless tasks.\nFor serverless notebook tasks, the environment is accessible in the notebook environment panel.\nFor other serverless tasks, the task environment is required to be specified using environment_key in the task settings.",
"$ref": "#/$defs/slice/github.com/databricks/databricks-sdk-go/service/jobs.JobEnvironment" "$ref": "#/$defs/slice/github.com/databricks/databricks-sdk-go/service/jobs.JobEnvironment"
}, },
"format": { "format": {
@ -293,7 +414,7 @@
"$ref": "#/$defs/slice/github.com/databricks/cli/bundle/config/resources.Permission" "$ref": "#/$defs/slice/github.com/databricks/cli/bundle/config/resources.Permission"
}, },
"rate_limits": { "rate_limits": {
"description": "Rate limits to be applied to the serving endpoint. NOTE: only external and foundation model endpoints are supported as of now.", "description": "Rate limits to be applied to the serving endpoint. NOTE: this field is deprecated, please use AI Gateway to manage rate limits.",
"$ref": "#/$defs/slice/github.com/databricks/databricks-sdk-go/service/serving.RateLimit" "$ref": "#/$defs/slice/github.com/databricks/databricks-sdk-go/service/serving.RateLimit"
}, },
"route_optimized": { "route_optimized": {
@ -747,6 +868,9 @@
{ {
"type": "object", "type": "object",
"properties": { "properties": {
"cluster_id": {
"$ref": "#/$defs/string"
},
"compute_id": { "compute_id": {
"$ref": "#/$defs/string" "$ref": "#/$defs/string"
}, },
@ -923,6 +1047,9 @@
{ {
"type": "object", "type": "object",
"properties": { "properties": {
"clusters": {
"$ref": "#/$defs/map/github.com/databricks/cli/bundle/config/resources.Cluster"
},
"experiments": { "experiments": {
"$ref": "#/$defs/map/github.com/databricks/cli/bundle/config/resources.MlflowExperiment" "$ref": "#/$defs/map/github.com/databricks/cli/bundle/config/resources.MlflowExperiment"
}, },
@ -990,6 +1117,9 @@
"bundle": { "bundle": {
"$ref": "#/$defs/github.com/databricks/cli/bundle/config.Bundle" "$ref": "#/$defs/github.com/databricks/cli/bundle/config.Bundle"
}, },
"cluster_id": {
"$ref": "#/$defs/string"
},
"compute_id": { "compute_id": {
"$ref": "#/$defs/string" "$ref": "#/$defs/string"
}, },
@ -2028,7 +2158,7 @@
}, },
"compute.RuntimeEngine": { "compute.RuntimeEngine": {
"type": "string", "type": "string",
"description": "Decides which runtime engine to be use, e.g. Standard vs. Photon. If unspecified, the runtime\nengine is inferred from spark_version.", "description": "Determines the cluster's runtime engine, either standard or Photon.\n\nThis field is not compatible with legacy `spark_version` values that contain `-photon-`.\nRemove `-photon-` from the `spark_version` and set `runtime_engine` to `PHOTON`.\n\nIf left unspecified, the runtime engine defaults to standard unless the spark_version\ncontains -photon-, in which case Photon will be used.\n",
"enum": [ "enum": [
"NULL", "NULL",
"STANDARD", "STANDARD",
@ -2610,7 +2740,7 @@
"anyOf": [ "anyOf": [
{ {
"type": "object", "type": "object",
"description": "Write-only setting, available only in Create/Update/Reset and Submit calls. Specifies the user or service principal that the job runs as. If not specified, the job runs as the user who created the job.\n\nOnly `user_name` or `service_principal_name` can be specified. If both are specified, an error is thrown.", "description": "Write-only setting. Specifies the user, service principal or group that the job/pipeline runs as. If not specified, the job/pipeline runs as the user who created the job/pipeline.\n\nExactly one of `user_name`, `service_principal_name`, `group_name` should be specified. If not, an error is thrown.",
"properties": { "properties": {
"service_principal_name": { "service_principal_name": {
"description": "Application ID of an active service principal. Setting this field requires the `servicePrincipal/user` role.", "description": "Application ID of an active service principal. Setting this field requires the `servicePrincipal/user` role.",
@ -4904,6 +5034,20 @@
"cli": { "cli": {
"bundle": { "bundle": {
"config": { "config": {
"resources.Cluster": {
"anyOf": [
{
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/github.com/databricks/cli/bundle/config/resources.Cluster"
}
},
{
"type": "string",
"pattern": "\\$\\{(var(\\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\\[[0-9]+\\])*)+)\\}"
}
]
},
"resources.Job": { "resources.Job": {
"anyOf": [ "anyOf": [
{ {

View File

@ -0,0 +1,215 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package disable_legacy_features
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: "disable-legacy-features",
Short: `Disable legacy features for new Databricks workspaces.`,
Long: `Disable legacy features for new Databricks workspaces.
For newly created workspaces: 1. Disables the use of DBFS root and mounts. 2.
Hive Metastore will not be provisioned. 3. Disables the use of No-isolation
clusters. 4. Disables Databricks Runtime versions prior to 13.3LTS.`,
// 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.DeleteDisableLegacyFeaturesRequest,
)
func newDelete() *cobra.Command {
cmd := &cobra.Command{}
var deleteReq settings.DeleteDisableLegacyFeaturesRequest
// TODO: short flags
cmd.Flags().StringVar(&deleteReq.Etag, "etag", deleteReq.Etag, `etag used for versioning.`)
cmd.Use = "delete"
cmd.Short = `Delete the disable legacy features setting.`
cmd.Long = `Delete the disable legacy features setting.
Deletes the disable legacy features 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.DisableLegacyFeatures().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.GetDisableLegacyFeaturesRequest,
)
func newGet() *cobra.Command {
cmd := &cobra.Command{}
var getReq settings.GetDisableLegacyFeaturesRequest
// TODO: short flags
cmd.Flags().StringVar(&getReq.Etag, "etag", getReq.Etag, `etag used for versioning.`)
cmd.Use = "get"
cmd.Short = `Get the disable legacy features setting.`
cmd.Long = `Get the disable legacy features setting.
Gets the value of the disable legacy features 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.DisableLegacyFeatures().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.UpdateDisableLegacyFeaturesRequest,
)
func newUpdate() *cobra.Command {
cmd := &cobra.Command{}
var updateReq settings.UpdateDisableLegacyFeaturesRequest
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 disable legacy features setting.`
cmd.Long = `Update the disable legacy features setting.
Updates the value of the disable legacy features 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") {
err = updateJson.Unmarshal(&updateReq)
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.DisableLegacyFeatures().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 DisableLegacyFeatures

View File

@ -6,6 +6,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
csp_enablement_account "github.com/databricks/cli/cmd/account/csp-enablement-account" csp_enablement_account "github.com/databricks/cli/cmd/account/csp-enablement-account"
disable_legacy_features "github.com/databricks/cli/cmd/account/disable-legacy-features"
esm_enablement_account "github.com/databricks/cli/cmd/account/esm-enablement-account" esm_enablement_account "github.com/databricks/cli/cmd/account/esm-enablement-account"
personal_compute "github.com/databricks/cli/cmd/account/personal-compute" personal_compute "github.com/databricks/cli/cmd/account/personal-compute"
) )
@ -27,6 +28,7 @@ func New() *cobra.Command {
// Add subservices // Add subservices
cmd.AddCommand(csp_enablement_account.New()) cmd.AddCommand(csp_enablement_account.New())
cmd.AddCommand(disable_legacy_features.New())
cmd.AddCommand(esm_enablement_account.New()) cmd.AddCommand(esm_enablement_account.New())
cmd.AddCommand(personal_compute.New()) cmd.AddCommand(personal_compute.New())

View File

@ -75,8 +75,8 @@ func newCreate() *cobra.Command {
var createSkipWait bool var createSkipWait bool
var createTimeout time.Duration var createTimeout time.Duration
cmd.Flags().BoolVar(&createSkipWait, "no-wait", createSkipWait, `do not wait to reach IDLE state`) cmd.Flags().BoolVar(&createSkipWait, "no-wait", createSkipWait, `do not wait to reach ACTIVE state`)
cmd.Flags().DurationVar(&createTimeout, "timeout", 20*time.Minute, `maximum amount of time to reach IDLE state`) cmd.Flags().DurationVar(&createTimeout, "timeout", 20*time.Minute, `maximum amount of time to reach ACTIVE state`)
// TODO: short flags // TODO: short flags
cmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) cmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
@ -130,13 +130,13 @@ func newCreate() *cobra.Command {
} }
spinner := cmdio.Spinner(ctx) spinner := cmdio.Spinner(ctx)
info, err := wait.OnProgress(func(i *apps.App) { info, err := wait.OnProgress(func(i *apps.App) {
if i.Status == nil { if i.ComputeStatus == nil {
return return
} }
status := i.Status.State status := i.ComputeStatus.State
statusMessage := fmt.Sprintf("current status: %s", status) statusMessage := fmt.Sprintf("current status: %s", status)
if i.Status != nil { if i.ComputeStatus != nil {
statusMessage = i.Status.Message statusMessage = i.ComputeStatus.Message
} }
spinner <- statusMessage spinner <- statusMessage
}).GetWithTimeout(createTimeout) }).GetWithTimeout(createTimeout)
@ -198,11 +198,11 @@ func newDelete() *cobra.Command {
deleteReq.Name = args[0] deleteReq.Name = args[0]
err = w.Apps.Delete(ctx, deleteReq) response, err := w.Apps.Delete(ctx, deleteReq)
if err != nil { if err != nil {
return err return err
} }
return nil return cmdio.Render(ctx, response)
} }
// Disable completions since they are not applicable. // Disable completions since they are not applicable.
@ -240,35 +240,23 @@ func newDeploy() *cobra.Command {
// TODO: short flags // TODO: short flags
cmd.Flags().Var(&deployJson, "json", `either inline JSON string or @path/to/file.json with request body`) cmd.Flags().Var(&deployJson, "json", `either inline JSON string or @path/to/file.json with request body`)
cmd.Flags().StringVar(&deployReq.DeploymentId, "deployment-id", deployReq.DeploymentId, `The unique id of the deployment.`)
cmd.Flags().Var(&deployReq.Mode, "mode", `The mode of which the deployment will manage the source code. Supported values: [AUTO_SYNC, SNAPSHOT]`) cmd.Flags().Var(&deployReq.Mode, "mode", `The mode of which the deployment will manage the source code. Supported values: [AUTO_SYNC, SNAPSHOT]`)
cmd.Flags().StringVar(&deployReq.SourceCodePath, "source-code-path", deployReq.SourceCodePath, `The workspace file system path of the source code used to create the app deployment.`)
cmd.Use = "deploy APP_NAME SOURCE_CODE_PATH" cmd.Use = "deploy APP_NAME"
cmd.Short = `Create an app deployment.` cmd.Short = `Create an app deployment.`
cmd.Long = `Create an app deployment. cmd.Long = `Create an app deployment.
Creates an app deployment for the app with the supplied name. Creates an app deployment for the app with the supplied name.
Arguments: Arguments:
APP_NAME: The name of the app. APP_NAME: The name of the app.`
SOURCE_CODE_PATH: The workspace file system path of the source code used to create the app
deployment. This is different from
deployment_artifacts.source_code_path, which is the path used by the
deployed app. The former refers to the original source code location of
the app in the workspace during deployment creation, whereas the latter
provides a system generated stable snapshotted source code path used by
the deployment.`
cmd.Annotations = make(map[string]string) cmd.Annotations = make(map[string]string)
cmd.Args = func(cmd *cobra.Command, args []string) error { cmd.Args = func(cmd *cobra.Command, args []string) error {
if cmd.Flags().Changed("json") { check := root.ExactArgs(1)
err := root.ExactArgs(1)(cmd, args)
if err != nil {
return fmt.Errorf("when --json flag is specified, provide only APP_NAME as positional arguments. Provide 'source_code_path' in your JSON input")
}
return nil
}
check := root.ExactArgs(2)
return check(cmd, args) return check(cmd, args)
} }
@ -284,9 +272,6 @@ func newDeploy() *cobra.Command {
} }
} }
deployReq.AppName = args[0] deployReq.AppName = args[0]
if !cmd.Flags().Changed("json") {
deployReq.SourceCodePath = args[1]
}
wait, err := w.Apps.Deploy(ctx, deployReq) wait, err := w.Apps.Deploy(ctx, deployReq)
if err != nil { if err != nil {
@ -759,8 +744,8 @@ func newStart() *cobra.Command {
var startSkipWait bool var startSkipWait bool
var startTimeout time.Duration var startTimeout time.Duration
cmd.Flags().BoolVar(&startSkipWait, "no-wait", startSkipWait, `do not wait to reach SUCCEEDED state`) cmd.Flags().BoolVar(&startSkipWait, "no-wait", startSkipWait, `do not wait to reach ACTIVE state`)
cmd.Flags().DurationVar(&startTimeout, "timeout", 20*time.Minute, `maximum amount of time to reach SUCCEEDED state`) cmd.Flags().DurationVar(&startTimeout, "timeout", 20*time.Minute, `maximum amount of time to reach ACTIVE state`)
// TODO: short flags // TODO: short flags
cmd.Use = "start NAME" cmd.Use = "start NAME"
@ -794,14 +779,14 @@ func newStart() *cobra.Command {
return cmdio.Render(ctx, wait.Response) return cmdio.Render(ctx, wait.Response)
} }
spinner := cmdio.Spinner(ctx) spinner := cmdio.Spinner(ctx)
info, err := wait.OnProgress(func(i *apps.AppDeployment) { info, err := wait.OnProgress(func(i *apps.App) {
if i.Status == nil { if i.ComputeStatus == nil {
return return
} }
status := i.Status.State status := i.ComputeStatus.State
statusMessage := fmt.Sprintf("current status: %s", status) statusMessage := fmt.Sprintf("current status: %s", status)
if i.Status != nil { if i.ComputeStatus != nil {
statusMessage = i.Status.Message statusMessage = i.ComputeStatus.Message
} }
spinner <- statusMessage spinner <- statusMessage
}).GetWithTimeout(startTimeout) }).GetWithTimeout(startTimeout)
@ -838,6 +823,11 @@ func newStop() *cobra.Command {
var stopReq apps.StopAppRequest var stopReq apps.StopAppRequest
var stopSkipWait bool
var stopTimeout time.Duration
cmd.Flags().BoolVar(&stopSkipWait, "no-wait", stopSkipWait, `do not wait to reach STOPPED state`)
cmd.Flags().DurationVar(&stopTimeout, "timeout", 20*time.Minute, `maximum amount of time to reach STOPPED state`)
// TODO: short flags // TODO: short flags
cmd.Use = "stop NAME" cmd.Use = "stop NAME"
@ -863,11 +853,30 @@ func newStop() *cobra.Command {
stopReq.Name = args[0] stopReq.Name = args[0]
err = w.Apps.Stop(ctx, stopReq) wait, err := w.Apps.Stop(ctx, stopReq)
if err != nil { if err != nil {
return err return err
} }
return nil if stopSkipWait {
return cmdio.Render(ctx, wait.Response)
}
spinner := cmdio.Spinner(ctx)
info, err := wait.OnProgress(func(i *apps.App) {
if i.ComputeStatus == nil {
return
}
status := i.ComputeStatus.State
statusMessage := fmt.Sprintf("current status: %s", status)
if i.ComputeStatus != nil {
statusMessage = i.ComputeStatus.Message
}
spinner <- statusMessage
}).GetWithTimeout(stopTimeout)
close(spinner)
if err != nil {
return err
}
return cmdio.Render(ctx, info)
} }
// Disable completions since they are not applicable. // Disable completions since they are not applicable.

View File

@ -217,7 +217,7 @@ func newCreate() *cobra.Command {
cmd.Flags().StringVar(&createReq.NodeTypeId, "node-type-id", createReq.NodeTypeId, `This field encodes, through a single value, the resources available to each of the Spark nodes in this cluster.`) cmd.Flags().StringVar(&createReq.NodeTypeId, "node-type-id", createReq.NodeTypeId, `This field encodes, through a single value, the resources available to each of the Spark nodes in this cluster.`)
cmd.Flags().IntVar(&createReq.NumWorkers, "num-workers", createReq.NumWorkers, `Number of worker nodes that this cluster should have.`) cmd.Flags().IntVar(&createReq.NumWorkers, "num-workers", createReq.NumWorkers, `Number of worker nodes that this cluster should have.`)
cmd.Flags().StringVar(&createReq.PolicyId, "policy-id", createReq.PolicyId, `The ID of the cluster policy used to create the cluster if applicable.`) cmd.Flags().StringVar(&createReq.PolicyId, "policy-id", createReq.PolicyId, `The ID of the cluster policy used to create the cluster if applicable.`)
cmd.Flags().Var(&createReq.RuntimeEngine, "runtime-engine", `Decides which runtime engine to be use, e.g. Supported values: [NULL, PHOTON, STANDARD]`) cmd.Flags().Var(&createReq.RuntimeEngine, "runtime-engine", `Determines the cluster's runtime engine, either standard or Photon. Supported values: [NULL, PHOTON, STANDARD]`)
cmd.Flags().StringVar(&createReq.SingleUserName, "single-user-name", createReq.SingleUserName, `Single user name if data_security_mode is SINGLE_USER.`) cmd.Flags().StringVar(&createReq.SingleUserName, "single-user-name", createReq.SingleUserName, `Single user name if data_security_mode is SINGLE_USER.`)
// TODO: map via StringToStringVar: spark_conf // TODO: map via StringToStringVar: spark_conf
// TODO: map via StringToStringVar: spark_env_vars // TODO: map via StringToStringVar: spark_env_vars
@ -237,6 +237,12 @@ func newCreate() *cobra.Command {
creation will succeed. Otherwise the cluster will terminate with an creation will succeed. Otherwise the cluster will terminate with an
informative error message. informative error message.
Rather than authoring the cluster's JSON definition from scratch, Databricks
recommends filling out the [create compute UI] and then copying the generated
JSON definition from the UI.
[create compute UI]: https://docs.databricks.com/compute/configure.html
Arguments: Arguments:
SPARK_VERSION: The Spark version of the cluster, e.g. 3.3.x-scala2.11. A list of SPARK_VERSION: The Spark version of the cluster, e.g. 3.3.x-scala2.11. A list of
available Spark versions can be retrieved by using the available Spark versions can be retrieved by using the
@ -463,7 +469,7 @@ func newEdit() *cobra.Command {
cmd.Flags().StringVar(&editReq.NodeTypeId, "node-type-id", editReq.NodeTypeId, `This field encodes, through a single value, the resources available to each of the Spark nodes in this cluster.`) cmd.Flags().StringVar(&editReq.NodeTypeId, "node-type-id", editReq.NodeTypeId, `This field encodes, through a single value, the resources available to each of the Spark nodes in this cluster.`)
cmd.Flags().IntVar(&editReq.NumWorkers, "num-workers", editReq.NumWorkers, `Number of worker nodes that this cluster should have.`) cmd.Flags().IntVar(&editReq.NumWorkers, "num-workers", editReq.NumWorkers, `Number of worker nodes that this cluster should have.`)
cmd.Flags().StringVar(&editReq.PolicyId, "policy-id", editReq.PolicyId, `The ID of the cluster policy used to create the cluster if applicable.`) cmd.Flags().StringVar(&editReq.PolicyId, "policy-id", editReq.PolicyId, `The ID of the cluster policy used to create the cluster if applicable.`)
cmd.Flags().Var(&editReq.RuntimeEngine, "runtime-engine", `Decides which runtime engine to be use, e.g. Supported values: [NULL, PHOTON, STANDARD]`) cmd.Flags().Var(&editReq.RuntimeEngine, "runtime-engine", `Determines the cluster's runtime engine, either standard or Photon. Supported values: [NULL, PHOTON, STANDARD]`)
cmd.Flags().StringVar(&editReq.SingleUserName, "single-user-name", editReq.SingleUserName, `Single user name if data_security_mode is SINGLE_USER.`) cmd.Flags().StringVar(&editReq.SingleUserName, "single-user-name", editReq.SingleUserName, `Single user name if data_security_mode is SINGLE_USER.`)
// TODO: map via StringToStringVar: spark_conf // TODO: map via StringToStringVar: spark_conf
// TODO: map via StringToStringVar: spark_env_vars // TODO: map via StringToStringVar: spark_env_vars

2
cmd/workspace/cmd.go generated
View File

@ -76,6 +76,7 @@ import (
system_schemas "github.com/databricks/cli/cmd/workspace/system-schemas" system_schemas "github.com/databricks/cli/cmd/workspace/system-schemas"
table_constraints "github.com/databricks/cli/cmd/workspace/table-constraints" table_constraints "github.com/databricks/cli/cmd/workspace/table-constraints"
tables "github.com/databricks/cli/cmd/workspace/tables" tables "github.com/databricks/cli/cmd/workspace/tables"
temporary_table_credentials "github.com/databricks/cli/cmd/workspace/temporary-table-credentials"
token_management "github.com/databricks/cli/cmd/workspace/token-management" token_management "github.com/databricks/cli/cmd/workspace/token-management"
tokens "github.com/databricks/cli/cmd/workspace/tokens" tokens "github.com/databricks/cli/cmd/workspace/tokens"
users "github.com/databricks/cli/cmd/workspace/users" users "github.com/databricks/cli/cmd/workspace/users"
@ -165,6 +166,7 @@ func All() []*cobra.Command {
out = append(out, system_schemas.New()) out = append(out, system_schemas.New())
out = append(out, table_constraints.New()) out = append(out, table_constraints.New())
out = append(out, tables.New()) out = append(out, tables.New())
out = append(out, temporary_table_credentials.New())
out = append(out, token_management.New()) out = append(out, token_management.New())
out = append(out, tokens.New()) out = append(out, tokens.New())
out = append(out, users.New()) out = append(out, users.New())

View File

@ -0,0 +1,217 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package disable_legacy_access
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: "disable-legacy-access",
Short: `'Disabling legacy access' has the following impacts: 1.`,
Long: `'Disabling legacy access' has the following impacts:
1. Disables direct access to the Hive Metastore. However, you can still access
Hive Metastore through HMS Federation. 2. Disables Fallback Mode (docs link)
on any External Location access from the workspace. 3. Alters DBFS path access
to use External Location permissions in place of legacy credentials. 4.
Enforces Unity Catalog access on all path based access.`,
// 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.DeleteDisableLegacyAccessRequest,
)
func newDelete() *cobra.Command {
cmd := &cobra.Command{}
var deleteReq settings.DeleteDisableLegacyAccessRequest
// TODO: short flags
cmd.Flags().StringVar(&deleteReq.Etag, "etag", deleteReq.Etag, `etag used for versioning.`)
cmd.Use = "delete"
cmd.Short = `Delete Legacy Access Disablement Status.`
cmd.Long = `Delete Legacy Access Disablement Status.
Deletes legacy access disablement status.`
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.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := root.WorkspaceClient(ctx)
response, err := w.Settings.DisableLegacyAccess().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.GetDisableLegacyAccessRequest,
)
func newGet() *cobra.Command {
cmd := &cobra.Command{}
var getReq settings.GetDisableLegacyAccessRequest
// TODO: short flags
cmd.Flags().StringVar(&getReq.Etag, "etag", getReq.Etag, `etag used for versioning.`)
cmd.Use = "get"
cmd.Short = `Retrieve Legacy Access Disablement Status.`
cmd.Long = `Retrieve Legacy Access Disablement Status.
Retrieves legacy access disablement Status.`
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.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := root.WorkspaceClient(ctx)
response, err := w.Settings.DisableLegacyAccess().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.UpdateDisableLegacyAccessRequest,
)
func newUpdate() *cobra.Command {
cmd := &cobra.Command{}
var updateReq settings.UpdateDisableLegacyAccessRequest
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 Legacy Access Disablement Status.`
cmd.Long = `Update Legacy Access Disablement Status.
Updates legacy access disablement status.`
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)
if cmd.Flags().Changed("json") {
err = updateJson.Unmarshal(&updateReq)
if err != nil {
return err
}
} else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
}
response, err := w.Settings.DisableLegacyAccess().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 DisableLegacyAccess

View File

@ -935,6 +935,7 @@ func newUpdate() *cobra.Command {
cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`) cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
cmd.Flags().BoolVar(&updateReq.AllowDuplicateNames, "allow-duplicate-names", updateReq.AllowDuplicateNames, `If false, deployment will fail if name has changed and conflicts the name of another pipeline.`) cmd.Flags().BoolVar(&updateReq.AllowDuplicateNames, "allow-duplicate-names", updateReq.AllowDuplicateNames, `If false, deployment will fail if name has changed and conflicts the name of another pipeline.`)
cmd.Flags().StringVar(&updateReq.BudgetPolicyId, "budget-policy-id", updateReq.BudgetPolicyId, `Budget policy of this pipeline.`)
cmd.Flags().StringVar(&updateReq.Catalog, "catalog", updateReq.Catalog, `A catalog in Unity Catalog to publish data from this pipeline to.`) cmd.Flags().StringVar(&updateReq.Catalog, "catalog", updateReq.Catalog, `A catalog in Unity Catalog to publish data from this pipeline to.`)
cmd.Flags().StringVar(&updateReq.Channel, "channel", updateReq.Channel, `DLT Release Channel that specifies which version to use.`) cmd.Flags().StringVar(&updateReq.Channel, "channel", updateReq.Channel, `DLT Release Channel that specifies which version to use.`)
// TODO: array: clusters // TODO: array: clusters

View File

@ -53,6 +53,7 @@ func New() *cobra.Command {
cmd.AddCommand(newLogs()) cmd.AddCommand(newLogs())
cmd.AddCommand(newPatch()) cmd.AddCommand(newPatch())
cmd.AddCommand(newPut()) cmd.AddCommand(newPut())
cmd.AddCommand(newPutAiGateway())
cmd.AddCommand(newQuery()) cmd.AddCommand(newQuery())
cmd.AddCommand(newSetPermissions()) cmd.AddCommand(newSetPermissions())
cmd.AddCommand(newUpdateConfig()) cmd.AddCommand(newUpdateConfig())
@ -151,6 +152,7 @@ func newCreate() *cobra.Command {
// TODO: short flags // TODO: short flags
cmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) cmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`)
// TODO: complex arg: ai_gateway
// TODO: array: rate_limits // TODO: array: rate_limits
cmd.Flags().BoolVar(&createReq.RouteOptimized, "route-optimized", createReq.RouteOptimized, `Enable route optimization for the serving endpoint.`) cmd.Flags().BoolVar(&createReq.RouteOptimized, "route-optimized", createReq.RouteOptimized, `Enable route optimization for the serving endpoint.`)
// TODO: array: tags // TODO: array: tags
@ -754,8 +756,9 @@ func newPut() *cobra.Command {
cmd.Short = `Update rate limits of a serving endpoint.` cmd.Short = `Update rate limits of a serving endpoint.`
cmd.Long = `Update rate limits of a serving endpoint. cmd.Long = `Update rate limits of a serving endpoint.
Used to update the rate limits of a serving endpoint. NOTE: only external and Used to update the rate limits of a serving endpoint. NOTE: Only foundation
foundation model endpoints are supported as of now. model endpoints are currently supported. For external models, use AI Gateway
to manage rate limits.
Arguments: Arguments:
NAME: The name of the serving endpoint whose rate limits are being updated. This NAME: The name of the serving endpoint whose rate limits are being updated. This
@ -800,6 +803,79 @@ func newPut() *cobra.Command {
return cmd return cmd
} }
// start put-ai-gateway 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 putAiGatewayOverrides []func(
*cobra.Command,
*serving.PutAiGatewayRequest,
)
func newPutAiGateway() *cobra.Command {
cmd := &cobra.Command{}
var putAiGatewayReq serving.PutAiGatewayRequest
var putAiGatewayJson flags.JsonFlag
// TODO: short flags
cmd.Flags().Var(&putAiGatewayJson, "json", `either inline JSON string or @path/to/file.json with request body`)
// TODO: complex arg: guardrails
// TODO: complex arg: inference_table_config
// TODO: array: rate_limits
// TODO: complex arg: usage_tracking_config
cmd.Use = "put-ai-gateway NAME"
cmd.Short = `Update AI Gateway of a serving endpoint.`
cmd.Long = `Update AI Gateway of a serving endpoint.
Used to update the AI Gateway of a serving endpoint. NOTE: Only external model
endpoints are currently supported.
Arguments:
NAME: The name of the serving endpoint whose AI Gateway is being updated. This
field is required.`
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)
if cmd.Flags().Changed("json") {
err = putAiGatewayJson.Unmarshal(&putAiGatewayReq)
if err != nil {
return err
}
}
putAiGatewayReq.Name = args[0]
response, err := w.ServingEndpoints.PutAiGateway(ctx, putAiGatewayReq)
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 putAiGatewayOverrides {
fn(cmd, &putAiGatewayReq)
}
return cmd
}
// start query command // start query command
// Slice with functions to override default command behavior. // Slice with functions to override default command behavior.

View File

@ -8,6 +8,7 @@ import (
automatic_cluster_update "github.com/databricks/cli/cmd/workspace/automatic-cluster-update" automatic_cluster_update "github.com/databricks/cli/cmd/workspace/automatic-cluster-update"
compliance_security_profile "github.com/databricks/cli/cmd/workspace/compliance-security-profile" compliance_security_profile "github.com/databricks/cli/cmd/workspace/compliance-security-profile"
default_namespace "github.com/databricks/cli/cmd/workspace/default-namespace" default_namespace "github.com/databricks/cli/cmd/workspace/default-namespace"
disable_legacy_access "github.com/databricks/cli/cmd/workspace/disable-legacy-access"
enhanced_security_monitoring "github.com/databricks/cli/cmd/workspace/enhanced-security-monitoring" enhanced_security_monitoring "github.com/databricks/cli/cmd/workspace/enhanced-security-monitoring"
restrict_workspace_admins "github.com/databricks/cli/cmd/workspace/restrict-workspace-admins" restrict_workspace_admins "github.com/databricks/cli/cmd/workspace/restrict-workspace-admins"
) )
@ -31,6 +32,7 @@ func New() *cobra.Command {
cmd.AddCommand(automatic_cluster_update.New()) cmd.AddCommand(automatic_cluster_update.New())
cmd.AddCommand(compliance_security_profile.New()) cmd.AddCommand(compliance_security_profile.New())
cmd.AddCommand(default_namespace.New()) cmd.AddCommand(default_namespace.New())
cmd.AddCommand(disable_legacy_access.New())
cmd.AddCommand(enhanced_security_monitoring.New()) cmd.AddCommand(enhanced_security_monitoring.New())
cmd.AddCommand(restrict_workspace_admins.New()) cmd.AddCommand(restrict_workspace_admins.New())

View File

@ -220,6 +220,7 @@ func newGet() *cobra.Command {
cmd.Flags().BoolVar(&getReq.IncludeBrowse, "include-browse", getReq.IncludeBrowse, `Whether to include tables in the response for which the principal can only access selective metadata for.`) cmd.Flags().BoolVar(&getReq.IncludeBrowse, "include-browse", getReq.IncludeBrowse, `Whether to include tables in the response for which the principal can only access selective metadata for.`)
cmd.Flags().BoolVar(&getReq.IncludeDeltaMetadata, "include-delta-metadata", getReq.IncludeDeltaMetadata, `Whether delta metadata should be included in the response.`) cmd.Flags().BoolVar(&getReq.IncludeDeltaMetadata, "include-delta-metadata", getReq.IncludeDeltaMetadata, `Whether delta metadata should be included in the response.`)
cmd.Flags().BoolVar(&getReq.IncludeManifestCapabilities, "include-manifest-capabilities", getReq.IncludeManifestCapabilities, `Whether to include a manifest containing capabilities the table has.`)
cmd.Use = "get FULL_NAME" cmd.Use = "get FULL_NAME"
cmd.Short = `Get a table.` cmd.Short = `Get a table.`
@ -299,6 +300,7 @@ func newList() *cobra.Command {
cmd.Flags().BoolVar(&listReq.IncludeBrowse, "include-browse", listReq.IncludeBrowse, `Whether to include tables in the response for which the principal can only access selective metadata for.`) cmd.Flags().BoolVar(&listReq.IncludeBrowse, "include-browse", listReq.IncludeBrowse, `Whether to include tables in the response for which the principal can only access selective metadata for.`)
cmd.Flags().BoolVar(&listReq.IncludeDeltaMetadata, "include-delta-metadata", listReq.IncludeDeltaMetadata, `Whether delta metadata should be included in the response.`) cmd.Flags().BoolVar(&listReq.IncludeDeltaMetadata, "include-delta-metadata", listReq.IncludeDeltaMetadata, `Whether delta metadata should be included in the response.`)
cmd.Flags().BoolVar(&listReq.IncludeManifestCapabilities, "include-manifest-capabilities", listReq.IncludeManifestCapabilities, `Whether to include a manifest containing capabilities the table has.`)
cmd.Flags().IntVar(&listReq.MaxResults, "max-results", listReq.MaxResults, `Maximum number of tables to return.`) cmd.Flags().IntVar(&listReq.MaxResults, "max-results", listReq.MaxResults, `Maximum number of tables to return.`)
cmd.Flags().BoolVar(&listReq.OmitColumns, "omit-columns", listReq.OmitColumns, `Whether to omit the columns of the table from the response or not.`) cmd.Flags().BoolVar(&listReq.OmitColumns, "omit-columns", listReq.OmitColumns, `Whether to omit the columns of the table from the response or not.`)
cmd.Flags().BoolVar(&listReq.OmitProperties, "omit-properties", listReq.OmitProperties, `Whether to omit the properties of the table from the response or not.`) cmd.Flags().BoolVar(&listReq.OmitProperties, "omit-properties", listReq.OmitProperties, `Whether to omit the properties of the table from the response or not.`)
@ -366,6 +368,7 @@ func newListSummaries() *cobra.Command {
// TODO: short flags // TODO: short flags
cmd.Flags().BoolVar(&listSummariesReq.IncludeManifestCapabilities, "include-manifest-capabilities", listSummariesReq.IncludeManifestCapabilities, `Whether to include a manifest containing capabilities the table has.`)
cmd.Flags().IntVar(&listSummariesReq.MaxResults, "max-results", listSummariesReq.MaxResults, `Maximum number of summaries for tables to return.`) cmd.Flags().IntVar(&listSummariesReq.MaxResults, "max-results", listSummariesReq.MaxResults, `Maximum number of summaries for tables to return.`)
cmd.Flags().StringVar(&listSummariesReq.PageToken, "page-token", listSummariesReq.PageToken, `Opaque pagination token to go to next page based on previous query.`) cmd.Flags().StringVar(&listSummariesReq.PageToken, "page-token", listSummariesReq.PageToken, `Opaque pagination token to go to next page based on previous query.`)
cmd.Flags().StringVar(&listSummariesReq.SchemaNamePattern, "schema-name-pattern", listSummariesReq.SchemaNamePattern, `A sql LIKE pattern (% and _) for schema names.`) cmd.Flags().StringVar(&listSummariesReq.SchemaNamePattern, "schema-name-pattern", listSummariesReq.SchemaNamePattern, `A sql LIKE pattern (% and _) for schema names.`)

View File

@ -0,0 +1,122 @@
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package temporary_table_credentials
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/catalog"
"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: "temporary-table-credentials",
Short: `Temporary Table Credentials refer to short-lived, downscoped credentials used to access cloud storage locationswhere table data is stored in Databricks.`,
Long: `Temporary Table Credentials refer to short-lived, downscoped credentials used
to access cloud storage locationswhere table data is stored in Databricks.
These credentials are employed to provide secure and time-limitedaccess to
data in cloud environments such as AWS, Azure, and Google Cloud. Each cloud
provider has its own typeof credentials: AWS uses temporary session tokens via
AWS Security Token Service (STS), Azure utilizesShared Access Signatures (SAS)
for its data storage services, and Google Cloud supports temporary
credentialsthrough OAuth 2.0.Temporary table credentials ensure that data
access is limited in scope and duration, reducing the risk ofunauthorized
access or misuse. To use the temporary table credentials API, a metastore
admin needs to enable the external_access_enabled flag (off by default) at the
metastore level, and user needs to be granted the EXTERNAL USE SCHEMA
permission at the schema level by catalog admin. Note that EXTERNAL USE SCHEMA
is a schema level permission that can only be granted by catalog admin
explicitly and is not included in schema ownership or ALL PRIVILEGES on the
schema for security reason.`,
GroupID: "catalog",
Annotations: map[string]string{
"package": "catalog",
},
}
// Add methods
cmd.AddCommand(newGenerateTemporaryTableCredentials())
// Apply optional overrides to this command.
for _, fn := range cmdOverrides {
fn(cmd)
}
return cmd
}
// start generate-temporary-table-credentials 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 generateTemporaryTableCredentialsOverrides []func(
*cobra.Command,
*catalog.GenerateTemporaryTableCredentialRequest,
)
func newGenerateTemporaryTableCredentials() *cobra.Command {
cmd := &cobra.Command{}
var generateTemporaryTableCredentialsReq catalog.GenerateTemporaryTableCredentialRequest
var generateTemporaryTableCredentialsJson flags.JsonFlag
// TODO: short flags
cmd.Flags().Var(&generateTemporaryTableCredentialsJson, "json", `either inline JSON string or @path/to/file.json with request body`)
cmd.Flags().Var(&generateTemporaryTableCredentialsReq.Operation, "operation", `The operation performed against the table data, either READ or READ_WRITE. Supported values: [READ, READ_WRITE]`)
cmd.Flags().StringVar(&generateTemporaryTableCredentialsReq.TableId, "table-id", generateTemporaryTableCredentialsReq.TableId, `UUID of the table to read or write.`)
cmd.Use = "generate-temporary-table-credentials"
cmd.Short = `Generate a temporary table credential.`
cmd.Long = `Generate a temporary table credential.
Get a short-lived credential for directly accessing the table data on cloud
storage. The metastore must have external_access_enabled flag set to true
(default false). The caller must have EXTERNAL_USE_SCHEMA privilege on the
parent schema and this privilege can only be granted by catalog owners.`
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.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := root.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") {
err = generateTemporaryTableCredentialsJson.Unmarshal(&generateTemporaryTableCredentialsReq)
if err != nil {
return err
}
}
response, err := w.TemporaryTableCredentials.GenerateTemporaryTableCredentials(ctx, generateTemporaryTableCredentialsReq)
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 generateTemporaryTableCredentialsOverrides {
fn(cmd, &generateTemporaryTableCredentialsReq)
}
return cmd
}
// end service TemporaryTableCredentials

2
go.mod
View File

@ -7,7 +7,7 @@ toolchain go1.22.7
require ( require (
github.com/Masterminds/semver/v3 v3.3.0 // MIT github.com/Masterminds/semver/v3 v3.3.0 // MIT
github.com/briandowns/spinner v1.23.1 // Apache 2.0 github.com/briandowns/spinner v1.23.1 // Apache 2.0
github.com/databricks/databricks-sdk-go v0.46.0 // Apache 2.0 github.com/databricks/databricks-sdk-go v0.47.0 // Apache 2.0
github.com/fatih/color v1.17.0 // MIT github.com/fatih/color v1.17.0 // MIT
github.com/ghodss/yaml v1.0.0 // MIT + NOTICE github.com/ghodss/yaml v1.0.0 // MIT + NOTICE
github.com/google/uuid v1.6.0 // BSD-3-Clause github.com/google/uuid v1.6.0 // BSD-3-Clause

4
go.sum generated
View File

@ -32,8 +32,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/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
github.com/databricks/databricks-sdk-go v0.46.0 h1:D0TxmtSVAOsdnfzH4OGtAmcq+8TyA7Z6fA6JEYhupeY= github.com/databricks/databricks-sdk-go v0.47.0 h1:eE7dN9axviL8+s10jnQAayOYDaR+Mfu7E9COGjO4lrQ=
github.com/databricks/databricks-sdk-go v0.46.0/go.mod h1:ds+zbv5mlQG7nFEU5ojLtgN/u0/9YzZmKQES/CfedzU= github.com/databricks/databricks-sdk-go v0.47.0/go.mod h1:ds+zbv5mlQG7nFEU5ojLtgN/u0/9YzZmKQES/CfedzU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=