diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index 864d90a5f1..3e67081803 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -6b2dbf5489ec706709fed80ee65caed7d10a2f38 \ No newline at end of file +2cee201b2e8d656f7306b2f9ec98edfa721e9829 \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index e4b7a4140e..629be14230 100755 --- a/.gitattributes +++ b/.gitattributes @@ -19,6 +19,7 @@ cmd/account/log-delivery/log-delivery.go linguist-generated=true cmd/account/metastore-assignments/metastore-assignments.go linguist-generated=true cmd/account/metastores/metastores.go linguist-generated=true cmd/account/network-connectivity/network-connectivity.go linguist-generated=true +cmd/account/network-policies/network-policies.go linguist-generated=true cmd/account/networks/networks.go linguist-generated=true cmd/account/o-auth-published-apps/o-auth-published-apps.go linguist-generated=true cmd/account/personal-compute/personal-compute.go linguist-generated=true @@ -34,6 +35,7 @@ cmd/account/usage-dashboards/usage-dashboards.go linguist-generated=true cmd/account/users/users.go linguist-generated=true cmd/account/vpc-endpoints/vpc-endpoints.go linguist-generated=true cmd/account/workspace-assignment/workspace-assignment.go linguist-generated=true +cmd/account/workspace-network-configuration/workspace-network-configuration.go linguist-generated=true cmd/account/workspaces/workspaces.go linguist-generated=true cmd/workspace/access-control/access-control.go linguist-generated=true cmd/workspace/aibi-dashboard-embedding-access-policy/aibi-dashboard-embedding-access-policy.go linguist-generated=true @@ -116,6 +118,7 @@ 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/recipient-federation-policies/recipient-federation-policies.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 diff --git a/bundle/internal/schema/annotations_openapi.yml b/bundle/internal/schema/annotations_openapi.yml index e633a6cdeb..395284c861 100644 --- a/bundle/internal/schema/annotations_openapi.yml +++ b/bundle/internal/schema/annotations_openapi.yml @@ -89,6 +89,7 @@ github.com/databricks/cli/bundle/config/resources.Cluster: "description": |- Cluster name requested by the user. This doesn't have to be unique. If not specified at creation, the cluster name will be an empty string. + For job clusters, the cluster name is automatically set based on the job and job run IDs. "custom_tags": "description": |- Additional tags for cluster resources. Databricks will tag all cluster resources (e.g., AWS @@ -510,6 +511,13 @@ github.com/databricks/cli/bundle/config/resources.Pipeline: Restart window of this pipeline. "x-databricks-preview": |- PRIVATE + "root_path": + "description": |- + Root path for this pipeline. + This is used as the root directory when editing the pipeline in the Databricks user interface and it is + added to sys.path when executing Python sources during pipeline execution. + "x-databricks-preview": |- + PRIVATE "run_as": "description": |- Write-only setting, available only in Create/Update calls. Specifies the user or service principal that the pipeline runs as. If not specified, the pipeline runs as the user who created the pipeline. @@ -704,6 +712,7 @@ github.com/databricks/databricks-sdk-go/service/apps.AppResource: "secret": {} "serving_endpoint": {} "sql_warehouse": {} + "uc_securable": {} github.com/databricks/databricks-sdk-go/service/apps.AppResourceJob: "id": "description": |- @@ -775,6 +784,22 @@ github.com/databricks/databricks-sdk-go/service/apps.AppResourceSqlWarehouseSqlW CAN_USE - |- IS_OWNER +github.com/databricks/databricks-sdk-go/service/apps.AppResourceUcSecurable: + "permission": {} + "securable_full_name": {} + "securable_type": {} +github.com/databricks/databricks-sdk-go/service/apps.AppResourceUcSecurableUcSecurablePermission: + "_": + "enum": + - |- + READ_VOLUME + - |- + WRITE_VOLUME +github.com/databricks/databricks-sdk-go/service/apps.AppResourceUcSecurableUcSecurableType: + "_": + "enum": + - |- + VOLUME github.com/databricks/databricks-sdk-go/service/apps.ApplicationState: "_": "enum": @@ -1167,6 +1192,7 @@ github.com/databricks/databricks-sdk-go/service/compute.ClusterSpec: "description": |- Cluster name requested by the user. This doesn't have to be unique. If not specified at creation, the cluster name will be an empty string. + For job clusters, the cluster name is automatically set based on the job and job run IDs. "custom_tags": "description": |- Additional tags for cluster resources. Databricks will tag all cluster resources (e.g., AWS @@ -1396,7 +1422,6 @@ github.com/databricks/databricks-sdk-go/service/compute.Environment: "_": "description": |- The environment entity used to preserve serverless environment side panel, jobs' environment for non-notebook task, and DLT's environment for classic and serverless pipelines. - (Note: DLT uses a copied version of the Environment proto below, at //spark/pipelines/api/protos/copied/libraries-environments-copy.proto) In this minimal environment spec, only pip dependencies are supported. "client": "description": |- @@ -1976,7 +2001,6 @@ github.com/databricks/databricks-sdk-go/service/jobs.JobEnvironment: "spec": "description": |- The environment entity used to preserve serverless environment side panel, jobs' environment for non-notebook task, and DLT's environment for classic and serverless pipelines. - (Note: DLT uses a copied version of the Environment proto below, at //spark/pipelines/api/protos/copied/libraries-environments-copy.proto) In this minimal environment spec, only pip dependencies are supported. github.com/databricks/databricks-sdk-go/service/jobs.JobNotificationSettings: "no_alert_for_canceled_runs": @@ -3753,3 +3777,17 @@ github.com/databricks/databricks-sdk-go/service/serving.TrafficConfig: "routes": "description": |- The list of routes that define traffic to each served entity. +github.com/databricks/databricks-sdk-go/service/workspace.AzureKeyVaultSecretScopeMetadata: + "dns_name": + "description": |- + The DNS of the KeyVault + "resource_id": + "description": |- + The resource id of the azure KeyVault that user wants to associate the scope with. +github.com/databricks/databricks-sdk-go/service/workspace.ScopeBackendType: + "_": + "enum": + - |- + DATABRICKS + - |- + AZURE_KEYVAULT diff --git a/bundle/internal/schema/annotations_openapi_overrides.yml b/bundle/internal/schema/annotations_openapi_overrides.yml index 40e75055f0..f9bf48448b 100644 --- a/bundle/internal/schema/annotations_openapi_overrides.yml +++ b/bundle/internal/schema/annotations_openapi_overrides.yml @@ -45,15 +45,6 @@ github.com/databricks/cli/bundle/config/resources.AppPermissionLevel: CAN_MANAGE - |- CAN_USE -github.com/databricks/cli/bundle/config/resources.SecretScopePermissionLevel: - "_": - "enum": - - |- - READ - - |- - WRITE - - |- - MANAGE github.com/databricks/cli/bundle/config/resources.Cluster: "_": "markdown_description": |- @@ -429,6 +420,15 @@ github.com/databricks/cli/bundle/config/resources.Schema: "properties": "description": |- PLACEHOLDER +github.com/databricks/cli/bundle/config/resources.SecretScopePermissionLevel: + "_": + "enum": + - |- + READ + - |- + WRITE + - |- + MANAGE github.com/databricks/cli/bundle/config/resources.Volume: "_": "markdown_description": |- @@ -505,6 +505,9 @@ github.com/databricks/databricks-sdk-go/service/apps.AppResource: "sql_warehouse": "description": |- PLACEHOLDER + "uc_securable": + "description": |- + PLACEHOLDER github.com/databricks/databricks-sdk-go/service/apps.AppResourceJob: "id": "description": |- @@ -536,6 +539,16 @@ github.com/databricks/databricks-sdk-go/service/apps.AppResourceSqlWarehouse: "permission": "description": |- PLACEHOLDER +github.com/databricks/databricks-sdk-go/service/apps.AppResourceUcSecurable: + "permission": + "description": |- + PLACEHOLDER + "securable_full_name": + "description": |- + PLACEHOLDER + "securable_type": + "description": |- + PLACEHOLDER github.com/databricks/databricks-sdk-go/service/apps.ApplicationStatus: "message": "description": |- diff --git a/bundle/schema/jsonschema.json b/bundle/schema/jsonschema.json index 0124eef746..b75dd2c853 100644 --- a/bundle/schema/jsonschema.json +++ b/bundle/schema/jsonschema.json @@ -243,7 +243,7 @@ "$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.", + "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.\nFor job clusters, the cluster name is automatically set based on the job and job run IDs.", "$ref": "#/$defs/string" }, "custom_tags": { @@ -1060,6 +1060,12 @@ "x-databricks-preview": "PRIVATE", "doNotSuggest": true }, + "root_path": { + "description": "Root path for this pipeline.\nThis is used as the root directory when editing the pipeline in the Databricks user interface and it is\nadded to sys.path when executing Python sources during pipeline execution.", + "$ref": "#/$defs/string", + "x-databricks-preview": "PRIVATE", + "doNotSuggest": true + }, "run_as": { "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/pipelines.RunAs", "x-databricks-preview": "PRIVATE", @@ -2257,6 +2263,9 @@ }, "sql_warehouse": { "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/apps.AppResourceSqlWarehouse" + }, + "uc_securable": { + "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/apps.AppResourceUcSecurable" } }, "additionalProperties": false, @@ -2436,6 +2445,63 @@ } ] }, + "apps.AppResourceUcSecurable": { + "oneOf": [ + { + "type": "object", + "properties": { + "permission": { + "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/apps.AppResourceUcSecurableUcSecurablePermission" + }, + "securable_full_name": { + "$ref": "#/$defs/string" + }, + "securable_type": { + "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/apps.AppResourceUcSecurableUcSecurableType" + } + }, + "additionalProperties": false, + "required": [ + "permission", + "securable_full_name", + "securable_type" + ] + }, + { + "type": "string", + "pattern": "\\$\\{(var(\\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\\[[0-9]+\\])*)+)\\}" + } + ] + }, + "apps.AppResourceUcSecurableUcSecurablePermission": { + "oneOf": [ + { + "type": "string", + "enum": [ + "READ_VOLUME", + "WRITE_VOLUME" + ] + }, + { + "type": "string", + "pattern": "\\$\\{(var(\\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\\[[0-9]+\\])*)+)\\}" + } + ] + }, + "apps.AppResourceUcSecurableUcSecurableType": { + "oneOf": [ + { + "type": "string", + "enum": [ + "VOLUME" + ] + }, + { + "type": "string", + "pattern": "\\$\\{(var(\\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\\[[0-9]+\\])*)+)\\}" + } + ] + }, "apps.ApplicationState": { "oneOf": [ { @@ -3040,7 +3106,7 @@ "$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.", + "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.\nFor job clusters, the cluster name is automatically set based on the job and job run IDs.", "$ref": "#/$defs/string" }, "custom_tags": { @@ -3248,7 +3314,7 @@ "oneOf": [ { "type": "object", - "description": "The environment entity used to preserve serverless environment side panel, jobs' environment for non-notebook task, and DLT's environment for classic and serverless pipelines.\n(Note: DLT uses a copied version of the Environment proto below, at //spark/pipelines/api/protos/copied/libraries-environments-copy.proto)\nIn this minimal environment spec, only pip dependencies are supported.", + "description": "The environment entity used to preserve serverless environment side panel, jobs' environment for non-notebook task, and DLT's environment for classic and serverless pipelines.\nIn this minimal environment spec, only pip dependencies are supported.", "properties": { "client": { "description": "Client version used by the environment\nThe client is the user-facing environment of the runtime.\nEach client comes with a specific set of pre-installed libraries.\nThe version is a string, consisting of the major client version.", @@ -7498,9 +7564,11 @@ "type": "object", "properties": { "dns_name": { + "description": "The DNS of the KeyVault", "$ref": "#/$defs/string" }, "resource_id": { + "description": "The resource id of the azure KeyVault that user wants to associate the scope with.", "$ref": "#/$defs/string" } }, @@ -7517,7 +7585,19 @@ ] }, "workspace.ScopeBackendType": { - "type": "string" + "oneOf": [ + { + "type": "string", + "enum": [ + "DATABRICKS", + "AZURE_KEYVAULT" + ] + }, + { + "type": "string", + "pattern": "\\$\\{(var(\\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\\[[0-9]+\\])*)+)\\}" + } + ] } } } diff --git a/cmd/account/access-control/access-control.go b/cmd/account/access-control/access-control.go index 544684c4c7..74ac962d2d 100755 --- a/cmd/account/access-control/access-control.go +++ b/cmd/account/access-control/access-control.go @@ -69,7 +69,13 @@ func newGetAssignableRolesForResource() *cobra.Command { role. Arguments: - RESOURCE: The resource name for which assignable roles will be listed.` + RESOURCE: The resource name for which assignable roles will be listed. + + Examples | Summary :--- | :--- resource=accounts/ | A + resource name for the account. + resource=accounts//groups/ | A resource name for + the group. resource=accounts//servicePrincipals/ | A + resource name for the service principal.` cmd.Annotations = make(map[string]string) @@ -130,6 +136,14 @@ func newGetRuleSet() *cobra.Command { Arguments: NAME: The ruleset name associated with the request. + + Examples | Summary :--- | :--- + name=accounts//ruleSets/default | A name for a rule set on + the account. + name=accounts//groups//ruleSets/default | A name + for a rule set on the group. + name=accounts//servicePrincipals//ruleSets/default + | A name for a rule set on the service principal. ETAG: Etag used for versioning. The response is at least as fresh as the eTag provided. Etag is used for optimistic concurrency control as a way to help prevent simultaneous updates of a rule set from overwriting each other. It @@ -137,7 +151,12 @@ func newGetRuleSet() *cobra.Command { modify -> write pattern to perform rule set updates in order to avoid race conditions that is get an etag from a GET rule set request, and pass it with the PUT update request to identify the rule set version you are - updating.` + updating. + + Examples | Summary :--- | :--- etag= | An empty etag can only be used in + GET to indicate no freshness requirements. + etag=RENUAAABhSweA4NvVmmUYdiU717H3Tgy0UJdor3gE4a+mq/oj9NjAf8ZsQ== | An + etag encoded a specific version of the rule set to get or to be updated.` cmd.Annotations = make(map[string]string) diff --git a/cmd/account/cmd.go b/cmd/account/cmd.go index 758e2af5ec..cd70e73cf8 100644 --- a/cmd/account/cmd.go +++ b/cmd/account/cmd.go @@ -19,6 +19,7 @@ import ( account_metastore_assignments "github.com/databricks/cli/cmd/account/metastore-assignments" account_metastores "github.com/databricks/cli/cmd/account/metastores" network_connectivity "github.com/databricks/cli/cmd/account/network-connectivity" + network_policies "github.com/databricks/cli/cmd/account/network-policies" networks "github.com/databricks/cli/cmd/account/networks" o_auth_published_apps "github.com/databricks/cli/cmd/account/o-auth-published-apps" private_access "github.com/databricks/cli/cmd/account/private-access" @@ -33,6 +34,7 @@ import ( account_users "github.com/databricks/cli/cmd/account/users" vpc_endpoints "github.com/databricks/cli/cmd/account/vpc-endpoints" workspace_assignment "github.com/databricks/cli/cmd/account/workspace-assignment" + workspace_network_configuration "github.com/databricks/cli/cmd/account/workspace-network-configuration" workspaces "github.com/databricks/cli/cmd/account/workspaces" ) @@ -55,6 +57,7 @@ func New() *cobra.Command { cmd.AddCommand(account_metastore_assignments.New()) cmd.AddCommand(account_metastores.New()) cmd.AddCommand(network_connectivity.New()) + cmd.AddCommand(network_policies.New()) cmd.AddCommand(networks.New()) cmd.AddCommand(o_auth_published_apps.New()) cmd.AddCommand(private_access.New()) @@ -69,6 +72,7 @@ func New() *cobra.Command { cmd.AddCommand(account_users.New()) cmd.AddCommand(vpc_endpoints.New()) cmd.AddCommand(workspace_assignment.New()) + cmd.AddCommand(workspace_network_configuration.New()) cmd.AddCommand(workspaces.New()) cmd.AddCommand(budgets.New()) diff --git a/cmd/account/network-policies/network-policies.go b/cmd/account/network-policies/network-policies.go new file mode 100755 index 0000000000..00f5a72f71 --- /dev/null +++ b/cmd/account/network-policies/network-policies.go @@ -0,0 +1,374 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package network_policies + +import ( + "github.com/databricks/cli/cmd/root" + "github.com/databricks/cli/libs/cmdctx" + "github.com/databricks/cli/libs/cmdio" + "github.com/databricks/cli/libs/flags" + "github.com/databricks/databricks-sdk-go/service/settings" + "github.com/spf13/cobra" +) + +// Slice with functions to override default command behavior. +// Functions can be added from the `init()` function in manually curated files in this directory. +var cmdOverrides []func(*cobra.Command) + +func New() *cobra.Command { + cmd := &cobra.Command{ + Use: "network-policies", + Short: `These APIs manage network policies for this account.`, + Long: `These APIs manage network policies for this account. Network policies control + which network destinations can be accessed from the Databricks environment. + Each Databricks account includes a default policy named 'default-policy'. + 'default-policy' is associated with any workspace lacking an explicit network + policy assignment, and is automatically associated with each newly created + workspace. 'default-policy' is reserved and cannot be deleted, but it can be + updated to customize the default network access rules for your account.`, + GroupID: "settings", + Annotations: map[string]string{ + "package": "settings", + }, + + // This service is being previewed; hide from help output. + Hidden: true, + RunE: root.ReportUnknownSubcommand, + } + + // Add methods + cmd.AddCommand(newCreateNetworkPolicyRpc()) + cmd.AddCommand(newDeleteNetworkPolicyRpc()) + cmd.AddCommand(newGetNetworkPolicyRpc()) + cmd.AddCommand(newListNetworkPoliciesRpc()) + cmd.AddCommand(newUpdateNetworkPolicyRpc()) + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start create-network-policy-rpc 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 createNetworkPolicyRpcOverrides []func( + *cobra.Command, + *settings.CreateNetworkPolicyRequest, +) + +func newCreateNetworkPolicyRpc() *cobra.Command { + cmd := &cobra.Command{} + + var createNetworkPolicyRpcReq settings.CreateNetworkPolicyRequest + createNetworkPolicyRpcReq.NetworkPolicy = settings.AccountNetworkPolicy{} + var createNetworkPolicyRpcJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&createNetworkPolicyRpcJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Flags().StringVar(&createNetworkPolicyRpcReq.NetworkPolicy.AccountId, "account-id", createNetworkPolicyRpcReq.NetworkPolicy.AccountId, `The associated account ID for this Network Policy object.`) + // TODO: complex arg: egress + cmd.Flags().StringVar(&createNetworkPolicyRpcReq.NetworkPolicy.NetworkPolicyId, "network-policy-id", createNetworkPolicyRpcReq.NetworkPolicy.NetworkPolicyId, `The unique identifier for the network policy.`) + + cmd.Use = "create-network-policy-rpc" + cmd.Short = `Create a network policy.` + cmd.Long = `Create a network policy. + + Creates a new network policy to manage which network destinations can be + accessed from the Databricks environment.` + + 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 := cmdctx.AccountClient(ctx) + + if cmd.Flags().Changed("json") { + diags := createNetworkPolicyRpcJson.Unmarshal(&createNetworkPolicyRpcReq.NetworkPolicy) + if diags.HasError() { + return diags.Error() + } + if len(diags) > 0 { + err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags) + if err != nil { + return err + } + } + } + + response, err := a.NetworkPolicies.CreateNetworkPolicyRpc(ctx, createNetworkPolicyRpcReq) + 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 createNetworkPolicyRpcOverrides { + fn(cmd, &createNetworkPolicyRpcReq) + } + + return cmd +} + +// start delete-network-policy-rpc 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 deleteNetworkPolicyRpcOverrides []func( + *cobra.Command, + *settings.DeleteNetworkPolicyRequest, +) + +func newDeleteNetworkPolicyRpc() *cobra.Command { + cmd := &cobra.Command{} + + var deleteNetworkPolicyRpcReq settings.DeleteNetworkPolicyRequest + + // TODO: short flags + + cmd.Use = "delete-network-policy-rpc NETWORK_POLICY_ID" + cmd.Short = `Delete a network policy.` + cmd.Long = `Delete a network policy. + + Deletes a network policy. Cannot be called on 'default-policy'. + + Arguments: + NETWORK_POLICY_ID: The unique identifier of the network policy to delete.` + + 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 := cmdctx.AccountClient(ctx) + + deleteNetworkPolicyRpcReq.NetworkPolicyId = args[0] + + err = a.NetworkPolicies.DeleteNetworkPolicyRpc(ctx, deleteNetworkPolicyRpcReq) + 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 deleteNetworkPolicyRpcOverrides { + fn(cmd, &deleteNetworkPolicyRpcReq) + } + + return cmd +} + +// start get-network-policy-rpc 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 getNetworkPolicyRpcOverrides []func( + *cobra.Command, + *settings.GetNetworkPolicyRequest, +) + +func newGetNetworkPolicyRpc() *cobra.Command { + cmd := &cobra.Command{} + + var getNetworkPolicyRpcReq settings.GetNetworkPolicyRequest + + // TODO: short flags + + cmd.Use = "get-network-policy-rpc NETWORK_POLICY_ID" + cmd.Short = `Get a network policy.` + cmd.Long = `Get a network policy. + + Gets a network policy. + + Arguments: + NETWORK_POLICY_ID: The unique identifier of the network policy to retrieve.` + + 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 := cmdctx.AccountClient(ctx) + + getNetworkPolicyRpcReq.NetworkPolicyId = args[0] + + response, err := a.NetworkPolicies.GetNetworkPolicyRpc(ctx, getNetworkPolicyRpcReq) + 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 getNetworkPolicyRpcOverrides { + fn(cmd, &getNetworkPolicyRpcReq) + } + + return cmd +} + +// start list-network-policies-rpc 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 listNetworkPoliciesRpcOverrides []func( + *cobra.Command, + *settings.ListNetworkPoliciesRequest, +) + +func newListNetworkPoliciesRpc() *cobra.Command { + cmd := &cobra.Command{} + + var listNetworkPoliciesRpcReq settings.ListNetworkPoliciesRequest + + // TODO: short flags + + cmd.Flags().StringVar(&listNetworkPoliciesRpcReq.PageToken, "page-token", listNetworkPoliciesRpcReq.PageToken, `Pagination token to go to next page based on previous query.`) + + cmd.Use = "list-network-policies-rpc" + cmd.Short = `List network policies.` + cmd.Long = `List network policies. + + Gets an array of network policies.` + + 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 := cmdctx.AccountClient(ctx) + + response := a.NetworkPolicies.ListNetworkPoliciesRpc(ctx, listNetworkPoliciesRpcReq) + 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 listNetworkPoliciesRpcOverrides { + fn(cmd, &listNetworkPoliciesRpcReq) + } + + return cmd +} + +// start update-network-policy-rpc 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 updateNetworkPolicyRpcOverrides []func( + *cobra.Command, + *settings.UpdateNetworkPolicyRequest, +) + +func newUpdateNetworkPolicyRpc() *cobra.Command { + cmd := &cobra.Command{} + + var updateNetworkPolicyRpcReq settings.UpdateNetworkPolicyRequest + updateNetworkPolicyRpcReq.NetworkPolicy = settings.AccountNetworkPolicy{} + var updateNetworkPolicyRpcJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&updateNetworkPolicyRpcJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Flags().StringVar(&updateNetworkPolicyRpcReq.NetworkPolicy.AccountId, "account-id", updateNetworkPolicyRpcReq.NetworkPolicy.AccountId, `The associated account ID for this Network Policy object.`) + // TODO: complex arg: egress + cmd.Flags().StringVar(&updateNetworkPolicyRpcReq.NetworkPolicy.NetworkPolicyId, "network-policy-id", updateNetworkPolicyRpcReq.NetworkPolicy.NetworkPolicyId, `The unique identifier for the network policy.`) + + cmd.Use = "update-network-policy-rpc NETWORK_POLICY_ID" + cmd.Short = `Update a network policy.` + cmd.Long = `Update a network policy. + + Updates a network policy. This allows you to modify the configuration of a + network policy. + + Arguments: + NETWORK_POLICY_ID: The unique identifier for the network 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 := cmdctx.AccountClient(ctx) + + if cmd.Flags().Changed("json") { + diags := updateNetworkPolicyRpcJson.Unmarshal(&updateNetworkPolicyRpcReq.NetworkPolicy) + if diags.HasError() { + return diags.Error() + } + if len(diags) > 0 { + err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags) + if err != nil { + return err + } + } + } + updateNetworkPolicyRpcReq.NetworkPolicyId = args[0] + + response, err := a.NetworkPolicies.UpdateNetworkPolicyRpc(ctx, updateNetworkPolicyRpcReq) + 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 updateNetworkPolicyRpcOverrides { + fn(cmd, &updateNetworkPolicyRpcReq) + } + + return cmd +} + +// end service NetworkPolicies diff --git a/cmd/account/workspace-network-configuration/workspace-network-configuration.go b/cmd/account/workspace-network-configuration/workspace-network-configuration.go new file mode 100755 index 0000000000..c94ac5a96f --- /dev/null +++ b/cmd/account/workspace-network-configuration/workspace-network-configuration.go @@ -0,0 +1,197 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package workspace_network_configuration + +import ( + "fmt" + + "github.com/databricks/cli/cmd/root" + "github.com/databricks/cli/libs/cmdctx" + "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: "workspace-network-configuration", + Short: `These APIs allow configuration of network settings for Databricks workspaces.`, + Long: `These APIs allow configuration of network settings for Databricks workspaces. + Each workspace is always associated with exactly one network policy that + controls which network destinations can be accessed from the Databricks + environment. By default, workspaces are associated with the 'default-policy' + network policy. You cannot create or delete a workspace's network + configuration, only update it to associate the workspace with a different + policy.`, + GroupID: "settings", + Annotations: map[string]string{ + "package": "settings", + }, + + // This service is being previewed; hide from help output. + Hidden: true, + RunE: root.ReportUnknownSubcommand, + } + + // Add methods + cmd.AddCommand(newGetWorkspaceNetworkOptionRpc()) + cmd.AddCommand(newUpdateWorkspaceNetworkOptionRpc()) + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start get-workspace-network-option-rpc 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 getWorkspaceNetworkOptionRpcOverrides []func( + *cobra.Command, + *settings.GetWorkspaceNetworkOptionRequest, +) + +func newGetWorkspaceNetworkOptionRpc() *cobra.Command { + cmd := &cobra.Command{} + + var getWorkspaceNetworkOptionRpcReq settings.GetWorkspaceNetworkOptionRequest + + // TODO: short flags + + cmd.Use = "get-workspace-network-option-rpc WORKSPACE_ID" + cmd.Short = `Get workspace network configuration.` + cmd.Long = `Get workspace network configuration. + + Gets the network configuration for a workspace. Every workspace has exactly + one network policy binding, with 'default-policy' used if no explicit + assignment exists. + + Arguments: + WORKSPACE_ID: The workspace ID.` + + 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 := cmdctx.AccountClient(ctx) + + _, err = fmt.Sscan(args[0], &getWorkspaceNetworkOptionRpcReq.WorkspaceId) + if err != nil { + return fmt.Errorf("invalid WORKSPACE_ID: %s", args[0]) + } + + response, err := a.WorkspaceNetworkConfiguration.GetWorkspaceNetworkOptionRpc(ctx, getWorkspaceNetworkOptionRpcReq) + 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 getWorkspaceNetworkOptionRpcOverrides { + fn(cmd, &getWorkspaceNetworkOptionRpcReq) + } + + return cmd +} + +// start update-workspace-network-option-rpc 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 updateWorkspaceNetworkOptionRpcOverrides []func( + *cobra.Command, + *settings.UpdateWorkspaceNetworkOptionRequest, +) + +func newUpdateWorkspaceNetworkOptionRpc() *cobra.Command { + cmd := &cobra.Command{} + + var updateWorkspaceNetworkOptionRpcReq settings.UpdateWorkspaceNetworkOptionRequest + updateWorkspaceNetworkOptionRpcReq.WorkspaceNetworkOption = settings.WorkspaceNetworkOption{} + var updateWorkspaceNetworkOptionRpcJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&updateWorkspaceNetworkOptionRpcJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Flags().StringVar(&updateWorkspaceNetworkOptionRpcReq.WorkspaceNetworkOption.NetworkPolicyId, "network-policy-id", updateWorkspaceNetworkOptionRpcReq.WorkspaceNetworkOption.NetworkPolicyId, `The network policy ID to apply to the workspace.`) + cmd.Flags().Int64Var(&updateWorkspaceNetworkOptionRpcReq.WorkspaceNetworkOption.WorkspaceId, "workspace-id", updateWorkspaceNetworkOptionRpcReq.WorkspaceNetworkOption.WorkspaceId, `The workspace ID.`) + + cmd.Use = "update-workspace-network-option-rpc WORKSPACE_ID" + cmd.Short = `Update workspace network configuration.` + cmd.Long = `Update workspace network configuration. + + Updates the network configuration for a workspace. This operation associates + the workspace with the specified network policy. To revert to the default + policy, specify 'default-policy' as the network_policy_id. + + Arguments: + WORKSPACE_ID: The workspace ID.` + + 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 := cmdctx.AccountClient(ctx) + + if cmd.Flags().Changed("json") { + diags := updateWorkspaceNetworkOptionRpcJson.Unmarshal(&updateWorkspaceNetworkOptionRpcReq.WorkspaceNetworkOption) + if diags.HasError() { + return diags.Error() + } + if len(diags) > 0 { + err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags) + if err != nil { + return err + } + } + } + _, err = fmt.Sscan(args[0], &updateWorkspaceNetworkOptionRpcReq.WorkspaceId) + if err != nil { + return fmt.Errorf("invalid WORKSPACE_ID: %s", args[0]) + } + + response, err := a.WorkspaceNetworkConfiguration.UpdateWorkspaceNetworkOptionRpc(ctx, updateWorkspaceNetworkOptionRpcReq) + 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 updateWorkspaceNetworkOptionRpcOverrides { + fn(cmd, &updateWorkspaceNetworkOptionRpcReq) + } + + return cmd +} + +// end service WorkspaceNetworkConfiguration diff --git a/cmd/labs/project/entrypoint.go b/cmd/labs/project/entrypoint.go index 6c4646ff9f..af7c16ddec 100644 --- a/cmd/labs/project/entrypoint.go +++ b/cmd/labs/project/entrypoint.go @@ -253,7 +253,7 @@ func (e *Entrypoint) validLogin(cmd *cobra.Command) (*config.Config, error) { isACC := cfg.IsAccountClient() if e.IsAccountLevel && cfg.Profile == "" { if !cmdio.IsPromptSupported(ctx) { - return nil, config.ErrCannotConfigureAuth + return nil, root.ErrCannotConfigureAuth } replaceCfg, err := e.envAwareConfig(ctx) if err != nil { diff --git a/cmd/root/auth.go b/cmd/root/auth.go index 406631d24b..01e79959b3 100644 --- a/cmd/root/auth.go +++ b/cmd/root/auth.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "net/http" + "strings" "github.com/databricks/cli/libs/auth" "github.com/databricks/cli/libs/cmdctx" @@ -32,6 +33,20 @@ func (e ErrNoAccountProfiles) Error() string { return e.path + " does not contain account profiles" } +func isCannotConfigureAuth(err error) bool { + // As of SDK v0.70.0, this constant was removed. + // + // return errors.Is(err, config.ErrCannotConfigureAuth) + // + // The prefix check is based on this: + // + // https://github.com/databricks/databricks-sdk-go/commit/ef3a65c6ee8f0de253ce6f554e6d905d6a5fdc85#diff-83d1fd7f94efd3481cd11ebab8065cc81e18ef0d8776097c29b8a183a20df52fR86 + return strings.Contains(err.Error(), "cannot configure default credentials, ") +} + +// Referenced by cmd/labs/project/entrypoint.go. +var ErrCannotConfigureAuth = errors.New("cannot configure default credentials, please check https://docs.databricks.com/en/dev-tools/auth.html#databricks-client-unified-authentication to configure credentials for your preferred authentication method.") + func initProfileFlag(cmd *cobra.Command) { cmd.PersistentFlags().StringP("profile", "p", "", "~/.databrickscfg profile") cmd.RegisterFlagCompletionFunc("profile", profile.ProfileCompletion) @@ -58,7 +73,7 @@ func accountClientOrPrompt(ctx context.Context, cfg *config.Config, allowPrompt // Prompt to select a profile if the current configuration is not an account client. prompt = prompt || errors.Is(err, databricks.ErrNotAccountClient) // Prompt to select a profile if the current configuration doesn't resolve to a credential provider. - prompt = prompt || errors.Is(err, config.ErrCannotConfigureAuth) + prompt = prompt || isCannotConfigureAuth(err) } if !prompt { @@ -158,7 +173,7 @@ func workspaceClientOrPrompt(ctx context.Context, cfg *config.Config, allowPromp // Prompt to select a profile if the current configuration is not a workspace client. prompt = prompt || errors.Is(err, databricks.ErrNotWorkspaceClient) // Prompt to select a profile if the current configuration doesn't resolve to a credential provider. - prompt = prompt || errors.Is(err, config.ErrCannotConfigureAuth) + prompt = prompt || isCannotConfigureAuth(err) } if !prompt { diff --git a/cmd/root/auth_test.go b/cmd/root/auth_test.go index 8b53d1c31e..9b44e6eb91 100644 --- a/cmd/root/auth_test.go +++ b/cmd/root/auth_test.go @@ -110,6 +110,9 @@ func TestAccountClientOrPrompt(t *testing.T) { }) t.Run("Prompt if no credential provider can be configured", func(t *testing.T) { + // The SDK probes all auth types when not specified and this fails for the u2m probe on Windows. + t.Skip("Skipping as of #2920") + expectPrompts(t, accountPromptFn, &config.Config{ Host: "https://accounts.azuredatabricks.net/", AccountID: "1234", @@ -117,7 +120,6 @@ func TestAccountClientOrPrompt(t *testing.T) { // Force SDK to not try and lookup the tenant ID from the host. // The host above is invalid and will not be reachable. AzureTenantID: "nonempty", - AuthType: "azure", // Forcing Azure auth type so that the does not try to use the new u2m auth. }) }) @@ -170,13 +172,15 @@ func TestWorkspaceClientOrPrompt(t *testing.T) { }) t.Run("Prompt if no credential provider can be configured", func(t *testing.T) { + // The SDK probes all auth types when not specified and this fails for the u2m probe on Windows. + t.Skip("Skipping as of #2920") + expectPrompts(t, workspacePromptFn, &config.Config{ Host: "https://adb-1111.11.azuredatabricks.net/", // Force SDK to not try and lookup the tenant ID from the host. // The host above is invalid and will not be reachable. AzureTenantID: "nonempty", - AuthType: "azure", // Forcing Azure auth type so that the does not try to use the new u2m auth. }) }) diff --git a/cmd/workspace/alerts/alerts.go b/cmd/workspace/alerts/alerts.go index 826bac7b0a..c291ac31a4 100755 --- a/cmd/workspace/alerts/alerts.go +++ b/cmd/workspace/alerts/alerts.go @@ -329,6 +329,7 @@ func newUpdate() *cobra.Command { cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`) // TODO: complex arg: alert + cmd.Flags().BoolVar(&updateReq.AutoResolveDisplayName, "auto-resolve-display-name", updateReq.AutoResolveDisplayName, `If true, automatically resolve alert display name conflicts.`) cmd.Use = "update ID UPDATE_MASK" cmd.Short = `Update an alert.` diff --git a/cmd/workspace/cmd.go b/cmd/workspace/cmd.go index 53e8cc604d..c496d588bb 100755 --- a/cmd/workspace/cmd.go +++ b/cmd/workspace/cmd.go @@ -71,6 +71,7 @@ import ( 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" + recipient_federation_policies "github.com/databricks/cli/cmd/workspace/recipient-federation-policies" 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" @@ -170,6 +171,7 @@ func All() []*cobra.Command { out = append(out, query_visualizations.New()) out = append(out, query_visualizations_legacy.New()) out = append(out, recipient_activation.New()) + out = append(out, recipient_federation_policies.New()) out = append(out, recipients.New()) out = append(out, redash_config.New()) out = append(out, registered_models.New()) diff --git a/cmd/workspace/disable-legacy-dbfs/disable-legacy-dbfs.go b/cmd/workspace/disable-legacy-dbfs/disable-legacy-dbfs.go index ebb4c17d42..ce203f02f9 100755 --- a/cmd/workspace/disable-legacy-dbfs/disable-legacy-dbfs.go +++ b/cmd/workspace/disable-legacy-dbfs/disable-legacy-dbfs.go @@ -20,10 +20,16 @@ var cmdOverrides []func(*cobra.Command) func New() *cobra.Command { cmd := &cobra.Command{ Use: "disable-legacy-dbfs", - Short: `When this setting is on, access to DBFS root and DBFS mounts is disallowed (as well as creation of new mounts).`, - Long: `When this setting is on, access to DBFS root and DBFS mounts is disallowed (as - well as creation of new mounts). When the setting is off, all DBFS - functionality is enabled`, + Short: `Disabling legacy DBFS has the following implications: 1.`, + Long: `Disabling legacy DBFS has the following implications: + + 1. Access to DBFS root and DBFS mounts is disallowed (as well as the creation + of new mounts). 2. Disables Databricks Runtime versions prior to 13.3LTS. + + When the setting is off, all DBFS functionality is enabled and no restrictions + are imposed on Databricks Runtime versions. This setting can take up to 20 + minutes to take effect and requires a manual restart of all-purpose compute + clusters and SQL warehouses.`, // This service is being previewed; hide from help output. Hidden: true, diff --git a/cmd/workspace/enable-export-notebook/enable-export-notebook.go b/cmd/workspace/enable-export-notebook/enable-export-notebook.go index e57d88c1f1..9de9b20965 100755 --- a/cmd/workspace/enable-export-notebook/enable-export-notebook.go +++ b/cmd/workspace/enable-export-notebook/enable-export-notebook.go @@ -23,10 +23,7 @@ func New() *cobra.Command { Short: `Controls whether users can export notebooks and files from the Workspace UI.`, Long: `Controls whether users can export notebooks and files from the Workspace UI. By default, this setting is enabled.`, - - // This service is being previewed; hide from help output. - Hidden: true, - RunE: root.ReportUnknownSubcommand, + RunE: root.ReportUnknownSubcommand, } // Add methods diff --git a/cmd/workspace/enable-notebook-table-clipboard/enable-notebook-table-clipboard.go b/cmd/workspace/enable-notebook-table-clipboard/enable-notebook-table-clipboard.go index 852c099a18..cd542233e1 100755 --- a/cmd/workspace/enable-notebook-table-clipboard/enable-notebook-table-clipboard.go +++ b/cmd/workspace/enable-notebook-table-clipboard/enable-notebook-table-clipboard.go @@ -23,10 +23,7 @@ func New() *cobra.Command { Short: `Controls whether users can copy tabular data to the clipboard via the UI.`, Long: `Controls whether users can copy tabular data to the clipboard via the UI. By default, this setting is enabled.`, - - // This service is being previewed; hide from help output. - Hidden: true, - RunE: root.ReportUnknownSubcommand, + RunE: root.ReportUnknownSubcommand, } // Add methods diff --git a/cmd/workspace/enable-results-downloading/enable-results-downloading.go b/cmd/workspace/enable-results-downloading/enable-results-downloading.go index 4b9ff022bc..b95259fb6d 100755 --- a/cmd/workspace/enable-results-downloading/enable-results-downloading.go +++ b/cmd/workspace/enable-results-downloading/enable-results-downloading.go @@ -23,10 +23,7 @@ func New() *cobra.Command { Short: `Controls whether users can download notebook results.`, Long: `Controls whether users can download notebook results. By default, this setting is enabled.`, - - // This service is being previewed; hide from help output. - Hidden: true, - RunE: root.ReportUnknownSubcommand, + RunE: root.ReportUnknownSubcommand, } // Add methods diff --git a/cmd/workspace/experiments/experiments.go b/cmd/workspace/experiments/experiments.go index e1fa5d9ee3..d4a4738d07 100755 --- a/cmd/workspace/experiments/experiments.go +++ b/cmd/workspace/experiments/experiments.go @@ -39,32 +39,42 @@ func New() *cobra.Command { // Add methods cmd.AddCommand(newCreateExperiment()) + cmd.AddCommand(newCreateLoggedModel()) cmd.AddCommand(newCreateRun()) cmd.AddCommand(newDeleteExperiment()) + cmd.AddCommand(newDeleteLoggedModel()) + cmd.AddCommand(newDeleteLoggedModelTag()) cmd.AddCommand(newDeleteRun()) cmd.AddCommand(newDeleteRuns()) cmd.AddCommand(newDeleteTag()) + cmd.AddCommand(newFinalizeLoggedModel()) cmd.AddCommand(newGetByName()) cmd.AddCommand(newGetCredentialsForTraceDataDownload()) cmd.AddCommand(newGetCredentialsForTraceDataUpload()) cmd.AddCommand(newGetExperiment()) cmd.AddCommand(newGetHistory()) + cmd.AddCommand(newGetLoggedModel()) cmd.AddCommand(newGetPermissionLevels()) cmd.AddCommand(newGetPermissions()) cmd.AddCommand(newGetRun()) cmd.AddCommand(newListArtifacts()) cmd.AddCommand(newListExperiments()) + cmd.AddCommand(newListLoggedModelArtifacts()) cmd.AddCommand(newLogBatch()) cmd.AddCommand(newLogInputs()) + cmd.AddCommand(newLogLoggedModelParams()) cmd.AddCommand(newLogMetric()) cmd.AddCommand(newLogModel()) + cmd.AddCommand(newLogOutputs()) cmd.AddCommand(newLogParam()) cmd.AddCommand(newRestoreExperiment()) cmd.AddCommand(newRestoreRun()) cmd.AddCommand(newRestoreRuns()) cmd.AddCommand(newSearchExperiments()) + cmd.AddCommand(newSearchLoggedModels()) cmd.AddCommand(newSearchRuns()) cmd.AddCommand(newSetExperimentTag()) + cmd.AddCommand(newSetLoggedModelTags()) cmd.AddCommand(newSetPermissions()) cmd.AddCommand(newSetTag()) cmd.AddCommand(newUpdateExperiment()) @@ -168,6 +178,94 @@ func newCreateExperiment() *cobra.Command { return cmd } +// start create-logged-model 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 createLoggedModelOverrides []func( + *cobra.Command, + *ml.CreateLoggedModelRequest, +) + +func newCreateLoggedModel() *cobra.Command { + cmd := &cobra.Command{} + + var createLoggedModelReq ml.CreateLoggedModelRequest + var createLoggedModelJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&createLoggedModelJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Flags().StringVar(&createLoggedModelReq.ModelType, "model-type", createLoggedModelReq.ModelType, `The type of the model, such as "Agent", "Classifier", "LLM".`) + cmd.Flags().StringVar(&createLoggedModelReq.Name, "name", createLoggedModelReq.Name, `The name of the model (optional).`) + // TODO: array: params + cmd.Flags().StringVar(&createLoggedModelReq.SourceRunId, "source-run-id", createLoggedModelReq.SourceRunId, `The ID of the run that created the model.`) + // TODO: array: tags + + cmd.Use = "create-logged-model EXPERIMENT_ID" + cmd.Short = `Create a logged model.` + cmd.Long = `Create a logged model. + + Arguments: + EXPERIMENT_ID: The ID of the experiment that owns the model.` + + // 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 { + 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 'experiment_id' in your JSON input") + } + return nil + } + 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 := cmdctx.WorkspaceClient(ctx) + + if cmd.Flags().Changed("json") { + diags := createLoggedModelJson.Unmarshal(&createLoggedModelReq) + 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") { + createLoggedModelReq.ExperimentId = args[0] + } + + response, err := w.Experiments.CreateLoggedModel(ctx, createLoggedModelReq) + 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 createLoggedModelOverrides { + fn(cmd, &createLoggedModelReq) + } + + return cmd +} + // start create-run command // Slice with functions to override default command behavior. @@ -328,6 +426,126 @@ func newDeleteExperiment() *cobra.Command { return cmd } +// start delete-logged-model 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 deleteLoggedModelOverrides []func( + *cobra.Command, + *ml.DeleteLoggedModelRequest, +) + +func newDeleteLoggedModel() *cobra.Command { + cmd := &cobra.Command{} + + var deleteLoggedModelReq ml.DeleteLoggedModelRequest + + // TODO: short flags + + cmd.Use = "delete-logged-model MODEL_ID" + cmd.Short = `Delete a logged model.` + cmd.Long = `Delete a logged model. + + Arguments: + MODEL_ID: The ID of the logged model to delete.` + + // 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 := cmdctx.WorkspaceClient(ctx) + + deleteLoggedModelReq.ModelId = args[0] + + err = w.Experiments.DeleteLoggedModel(ctx, deleteLoggedModelReq) + 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 deleteLoggedModelOverrides { + fn(cmd, &deleteLoggedModelReq) + } + + return cmd +} + +// start delete-logged-model-tag 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 deleteLoggedModelTagOverrides []func( + *cobra.Command, + *ml.DeleteLoggedModelTagRequest, +) + +func newDeleteLoggedModelTag() *cobra.Command { + cmd := &cobra.Command{} + + var deleteLoggedModelTagReq ml.DeleteLoggedModelTagRequest + + // TODO: short flags + + cmd.Use = "delete-logged-model-tag MODEL_ID TAG_KEY" + cmd.Short = `Delete a tag on a logged model.` + cmd.Long = `Delete a tag on a logged model. + + Arguments: + MODEL_ID: The ID of the logged model to delete the tag from. + TAG_KEY: The tag key.` + + // 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(2) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := cmdctx.WorkspaceClient(ctx) + + deleteLoggedModelTagReq.ModelId = args[0] + deleteLoggedModelTagReq.TagKey = args[1] + + err = w.Experiments.DeleteLoggedModelTag(ctx, deleteLoggedModelTagReq) + 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 deleteLoggedModelTagOverrides { + fn(cmd, &deleteLoggedModelTagReq) + } + + return cmd +} + // start delete-run command // Slice with functions to override default command behavior. @@ -589,6 +807,96 @@ func newDeleteTag() *cobra.Command { return cmd } +// start finalize-logged-model 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 finalizeLoggedModelOverrides []func( + *cobra.Command, + *ml.FinalizeLoggedModelRequest, +) + +func newFinalizeLoggedModel() *cobra.Command { + cmd := &cobra.Command{} + + var finalizeLoggedModelReq ml.FinalizeLoggedModelRequest + var finalizeLoggedModelJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&finalizeLoggedModelJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "finalize-logged-model MODEL_ID STATUS" + cmd.Short = `Finalize a logged model.` + cmd.Long = `Finalize a logged model. + + Arguments: + MODEL_ID: The ID of the logged model to finalize. + STATUS: Whether or not the model is ready for use. + "LOGGED_MODEL_UPLOAD_FAILED" indicates that something went wrong when + logging the model weights / agent code). + Supported values: [LOGGED_MODEL_PENDING, LOGGED_MODEL_READY, LOGGED_MODEL_UPLOAD_FAILED]` + + // 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 { + if cmd.Flags().Changed("json") { + err := root.ExactArgs(1)(cmd, args) + if err != nil { + return fmt.Errorf("when --json flag is specified, provide only MODEL_ID as positional arguments. Provide 'status' 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 := cmdctx.WorkspaceClient(ctx) + + if cmd.Flags().Changed("json") { + diags := finalizeLoggedModelJson.Unmarshal(&finalizeLoggedModelReq) + if diags.HasError() { + return diags.Error() + } + if len(diags) > 0 { + err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags) + if err != nil { + return err + } + } + } + finalizeLoggedModelReq.ModelId = args[0] + if !cmd.Flags().Changed("json") { + _, err = fmt.Sscan(args[1], &finalizeLoggedModelReq.Status) + if err != nil { + return fmt.Errorf("invalid STATUS: %s", args[1]) + } + } + + response, err := w.Experiments.FinalizeLoggedModel(ctx, finalizeLoggedModelReq) + 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 finalizeLoggedModelOverrides { + fn(cmd, &finalizeLoggedModelReq) + } + + return cmd +} + // start get-by-name command // Slice with functions to override default command behavior. @@ -891,6 +1199,65 @@ func newGetHistory() *cobra.Command { return cmd } +// start get-logged-model 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 getLoggedModelOverrides []func( + *cobra.Command, + *ml.GetLoggedModelRequest, +) + +func newGetLoggedModel() *cobra.Command { + cmd := &cobra.Command{} + + var getLoggedModelReq ml.GetLoggedModelRequest + + // TODO: short flags + + cmd.Use = "get-logged-model MODEL_ID" + cmd.Short = `Get a logged model.` + cmd.Long = `Get a logged model. + + Arguments: + MODEL_ID: The ID of the logged model to retrieve.` + + // 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 := cmdctx.WorkspaceClient(ctx) + + getLoggedModelReq.ModelId = args[0] + + response, err := w.Experiments.GetLoggedModel(ctx, getLoggedModelReq) + 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 getLoggedModelOverrides { + fn(cmd, &getLoggedModelReq) + } + + return cmd +} + // start get-permission-levels command // Slice with functions to override default command behavior. @@ -1180,8 +1547,74 @@ func newListExperiments() *cobra.Command { cmd.ValidArgsFunction = cobra.NoFileCompletions // Apply optional overrides to this command. - for _, fn := range listExperimentsOverrides { - fn(cmd, &listExperimentsReq) + for _, fn := range listExperimentsOverrides { + fn(cmd, &listExperimentsReq) + } + + return cmd +} + +// start list-logged-model-artifacts 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 listLoggedModelArtifactsOverrides []func( + *cobra.Command, + *ml.ListLoggedModelArtifactsRequest, +) + +func newListLoggedModelArtifacts() *cobra.Command { + cmd := &cobra.Command{} + + var listLoggedModelArtifactsReq ml.ListLoggedModelArtifactsRequest + + // TODO: short flags + + cmd.Flags().StringVar(&listLoggedModelArtifactsReq.ArtifactDirectoryPath, "artifact-directory-path", listLoggedModelArtifactsReq.ArtifactDirectoryPath, `Filter artifacts matching this path (a relative path from the root artifact directory).`) + cmd.Flags().StringVar(&listLoggedModelArtifactsReq.PageToken, "page-token", listLoggedModelArtifactsReq.PageToken, `Token indicating the page of artifact results to fetch.`) + + cmd.Use = "list-logged-model-artifacts MODEL_ID" + cmd.Short = `List artifacts for a logged model.` + cmd.Long = `List artifacts for a logged model. + + List artifacts for a logged model. Takes an optional + artifact_directory_path prefix which if specified, the response contains + only artifacts with the specified prefix. + + Arguments: + MODEL_ID: The ID of the logged model for which to list the artifacts.` + + // 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 := cmdctx.WorkspaceClient(ctx) + + listLoggedModelArtifactsReq.ModelId = args[0] + + response, err := w.Experiments.ListLoggedModelArtifacts(ctx, listLoggedModelArtifactsReq) + 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 listLoggedModelArtifactsOverrides { + fn(cmd, &listLoggedModelArtifactsReq) } return cmd @@ -1389,6 +1822,86 @@ func newLogInputs() *cobra.Command { return cmd } +// start log-logged-model-params 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 logLoggedModelParamsOverrides []func( + *cobra.Command, + *ml.LogLoggedModelParamsRequest, +) + +func newLogLoggedModelParams() *cobra.Command { + cmd := &cobra.Command{} + + var logLoggedModelParamsReq ml.LogLoggedModelParamsRequest + var logLoggedModelParamsJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&logLoggedModelParamsJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + // TODO: array: params + + cmd.Use = "log-logged-model-params MODEL_ID" + cmd.Short = `Log params for a logged model.` + cmd.Long = `Log params for a logged model. + + Logs params for a logged model. A param is a key-value pair (string key, + string value). Examples include hyperparameters used for ML model training. A + param can be logged only once for a logged model, and attempting to overwrite + an existing param with a different value will result in an error + + Arguments: + MODEL_ID: The ID of the logged model to log params for.` + + // 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 := cmdctx.WorkspaceClient(ctx) + + if cmd.Flags().Changed("json") { + diags := logLoggedModelParamsJson.Unmarshal(&logLoggedModelParamsReq) + if diags.HasError() { + return diags.Error() + } + if len(diags) > 0 { + err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags) + if err != nil { + return err + } + } + } + logLoggedModelParamsReq.ModelId = args[0] + + err = w.Experiments.LogLoggedModelParams(ctx, logLoggedModelParamsReq) + 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 logLoggedModelParamsOverrides { + fn(cmd, &logLoggedModelParamsReq) + } + + return cmd +} + // start log-metric command // Slice with functions to override default command behavior. @@ -1565,6 +2078,95 @@ func newLogModel() *cobra.Command { return cmd } +// start log-outputs 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 logOutputsOverrides []func( + *cobra.Command, + *ml.LogOutputsRequest, +) + +func newLogOutputs() *cobra.Command { + cmd := &cobra.Command{} + + var logOutputsReq ml.LogOutputsRequest + var logOutputsJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&logOutputsJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + // TODO: array: models + + cmd.Use = "log-outputs RUN_ID" + cmd.Short = `Log outputs from a run.` + cmd.Long = `Log outputs from a run. + + **NOTE**: Experimental: This API may change or be removed in a future release + without warning. + + Logs outputs, such as models, from an MLflow Run. + + Arguments: + RUN_ID: The ID of the Run from which to log outputs.` + + // 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 { + 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 'run_id' in your JSON input") + } + return nil + } + 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 := cmdctx.WorkspaceClient(ctx) + + if cmd.Flags().Changed("json") { + diags := logOutputsJson.Unmarshal(&logOutputsReq) + 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") { + logOutputsReq.RunId = args[0] + } + + err = w.Experiments.LogOutputs(ctx, logOutputsReq) + 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 logOutputsOverrides { + fn(cmd, &logOutputsReq) + } + + return cmd +} + // start log-param command // Slice with functions to override default command behavior. @@ -1992,6 +2594,84 @@ func newSearchExperiments() *cobra.Command { return cmd } +// start search-logged-models 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 searchLoggedModelsOverrides []func( + *cobra.Command, + *ml.SearchLoggedModelsRequest, +) + +func newSearchLoggedModels() *cobra.Command { + cmd := &cobra.Command{} + + var searchLoggedModelsReq ml.SearchLoggedModelsRequest + var searchLoggedModelsJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&searchLoggedModelsJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + // TODO: array: datasets + // TODO: array: experiment_ids + cmd.Flags().StringVar(&searchLoggedModelsReq.Filter, "filter", searchLoggedModelsReq.Filter, `A filter expression over logged model info and data that allows returning a subset of logged models.`) + cmd.Flags().IntVar(&searchLoggedModelsReq.MaxResults, "max-results", searchLoggedModelsReq.MaxResults, `The maximum number of Logged Models to return.`) + // TODO: array: order_by + cmd.Flags().StringVar(&searchLoggedModelsReq.PageToken, "page-token", searchLoggedModelsReq.PageToken, `The token indicating the page of logged models to fetch.`) + + cmd.Use = "search-logged-models" + cmd.Short = `Search logged models.` + cmd.Long = `Search logged models. + + Search for Logged Models that satisfy specified search criteria.` + + // 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(0) + return check(cmd, args) + } + + cmd.PreRunE = root.MustWorkspaceClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + w := cmdctx.WorkspaceClient(ctx) + + if cmd.Flags().Changed("json") { + diags := searchLoggedModelsJson.Unmarshal(&searchLoggedModelsReq) + if diags.HasError() { + return diags.Error() + } + if len(diags) > 0 { + err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags) + if err != nil { + return err + } + } + } + + response, err := w.Experiments.SearchLoggedModels(ctx, searchLoggedModelsReq) + 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 searchLoggedModelsOverrides { + fn(cmd, &searchLoggedModelsReq) + } + + return cmd +} + // start search-runs command // Slice with functions to override default command behavior. @@ -2156,6 +2836,81 @@ func newSetExperimentTag() *cobra.Command { return cmd } +// start set-logged-model-tags 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 setLoggedModelTagsOverrides []func( + *cobra.Command, + *ml.SetLoggedModelTagsRequest, +) + +func newSetLoggedModelTags() *cobra.Command { + cmd := &cobra.Command{} + + var setLoggedModelTagsReq ml.SetLoggedModelTagsRequest + var setLoggedModelTagsJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&setLoggedModelTagsJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + // TODO: array: tags + + cmd.Use = "set-logged-model-tags MODEL_ID" + cmd.Short = `Set a tag for a logged model.` + cmd.Long = `Set a tag for a logged model. + + Arguments: + MODEL_ID: The ID of the logged model to set the tags on.` + + // 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 := cmdctx.WorkspaceClient(ctx) + + if cmd.Flags().Changed("json") { + diags := setLoggedModelTagsJson.Unmarshal(&setLoggedModelTagsReq) + if diags.HasError() { + return diags.Error() + } + if len(diags) > 0 { + err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags) + if err != nil { + return err + } + } + } + setLoggedModelTagsReq.ModelId = args[0] + + err = w.Experiments.SetLoggedModelTags(ctx, setLoggedModelTagsReq) + 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 setLoggedModelTagsOverrides { + fn(cmd, &setLoggedModelTagsReq) + } + + return cmd +} + // start set-permissions command // Slice with functions to override default command behavior. diff --git a/cmd/workspace/external-locations/external-locations.go b/cmd/workspace/external-locations/external-locations.go index 8c16f4f5e6..c9a22f3fe0 100755 --- a/cmd/workspace/external-locations/external-locations.go +++ b/cmd/workspace/external-locations/external-locations.go @@ -74,10 +74,11 @@ func newCreate() *cobra.Command { // TODO: short flags cmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) - cmd.Flags().StringVar(&createReq.AccessPoint, "access-point", createReq.AccessPoint, `The AWS access point to use when accesing s3 for this external location.`) cmd.Flags().StringVar(&createReq.Comment, "comment", createReq.Comment, `User-provided free-form text description.`) + cmd.Flags().BoolVar(&createReq.EnableFileEvents, "enable-file-events", createReq.EnableFileEvents, `[Create:OPT Update:OPT] Whether to enable file events on this external location.`) // TODO: complex arg: encryption_details cmd.Flags().BoolVar(&createReq.Fallback, "fallback", createReq.Fallback, `Indicates whether fallback mode is enabled for this external location.`) + // TODO: complex arg: file_event_queue cmd.Flags().BoolVar(&createReq.ReadOnly, "read-only", createReq.ReadOnly, `Indicates whether the external location is read-only.`) cmd.Flags().BoolVar(&createReq.SkipValidation, "skip-validation", createReq.SkipValidation, `Skips validation of the storage credential associated with the external location.`) @@ -352,11 +353,12 @@ func newUpdate() *cobra.Command { // TODO: short flags cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`) - cmd.Flags().StringVar(&updateReq.AccessPoint, "access-point", updateReq.AccessPoint, `The AWS access point to use when accesing s3 for this external location.`) cmd.Flags().StringVar(&updateReq.Comment, "comment", updateReq.Comment, `User-provided free-form text description.`) cmd.Flags().StringVar(&updateReq.CredentialName, "credential-name", updateReq.CredentialName, `Name of the storage credential used with this location.`) + cmd.Flags().BoolVar(&updateReq.EnableFileEvents, "enable-file-events", updateReq.EnableFileEvents, `[Create:OPT Update:OPT] Whether to enable file events on this external location.`) // TODO: complex arg: encryption_details cmd.Flags().BoolVar(&updateReq.Fallback, "fallback", updateReq.Fallback, `Indicates whether fallback mode is enabled for this external location.`) + // TODO: complex arg: file_event_queue cmd.Flags().BoolVar(&updateReq.Force, "force", updateReq.Force, `Force update even if changing url invalidates dependent external tables or mounts.`) cmd.Flags().Var(&updateReq.IsolationMode, "isolation-mode", `. Supported values: [ISOLATION_MODE_ISOLATED, ISOLATION_MODE_OPEN]`) cmd.Flags().StringVar(&updateReq.NewName, "new-name", updateReq.NewName, `New name for the external location.`) diff --git a/cmd/workspace/grants/grants.go b/cmd/workspace/grants/grants.go index 69f57a5e64..9abbef1cf1 100755 --- a/cmd/workspace/grants/grants.go +++ b/cmd/workspace/grants/grants.go @@ -84,6 +84,7 @@ func newGet() *cobra.Command { CONNECTION, CREDENTIAL, EXTERNAL_LOCATION, + EXTERNAL_METADATA, FUNCTION, METASTORE, PIPELINE, @@ -91,8 +92,10 @@ func newGet() *cobra.Command { RECIPIENT, SCHEMA, SHARE, + STAGING_TABLE, STORAGE_CREDENTIAL, TABLE, + UNKNOWN_SECURABLE_TYPE, VOLUME, ] FULL_NAME: Full name of securable.` @@ -166,6 +169,7 @@ func newGetEffective() *cobra.Command { CONNECTION, CREDENTIAL, EXTERNAL_LOCATION, + EXTERNAL_METADATA, FUNCTION, METASTORE, PIPELINE, @@ -173,8 +177,10 @@ func newGetEffective() *cobra.Command { RECIPIENT, SCHEMA, SHARE, + STAGING_TABLE, STORAGE_CREDENTIAL, TABLE, + UNKNOWN_SECURABLE_TYPE, VOLUME, ] FULL_NAME: Full name of securable.` @@ -250,6 +256,7 @@ func newUpdate() *cobra.Command { CONNECTION, CREDENTIAL, EXTERNAL_LOCATION, + EXTERNAL_METADATA, FUNCTION, METASTORE, PIPELINE, @@ -257,8 +264,10 @@ func newUpdate() *cobra.Command { RECIPIENT, SCHEMA, SHARE, + STAGING_TABLE, STORAGE_CREDENTIAL, TABLE, + UNKNOWN_SECURABLE_TYPE, VOLUME, ] FULL_NAME: Full name of securable.` diff --git a/cmd/workspace/instance-profiles/instance-profiles.go b/cmd/workspace/instance-profiles/instance-profiles.go index ee8abff06a..52090fcce2 100755 --- a/cmd/workspace/instance-profiles/instance-profiles.go +++ b/cmd/workspace/instance-profiles/instance-profiles.go @@ -74,8 +74,10 @@ func newAdd() *cobra.Command { cmd.Short = `Register an instance profile.` cmd.Long = `Register an instance profile. - In the UI, you can select the instance profile when launching clusters. This - API is only available to admin users. + Registers an instance profile in Databricks. In the UI, you can then give + users the permission to use this instance profile when launching clusters. + + This API is only available to admin users. Arguments: INSTANCE_PROFILE_ARN: The AWS ARN of the instance profile to register with Databricks. This diff --git a/cmd/workspace/pipelines/pipelines.go b/cmd/workspace/pipelines/pipelines.go index 7ea89b10de..3000842482 100755 --- a/cmd/workspace/pipelines/pipelines.go +++ b/cmd/workspace/pipelines/pipelines.go @@ -975,6 +975,7 @@ func newUpdate() *cobra.Command { // TODO: array: notifications cmd.Flags().BoolVar(&updateReq.Photon, "photon", updateReq.Photon, `Whether Photon is enabled for this pipeline.`) // TODO: complex arg: restart_window + cmd.Flags().StringVar(&updateReq.RootPath, "root-path", updateReq.RootPath, `Root path for this pipeline.`) // TODO: complex arg: run_as cmd.Flags().StringVar(&updateReq.Schema, "schema", updateReq.Schema, `The default schema (database) where tables are read from or published to.`) cmd.Flags().BoolVar(&updateReq.Serverless, "serverless", updateReq.Serverless, `Whether serverless compute is enabled for this pipeline.`) diff --git a/cmd/workspace/queries/queries.go b/cmd/workspace/queries/queries.go index fa148fbfe6..68cb941a6f 100755 --- a/cmd/workspace/queries/queries.go +++ b/cmd/workspace/queries/queries.go @@ -399,6 +399,7 @@ func newUpdate() *cobra.Command { // TODO: short flags cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`) + cmd.Flags().BoolVar(&updateReq.AutoResolveDisplayName, "auto-resolve-display-name", updateReq.AutoResolveDisplayName, `If true, automatically resolve alert display name conflicts.`) // TODO: complex arg: query cmd.Use = "update ID UPDATE_MASK" diff --git a/cmd/workspace/recipient-federation-policies/recipient-federation-policies.go b/cmd/workspace/recipient-federation-policies/recipient-federation-policies.go new file mode 100755 index 0000000000..10585afba3 --- /dev/null +++ b/cmd/workspace/recipient-federation-policies/recipient-federation-policies.go @@ -0,0 +1,443 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package recipient_federation_policies + +import ( + "github.com/databricks/cli/cmd/root" + "github.com/databricks/cli/libs/cmdctx" + "github.com/databricks/cli/libs/cmdio" + "github.com/databricks/cli/libs/flags" + "github.com/databricks/databricks-sdk-go/service/sharing" + "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: "recipient-federation-policies", + Short: `The Recipient Federation Policies APIs are only applicable in the open sharing model where the recipient object has the authentication type of OIDC_RECIPIENT, enabling data sharing from Databricks to non-Databricks recipients.`, + Long: `The Recipient Federation Policies APIs are only applicable in the open sharing + model where the recipient object has the authentication type of + OIDC_RECIPIENT, enabling data sharing from Databricks to non-Databricks + recipients. OIDC Token Federation enables secure, secret-less authentication + for accessing Delta Sharing servers. Users and applications authenticate using + short-lived OIDC tokens issued by their own Identity Provider (IdP), such as + Azure Entra ID or Okta, without the need for managing static credentials or + client secrets. A federation policy defines how non-Databricks recipients + authenticate using OIDC tokens. It validates the OIDC claims in federated + tokens and is set at the recipient level. The caller must be the owner of the + recipient to create or manage a federation policy. Federation policies support + the following scenarios: - User-to-Machine (U2M) flow: A user accesses Delta + Shares using their own identity, such as connecting through PowerBI Delta + Sharing Client. - Machine-to-Machine (M2M) flow: An application accesses Delta + Shares using its own identity, typically for automation tasks like nightly + jobs through Python Delta Sharing Client. OIDC Token Federation enables + fine-grained access control, supports Multi-Factor Authentication (MFA), and + enhances security by minimizing the risk of credential leakage through the use + of short-lived, expiring tokens. It is designed for strong identity + governance, secure cross-platform data sharing, and reduced operational + overhead for credential management. + + For more information, see + https://www.databricks.com/blog/announcing-oidc-token-federation-enhanced-delta-sharing-security + and https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed`, + GroupID: "sharing", + Annotations: map[string]string{ + "package": "sharing", + }, + + // This service is being previewed; hide from help output. + Hidden: true, + RunE: root.ReportUnknownSubcommand, + } + + // Add methods + cmd.AddCommand(newCreate()) + cmd.AddCommand(newDelete()) + cmd.AddCommand(newGetFederationPolicy()) + 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, + *sharing.CreateFederationPolicyRequest, +) + +func newCreate() *cobra.Command { + cmd := &cobra.Command{} + + var createReq sharing.CreateFederationPolicyRequest + createReq.Policy = sharing.FederationPolicy{} + var createJson flags.JsonFlag + + // TODO: short flags + cmd.Flags().Var(&createJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Flags().StringVar(&createReq.Policy.Comment, "comment", createReq.Policy.Comment, `Description of the policy.`) + cmd.Flags().StringVar(&createReq.Policy.Name, "name", createReq.Policy.Name, `Name of the federation policy.`) + // TODO: complex arg: oidc_policy + + cmd.Use = "create RECIPIENT_NAME" + cmd.Short = `Create recipient federation policy.` + cmd.Long = `Create recipient federation policy. + + Create a federation policy for an OIDC_FEDERATION recipient for sharing data + from Databricks to non-Databricks recipients. The caller must be the owner of + the recipient. When sharing data from Databricks to non-Databricks clients, + you can define a federation policy to authenticate non-Databricks recipients. + The federation policy validates OIDC claims in federated tokens and is defined + at the recipient level. This enables secretless sharing clients to + authenticate using OIDC tokens. + + Supported scenarios for federation policies: 1. **User-to-Machine (U2M) flow** + (e.g., PowerBI): A user accesses a resource using their own identity. 2. + **Machine-to-Machine (M2M) flow** (e.g., OAuth App): An OAuth App accesses a + resource using its own identity, typically for tasks like running nightly + jobs. + + For an overview, refer to: - Blog post: Overview of feature: + https://www.databricks.com/blog/announcing-oidc-token-federation-enhanced-delta-sharing-security + + For detailed configuration guides based on your use case: - Creating a + Federation Policy as a provider: + https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed - + Configuration and usage for Machine-to-Machine (M2M) applications (e.g., + Python Delta Sharing Client): + https://docs.databricks.com/aws/en/delta-sharing/sharing-over-oidc-m2m - + Configuration and usage for User-to-Machine (U2M) applications (e.g., + PowerBI): + https://docs.databricks.com/aws/en/delta-sharing/sharing-over-oidc-u2m + + Arguments: + RECIPIENT_NAME: Name of the recipient. This is the name of the recipient for which the + policy is being created.` + + 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 := cmdctx.WorkspaceClient(ctx) + + if cmd.Flags().Changed("json") { + diags := createJson.Unmarshal(&createReq.Policy) + if diags.HasError() { + return diags.Error() + } + if len(diags) > 0 { + err := cmdio.RenderDiagnosticsToErrorOut(ctx, diags) + if err != nil { + return err + } + } + } + createReq.RecipientName = args[0] + + response, err := w.RecipientFederationPolicies.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, + *sharing.DeleteFederationPolicyRequest, +) + +func newDelete() *cobra.Command { + cmd := &cobra.Command{} + + var deleteReq sharing.DeleteFederationPolicyRequest + + // TODO: short flags + + cmd.Use = "delete RECIPIENT_NAME NAME" + cmd.Short = `Delete recipient federation policy.` + cmd.Long = `Delete recipient federation policy. + + Deletes an existing federation policy for an OIDC_FEDERATION recipient. The + caller must be the owner of the recipient. + + Arguments: + RECIPIENT_NAME: Name of the recipient. This is the name of the recipient for which the + policy is being deleted. + NAME: Name of the policy. This is the name of the policy to be deleted.` + + 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 := cmdctx.WorkspaceClient(ctx) + + deleteReq.RecipientName = args[0] + deleteReq.Name = args[1] + + err = w.RecipientFederationPolicies.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-federation-policy 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 getFederationPolicyOverrides []func( + *cobra.Command, + *sharing.GetFederationPolicyRequest, +) + +func newGetFederationPolicy() *cobra.Command { + cmd := &cobra.Command{} + + var getFederationPolicyReq sharing.GetFederationPolicyRequest + + // TODO: short flags + + cmd.Use = "get-federation-policy RECIPIENT_NAME NAME" + cmd.Short = `Get recipient federation policy.` + cmd.Long = `Get recipient federation policy. + + Reads an existing federation policy for an OIDC_FEDERATION recipient for + sharing data from Databricks to non-Databricks recipients. The caller must + have read access to the recipient. + + Arguments: + RECIPIENT_NAME: Name of the recipient. This is the name of the recipient for which the + policy is being retrieved. + NAME: Name of the policy. This is the name of the policy to be retrieved.` + + 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 := cmdctx.WorkspaceClient(ctx) + + getFederationPolicyReq.RecipientName = args[0] + getFederationPolicyReq.Name = args[1] + + response, err := w.RecipientFederationPolicies.GetFederationPolicy(ctx, getFederationPolicyReq) + 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 getFederationPolicyOverrides { + fn(cmd, &getFederationPolicyReq) + } + + 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, + *sharing.ListFederationPoliciesRequest, +) + +func newList() *cobra.Command { + cmd := &cobra.Command{} + + var listReq sharing.ListFederationPoliciesRequest + + // TODO: short flags + + cmd.Flags().IntVar(&listReq.MaxResults, "max-results", listReq.MaxResults, ``) + cmd.Flags().StringVar(&listReq.PageToken, "page-token", listReq.PageToken, ``) + + cmd.Use = "list RECIPIENT_NAME" + cmd.Short = `List recipient federation policies.` + cmd.Long = `List recipient federation policies. + + Lists federation policies for an OIDC_FEDERATION recipient for sharing data + from Databricks to non-Databricks recipients. The caller must have read access + to the recipient. + + Arguments: + RECIPIENT_NAME: Name of the recipient. This is the name of the recipient for which the + policies are being listed.` + + 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 := cmdctx.WorkspaceClient(ctx) + + listReq.RecipientName = args[0] + + response := w.RecipientFederationPolicies.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, + *sharing.UpdateFederationPolicyRequest, +) + +func newUpdate() *cobra.Command { + cmd := &cobra.Command{} + + var updateReq sharing.UpdateFederationPolicyRequest + updateReq.Policy = sharing.FederationPolicy{} + 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.Flags().StringVar(&updateReq.UpdateMask, "update-mask", updateReq.UpdateMask, `The field mask specifies which fields of the policy to update.`) + cmd.Flags().StringVar(&updateReq.Policy.Comment, "comment", updateReq.Policy.Comment, `Description of the policy.`) + cmd.Flags().StringVar(&updateReq.Policy.Name, "name", updateReq.Policy.Name, `Name of the federation policy.`) + // TODO: complex arg: oidc_policy + + cmd.Use = "update RECIPIENT_NAME NAME" + cmd.Short = `Update recipient federation policy.` + cmd.Long = `Update recipient federation policy. + + Updates an existing federation policy for an OIDC_RECIPIENT. The caller must + be the owner of the recipient. + + Arguments: + RECIPIENT_NAME: Name of the recipient. This is the name of the recipient for which the + policy is being updated. + NAME: Name of the policy. This is the name of the current name of the policy.` + + 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 := cmdctx.WorkspaceClient(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.RecipientName = args[0] + updateReq.Name = args[1] + + response, err := w.RecipientFederationPolicies.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 RecipientFederationPolicies diff --git a/cmd/workspace/schemas/schemas.go b/cmd/workspace/schemas/schemas.go index 0b0c563b02..bcd3273c66 100755 --- a/cmd/workspace/schemas/schemas.go +++ b/cmd/workspace/schemas/schemas.go @@ -368,7 +368,7 @@ func newUpdate() *cobra.Command { cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`) cmd.Flags().StringVar(&updateReq.Comment, "comment", updateReq.Comment, `User-provided free-form text description.`) - 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.EnablePredictiveOptimization, "enable-predictive-optimization", `. Supported values: [DISABLE, ENABLE, INHERIT]`) cmd.Flags().StringVar(&updateReq.NewName, "new-name", updateReq.NewName, `New name for the schema.`) cmd.Flags().StringVar(&updateReq.Owner, "owner", updateReq.Owner, `Username of current owner of schema.`) // TODO: map via StringToStringVar: properties diff --git a/cmd/workspace/shares/shares.go b/cmd/workspace/shares/shares.go index b777f2d626..a094b15858 100755 --- a/cmd/workspace/shares/shares.go +++ b/cmd/workspace/shares/shares.go @@ -486,6 +486,7 @@ func newUpdatePermissions() *cobra.Command { cmd.Flags().Var(&updatePermissionsJson, "json", `either inline JSON string or @path/to/file.json with request body`) // TODO: array: changes + cmd.Flags().BoolVar(&updatePermissionsReq.OmitPermissionsList, "omit-permissions-list", updatePermissionsReq.OmitPermissionsList, `Optional.`) cmd.Use = "update-permissions NAME" cmd.Short = `Update permissions.` diff --git a/experimental/python/databricks/bundles/compute/_models/cluster_spec.py b/experimental/python/databricks/bundles/compute/_models/cluster_spec.py index 5394c194ef..3b5187dcdb 100644 --- a/experimental/python/databricks/bundles/compute/_models/cluster_spec.py +++ b/experimental/python/databricks/bundles/compute/_models/cluster_spec.py @@ -103,6 +103,7 @@ class ClusterSpec: """ Cluster name requested by the user. This doesn't have to be unique. If not specified at creation, the cluster name will be an empty string. + For job clusters, the cluster name is automatically set based on the job and job run IDs. """ custom_tags: VariableOrDict[str] = field(default_factory=dict) @@ -305,6 +306,7 @@ class ClusterSpecDict(TypedDict, total=False): """ Cluster name requested by the user. This doesn't have to be unique. If not specified at creation, the cluster name will be an empty string. + For job clusters, the cluster name is automatically set based on the job and job run IDs. """ custom_tags: VariableOrDict[str] diff --git a/experimental/python/databricks/bundles/compute/_models/environment.py b/experimental/python/databricks/bundles/compute/_models/environment.py index 07d8d9bf07..16cc9d7140 100644 --- a/experimental/python/databricks/bundles/compute/_models/environment.py +++ b/experimental/python/databricks/bundles/compute/_models/environment.py @@ -17,7 +17,6 @@ class Environment: """ The environment entity used to preserve serverless environment side panel, jobs' environment for non-notebook task, and DLT's environment for classic and serverless pipelines. - (Note: DLT uses a copied version of the Environment proto below, at //spark/pipelines/api/protos/copied/libraries-environments-copy.proto) In this minimal environment spec, only pip dependencies are supported. """ diff --git a/experimental/python/databricks/bundles/pipelines/_models/pipeline.py b/experimental/python/databricks/bundles/pipelines/_models/pipeline.py index 99693c04df..8bf25fd1f1 100644 --- a/experimental/python/databricks/bundles/pipelines/_models/pipeline.py +++ b/experimental/python/databricks/bundles/pipelines/_models/pipeline.py @@ -153,6 +153,15 @@ class Pipeline(Resource): Restart window of this pipeline. """ + root_path: VariableOrOptional[str] = None + """ + :meta private: [EXPERIMENTAL] + + Root path for this pipeline. + This is used as the root directory when editing the pipeline in the Databricks user interface and it is + added to sys.path when executing Python sources during pipeline execution. + """ + run_as: VariableOrOptional[RunAs] = None """ :meta private: [EXPERIMENTAL] @@ -287,6 +296,15 @@ class PipelineDict(TypedDict, total=False): Restart window of this pipeline. """ + root_path: VariableOrOptional[str] + """ + :meta private: [EXPERIMENTAL] + + Root path for this pipeline. + This is used as the root directory when editing the pipeline in the Databricks user interface and it is + added to sys.path when executing Python sources during pipeline execution. + """ + run_as: VariableOrOptional[RunAsParam] """ :meta private: [EXPERIMENTAL] diff --git a/go.mod b/go.mod index f94612005c..9e27c17fc4 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/BurntSushi/toml v1.5.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.69.0 // Apache 2.0 + github.com/databricks/databricks-sdk-go v0.70.0 // Apache 2.0 github.com/fatih/color v1.18.0 // MIT github.com/google/uuid v1.6.0 // BSD-3-Clause github.com/gorilla/mux v1.8.1 // BSD 3-Clause diff --git a/go.sum b/go.sum index d6c9b49945..e6120f2af9 100644 --- a/go.sum +++ b/go.sum @@ -36,8 +36,8 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s= github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI= -github.com/databricks/databricks-sdk-go v0.69.0 h1:W3R+sP9O/dIys3Q4ZnY02DO93h5Urujv811PJYA1CEQ= -github.com/databricks/databricks-sdk-go v0.69.0/go.mod h1:xBtjeP9nq+6MgTewZW1EcbRkD7aDY9gZvcRPcwPhZjw= +github.com/databricks/databricks-sdk-go v0.70.0 h1:KeMZfUIGyBDge3HQz7LKLr9YEZnDNpnKcjoPmYQYkEk= +github.com/databricks/databricks-sdk-go v0.70.0/go.mod h1:xBtjeP9nq+6MgTewZW1EcbRkD7aDY9gZvcRPcwPhZjw= 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=