diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index 8af35ea492..b75b936f13 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -b95c2c6e21bec9551ec7d7d51ddf2dfe390b4522 \ No newline at end of file +8182e896c6797f3724042b048d466a78052b59d9 \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index ef9e69f122..31d59709a0 100755 --- a/.gitattributes +++ b/.gitattributes @@ -12,6 +12,7 @@ cmd/account/encryption-keys/encryption-keys.go linguist-generated=true cmd/account/esm-enablement-account/esm-enablement-account.go linguist-generated=true cmd/account/federation-policy/federation-policy.go linguist-generated=true cmd/account/groups/groups.go linguist-generated=true +cmd/account/iam-v2/iam-v2.go linguist-generated=true cmd/account/ip-access-lists/ip-access-lists.go linguist-generated=true cmd/account/llm-proxy-partner-powered-account/llm-proxy-partner-powered-account.go linguist-generated=true cmd/account/llm-proxy-partner-powered-enforce/llm-proxy-partner-powered-enforce.go linguist-generated=true @@ -163,5 +164,6 @@ cmd/workspace/volumes/volumes.go linguist-generated=true cmd/workspace/warehouses/warehouses.go linguist-generated=true cmd/workspace/workspace-bindings/workspace-bindings.go linguist-generated=true cmd/workspace/workspace-conf/workspace-conf.go linguist-generated=true +cmd/workspace/workspace-iam-v2/workspace-iam-v2.go linguist-generated=true cmd/workspace/workspace-settings-v2/workspace-settings-v2.go linguist-generated=true cmd/workspace/workspace/workspace.go linguist-generated=true diff --git a/bundle/internal/schema/annotations_openapi.yml b/bundle/internal/schema/annotations_openapi.yml index f03f7cc1de..1961217df7 100644 --- a/bundle/internal/schema/annotations_openapi.yml +++ b/bundle/internal/schema/annotations_openapi.yml @@ -595,8 +595,6 @@ github.com/databricks/cli/bundle/config/resources.Pipeline: 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. Only `user_name` or `service_principal_name` can be specified. If both are specified, an error is thrown. - "x-databricks-preview": |- - PRIVATE "schema": "description": |- The default schema (database) where tables are read from or published to. @@ -3119,6 +3117,11 @@ github.com/databricks/databricks-sdk-go/service/jobs.Task: "disable_auto_optimization": "description": |- An option to disable auto optimization in serverless + "disabled": + "description": |- + An optional flag to disable the task. If set to true, the task will not run even if it is part of a job. + "x-databricks-preview": |- + PRIVATE "email_notifications": "description": |- An optional set of email addresses that is notified when runs of this task begin or complete as well as when this task is deleted. The default behavior is to not send any emails. @@ -3517,6 +3520,8 @@ github.com/databricks/databricks-sdk-go/service/pipelines.IngestionSourceType: CONFLUENCE - |- META_MARKETING + - |- + FOREIGN_CATALOG github.com/databricks/databricks-sdk-go/service/pipelines.ManualTrigger: {} github.com/databricks/databricks-sdk-go/service/pipelines.NotebookLibrary: "path": diff --git a/bundle/internal/schema/annotations_openapi_overrides.yml b/bundle/internal/schema/annotations_openapi_overrides.yml index 35593f2e7f..37aabd61d2 100644 --- a/bundle/internal/schema/annotations_openapi_overrides.yml +++ b/bundle/internal/schema/annotations_openapi_overrides.yml @@ -591,6 +591,10 @@ github.com/databricks/cli/bundle/config/resources.SqlWarehousePermissionLevel: CAN_MONITOR - |- CAN_VIEW +github.com/databricks/cli/bundle/config/resources.SyncedDatabaseTable: + "lifecycle": + "description": |- + PLACEHOLDER github.com/databricks/cli/bundle/config/resources.Volume: "_": "markdown_description": |- diff --git a/bundle/internal/validation/generated/enum_fields.go b/bundle/internal/validation/generated/enum_fields.go index 11b93c00ca..2f24e03a4c 100644 --- a/bundle/internal/validation/generated/enum_fields.go +++ b/bundle/internal/validation/generated/enum_fields.go @@ -119,7 +119,7 @@ var EnumFields = map[string][]string{ "resources.pipelines.*.ingestion_definition.objects[*].report.table_configuration.scd_type": {"APPEND_ONLY", "SCD_TYPE_1", "SCD_TYPE_2"}, "resources.pipelines.*.ingestion_definition.objects[*].schema.table_configuration.scd_type": {"APPEND_ONLY", "SCD_TYPE_1", "SCD_TYPE_2"}, "resources.pipelines.*.ingestion_definition.objects[*].table.table_configuration.scd_type": {"APPEND_ONLY", "SCD_TYPE_1", "SCD_TYPE_2"}, - "resources.pipelines.*.ingestion_definition.source_type": {"BIGQUERY", "CONFLUENCE", "DYNAMICS365", "GA4_RAW_DATA", "MANAGED_POSTGRESQL", "META_MARKETING", "MYSQL", "NETSUITE", "ORACLE", "POSTGRESQL", "REDSHIFT", "SALESFORCE", "SERVICENOW", "SHAREPOINT", "SQLDW", "SQLSERVER", "TERADATA", "WORKDAY_RAAS"}, + "resources.pipelines.*.ingestion_definition.source_type": {"BIGQUERY", "CONFLUENCE", "DYNAMICS365", "FOREIGN_CATALOG", "GA4_RAW_DATA", "MANAGED_POSTGRESQL", "META_MARKETING", "MYSQL", "NETSUITE", "ORACLE", "POSTGRESQL", "REDSHIFT", "SALESFORCE", "SERVICENOW", "SHAREPOINT", "SQLDW", "SQLSERVER", "TERADATA", "WORKDAY_RAAS"}, "resources.pipelines.*.ingestion_definition.table_configuration.scd_type": {"APPEND_ONLY", "SCD_TYPE_1", "SCD_TYPE_2"}, "resources.pipelines.*.restart_window.days_of_week[*]": {"FRIDAY", "MONDAY", "SATURDAY", "SUNDAY", "THURSDAY", "TUESDAY", "WEDNESDAY"}, diff --git a/bundle/internal/validation/generated/required_fields.go b/bundle/internal/validation/generated/required_fields.go index 621ed53aeb..191b347d97 100644 --- a/bundle/internal/validation/generated/required_fields.go +++ b/bundle/internal/validation/generated/required_fields.go @@ -15,7 +15,7 @@ var RequiredFields = map[string][]string{ "permissions[*]": {"level"}, - "resources.apps.*": {"source_code_path", "name"}, + "resources.apps.*": {"name", "source_code_path"}, "resources.apps.*.permissions[*]": {"level"}, "resources.apps.*.resources[*]": {"name"}, "resources.apps.*.resources[*].database": {"database_name", "instance_name", "permission"}, @@ -190,7 +190,7 @@ var RequiredFields = map[string][]string{ "resources.pipelines.*.permissions[*]": {"level"}, "resources.pipelines.*.restart_window": {"start_hour"}, - "resources.quality_monitors.*": {"table_name", "assets_dir", "output_schema_name"}, + "resources.quality_monitors.*": {"assets_dir", "output_schema_name", "table_name"}, "resources.quality_monitors.*.custom_metrics[*]": {"definition", "input_columns", "name", "output_data_type", "type"}, "resources.quality_monitors.*.inference_log": {"granularities", "model_id_col", "prediction_col", "problem_type", "timestamp_col"}, "resources.quality_monitors.*.schedule": {"quartz_cron_expression", "timezone_id"}, diff --git a/bundle/schema/jsonschema.json b/bundle/schema/jsonschema.json index 4a5200be0c..eccb87de9b 100644 --- a/bundle/schema/jsonschema.json +++ b/bundle/schema/jsonschema.json @@ -1339,9 +1339,7 @@ "$ref": "#/$defs/string" }, "run_as": { - "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/pipelines.RunAs", - "x-databricks-preview": "PRIVATE", - "doNotSuggest": true + "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/pipelines.RunAs" }, "schema": { "description": "The default schema (database) where tables are read from or published to.", @@ -6531,6 +6529,12 @@ "description": "An option to disable auto optimization in serverless", "$ref": "#/$defs/bool" }, + "disabled": { + "description": "An optional flag to disable the task. If set to true, the task will not run even if it is part of a job.", + "$ref": "#/$defs/bool", + "x-databricks-preview": "PRIVATE", + "doNotSuggest": true + }, "email_notifications": { "description": "An optional set of email addresses that is notified when runs of this task begin or complete as well as when this task is deleted. The default behavior is to not send any emails.", "$ref": "#/$defs/github.com/databricks/databricks-sdk-go/service/jobs.TaskEmailNotifications" @@ -7178,7 +7182,8 @@ "SHAREPOINT", "DYNAMICS365", "CONFLUENCE", - "META_MARKETING" + "META_MARKETING", + "FOREIGN_CATALOG" ] }, { diff --git a/cmd/account/cmd.go b/cmd/account/cmd.go index bdbab94761..d9c3b5b7ee 100644 --- a/cmd/account/cmd.go +++ b/cmd/account/cmd.go @@ -3,7 +3,6 @@ package account import ( - "github.com/databricks/cli/libs/cmdgroup" "github.com/spf13/cobra" account_access_control "github.com/databricks/cli/cmd/account/access-control" @@ -15,6 +14,7 @@ import ( encryption_keys "github.com/databricks/cli/cmd/account/encryption-keys" account_federation_policy "github.com/databricks/cli/cmd/account/federation-policy" account_groups "github.com/databricks/cli/cmd/account/groups" + account_iam_v2 "github.com/databricks/cli/cmd/account/iam-v2" account_ip_access_lists "github.com/databricks/cli/cmd/account/ip-access-lists" log_delivery "github.com/databricks/cli/cmd/account/log-delivery" account_metastore_assignments "github.com/databricks/cli/cmd/account/metastore-assignments" @@ -77,6 +77,7 @@ func New() *cobra.Command { cmd.AddCommand(workspace_assignment.New()) cmd.AddCommand(workspace_network_configuration.New()) cmd.AddCommand(workspaces.New()) + cmd.AddCommand(account_iam_v2.New()) cmd.AddCommand(budgets.New()) // Add account command groups, filtering out empty groups or groups with only hidden commands. diff --git a/cmd/account/groups/groups.go b/cmd/account/groups/groups.go index e446bb04cb..f11bab8733 100755 --- a/cmd/account/groups/groups.go +++ b/cmd/account/groups/groups.go @@ -70,7 +70,7 @@ func newCreate() *cobra.Command { cmd.Flags().StringVar(&createReq.DisplayName, "display-name", createReq.DisplayName, `String that represents a human-readable group name.`) // TODO: array: entitlements - cmd.Flags().StringVar(&createReq.ExternalId, "external-id", createReq.ExternalId, ``) + cmd.Flags().StringVar(&createReq.ExternalId, "external-id", createReq.ExternalId, `external_id should be unique for identifying groups.`) // TODO: array: groups cmd.Flags().StringVar(&createReq.Id, "id", createReq.Id, `Databricks group ID.`) // TODO: array: members @@ -428,7 +428,7 @@ func newUpdate() *cobra.Command { cmd.Flags().StringVar(&updateReq.DisplayName, "display-name", updateReq.DisplayName, `String that represents a human-readable group name.`) // TODO: array: entitlements - cmd.Flags().StringVar(&updateReq.ExternalId, "external-id", updateReq.ExternalId, ``) + cmd.Flags().StringVar(&updateReq.ExternalId, "external-id", updateReq.ExternalId, `external_id should be unique for identifying groups.`) // TODO: array: groups cmd.Flags().StringVar(&updateReq.Id, "id", updateReq.Id, `Databricks group ID.`) // TODO: array: members diff --git a/cmd/account/iam-v2/iam-v2.go b/cmd/account/iam-v2/iam-v2.go new file mode 100755 index 0000000000..528f8efcc9 --- /dev/null +++ b/cmd/account/iam-v2/iam-v2.go @@ -0,0 +1,367 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package iam_v2 + +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/iamv2" + "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: "iam-v2", + Short: `These APIs are used to manage identities and the workspace access of these identities in .`, + Long: `These APIs are used to manage identities and the workspace access of these + identities in .`, + GroupID: "iamv2", + Annotations: map[string]string{ + "package": "iamv2", + }, + RunE: root.ReportUnknownSubcommand, + } + + // Add methods + cmd.AddCommand(newGetWorkspaceAccessDetail()) + cmd.AddCommand(newResolveGroup()) + cmd.AddCommand(newResolveServicePrincipal()) + cmd.AddCommand(newResolveUser()) + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start get-workspace-access-detail 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 getWorkspaceAccessDetailOverrides []func( + *cobra.Command, + *iamv2.GetWorkspaceAccessDetailRequest, +) + +func newGetWorkspaceAccessDetail() *cobra.Command { + cmd := &cobra.Command{} + + var getWorkspaceAccessDetailReq iamv2.GetWorkspaceAccessDetailRequest + + cmd.Flags().Var(&getWorkspaceAccessDetailReq.View, "view", `Controls what fields are returned. Supported values: [BASIC, FULL]`) + + cmd.Use = "get-workspace-access-detail WORKSPACE_ID PRINCIPAL_ID" + cmd.Short = `Get workspace access details for a principal.` + cmd.Long = `Get workspace access details for a principal. + + Returns the access details for a principal in a workspace. Allows for checking + access details for any provisioned principal (user, service principal, or + group) in a workspace. * Provisioned principal here refers to one that has + been synced into Databricks from the customer's IdP or added explicitly to + Databricks via SCIM/UI. Allows for passing in a "view" parameter to control + what fields are returned (BASIC by default or FULL). + + Arguments: + WORKSPACE_ID: Required. The workspace ID for which the access details are being + requested. + PRINCIPAL_ID: Required. The internal ID of the principal (user/sp/group) for which the + access details are being requested.` + + 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.MustAccountClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + a := cmdctx.AccountClient(ctx) + + _, err = fmt.Sscan(args[0], &getWorkspaceAccessDetailReq.WorkspaceId) + if err != nil { + return fmt.Errorf("invalid WORKSPACE_ID: %s", args[0]) + } + _, err = fmt.Sscan(args[1], &getWorkspaceAccessDetailReq.PrincipalId) + if err != nil { + return fmt.Errorf("invalid PRINCIPAL_ID: %s", args[1]) + } + + response, err := a.IamV2.GetWorkspaceAccessDetail(ctx, getWorkspaceAccessDetailReq) + 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 getWorkspaceAccessDetailOverrides { + fn(cmd, &getWorkspaceAccessDetailReq) + } + + return cmd +} + +// start resolve-group 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 resolveGroupOverrides []func( + *cobra.Command, + *iamv2.ResolveGroupRequest, +) + +func newResolveGroup() *cobra.Command { + cmd := &cobra.Command{} + + var resolveGroupReq iamv2.ResolveGroupRequest + var resolveGroupJson flags.JsonFlag + + cmd.Flags().Var(&resolveGroupJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "resolve-group EXTERNAL_ID" + cmd.Short = `Resolve an external group in the Databricks account.` + cmd.Long = `Resolve an external group in the Databricks account. + + Resolves a group with the given external ID from the customer's IdP. If the + group does not exist, it will be created in the account. If the customer is + not onboarded onto Automatic Identity Management (AIM), this will return an + error. + + Arguments: + EXTERNAL_ID: Required. The external ID of the group in the customer's IdP.` + + 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 'external_id' in your JSON input") + } + return nil + } + check := root.ExactArgs(1) + return check(cmd, args) + } + + cmd.PreRunE = root.MustAccountClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + a := cmdctx.AccountClient(ctx) + + if cmd.Flags().Changed("json") { + diags := resolveGroupJson.Unmarshal(&resolveGroupReq) + 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") { + resolveGroupReq.ExternalId = args[0] + } + + response, err := a.IamV2.ResolveGroup(ctx, resolveGroupReq) + 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 resolveGroupOverrides { + fn(cmd, &resolveGroupReq) + } + + return cmd +} + +// start resolve-service-principal 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 resolveServicePrincipalOverrides []func( + *cobra.Command, + *iamv2.ResolveServicePrincipalRequest, +) + +func newResolveServicePrincipal() *cobra.Command { + cmd := &cobra.Command{} + + var resolveServicePrincipalReq iamv2.ResolveServicePrincipalRequest + var resolveServicePrincipalJson flags.JsonFlag + + cmd.Flags().Var(&resolveServicePrincipalJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "resolve-service-principal EXTERNAL_ID" + cmd.Short = `Resolve an external service principal in the Databricks account.` + cmd.Long = `Resolve an external service principal in the Databricks account. + + Resolves an SP with the given external ID from the customer's IdP. If the SP + does not exist, it will be created. If the customer is not onboarded onto + Automatic Identity Management (AIM), this will return an error. + + Arguments: + EXTERNAL_ID: Required. The external ID of the service principal in the customer's IdP.` + + 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 'external_id' in your JSON input") + } + return nil + } + check := root.ExactArgs(1) + return check(cmd, args) + } + + cmd.PreRunE = root.MustAccountClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + a := cmdctx.AccountClient(ctx) + + if cmd.Flags().Changed("json") { + diags := resolveServicePrincipalJson.Unmarshal(&resolveServicePrincipalReq) + 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") { + resolveServicePrincipalReq.ExternalId = args[0] + } + + response, err := a.IamV2.ResolveServicePrincipal(ctx, resolveServicePrincipalReq) + 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 resolveServicePrincipalOverrides { + fn(cmd, &resolveServicePrincipalReq) + } + + return cmd +} + +// start resolve-user 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 resolveUserOverrides []func( + *cobra.Command, + *iamv2.ResolveUserRequest, +) + +func newResolveUser() *cobra.Command { + cmd := &cobra.Command{} + + var resolveUserReq iamv2.ResolveUserRequest + var resolveUserJson flags.JsonFlag + + cmd.Flags().Var(&resolveUserJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "resolve-user EXTERNAL_ID" + cmd.Short = `Resolve an external user in the Databricks account.` + cmd.Long = `Resolve an external user in the Databricks account. + + Resolves a user with the given external ID from the customer's IdP. If the + user does not exist, it will be created. If the customer is not onboarded onto + Automatic Identity Management (AIM), this will return an error. + + Arguments: + EXTERNAL_ID: Required. The external ID of the user in the customer's IdP.` + + 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 'external_id' in your JSON input") + } + return nil + } + check := root.ExactArgs(1) + return check(cmd, args) + } + + cmd.PreRunE = root.MustAccountClient + cmd.RunE = func(cmd *cobra.Command, args []string) (err error) { + ctx := cmd.Context() + a := cmdctx.AccountClient(ctx) + + if cmd.Flags().Changed("json") { + diags := resolveUserJson.Unmarshal(&resolveUserReq) + 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") { + resolveUserReq.ExternalId = args[0] + } + + response, err := a.IamV2.ResolveUser(ctx, resolveUserReq) + 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 resolveUserOverrides { + fn(cmd, &resolveUserReq) + } + + return cmd +} + +// end service account_iamV2 diff --git a/cmd/workspace/alerts-v2/alerts-v2.go b/cmd/workspace/alerts-v2/alerts-v2.go index 87a0d0f70c..a02196ff0e 100755 --- a/cmd/workspace/alerts-v2/alerts-v2.go +++ b/cmd/workspace/alerts-v2/alerts-v2.go @@ -255,8 +255,8 @@ func newTrashAlert() *cobra.Command { var trashAlertReq sql.TrashAlertV2Request cmd.Use = "trash-alert ID" - cmd.Short = `Delete an alert.` - cmd.Long = `Delete an alert. + cmd.Short = `Delete an alert (legacy TrashAlert).` + cmd.Long = `Delete an alert (legacy TrashAlert). Moves an alert to the trash. Trashed alerts immediately disappear from list views, and can no longer trigger. You can restore a trashed alert through the diff --git a/cmd/workspace/cmd.go b/cmd/workspace/cmd.go index 5cbc87dccc..cf7a5eee47 100755 --- a/cmd/workspace/cmd.go +++ b/cmd/workspace/cmd.go @@ -112,6 +112,7 @@ import ( workspace "github.com/databricks/cli/cmd/workspace/workspace" workspace_bindings "github.com/databricks/cli/cmd/workspace/workspace-bindings" workspace_conf "github.com/databricks/cli/cmd/workspace/workspace-conf" + workspace_iam_v2 "github.com/databricks/cli/cmd/workspace/workspace-iam-v2" workspace_settings_v2 "github.com/databricks/cli/cmd/workspace/workspace-settings-v2" "github.com/spf13/cobra" ) @@ -229,6 +230,7 @@ func All() []*cobra.Command { out = append(out, workspace_conf.New()) out = append(out, workspace_settings_v2.New()) out = append(out, forecasting.New()) + out = append(out, workspace_iam_v2.New()) return out } diff --git a/cmd/workspace/genie/genie.go b/cmd/workspace/genie/genie.go index 5a0a5f046c..84a3ca403e 100755 --- a/cmd/workspace/genie/genie.go +++ b/cmd/workspace/genie/genie.go @@ -248,9 +248,6 @@ func newDeleteConversationMessage() *cobra.Command { CONVERSATION_ID: The ID associated with the conversation. MESSAGE_ID: The ID associated with the message 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 { @@ -752,9 +749,6 @@ func newListConversationMessages() *cobra.Command { SPACE_ID: The ID associated with the Genie space where the conversation is located CONVERSATION_ID: The ID of the conversation to list messages from` - // 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 { diff --git a/cmd/workspace/groups/groups.go b/cmd/workspace/groups/groups.go index c792c35a29..37e1720187 100755 --- a/cmd/workspace/groups/groups.go +++ b/cmd/workspace/groups/groups.go @@ -70,7 +70,7 @@ func newCreate() *cobra.Command { cmd.Flags().StringVar(&createReq.DisplayName, "display-name", createReq.DisplayName, `String that represents a human-readable group name.`) // TODO: array: entitlements - cmd.Flags().StringVar(&createReq.ExternalId, "external-id", createReq.ExternalId, ``) + cmd.Flags().StringVar(&createReq.ExternalId, "external-id", createReq.ExternalId, `external_id should be unique for identifying groups.`) // TODO: array: groups cmd.Flags().StringVar(&createReq.Id, "id", createReq.Id, `Databricks group ID.`) // TODO: array: members @@ -426,7 +426,7 @@ func newUpdate() *cobra.Command { cmd.Flags().StringVar(&updateReq.DisplayName, "display-name", updateReq.DisplayName, `String that represents a human-readable group name.`) // TODO: array: entitlements - cmd.Flags().StringVar(&updateReq.ExternalId, "external-id", updateReq.ExternalId, ``) + cmd.Flags().StringVar(&updateReq.ExternalId, "external-id", updateReq.ExternalId, `external_id should be unique for identifying groups.`) // TODO: array: groups cmd.Flags().StringVar(&updateReq.Id, "id", updateReq.Id, `Databricks group ID.`) // TODO: array: members diff --git a/cmd/workspace/tag-policies/tag-policies.go b/cmd/workspace/tag-policies/tag-policies.go index a54125fa92..078514e48c 100755 --- a/cmd/workspace/tag-policies/tag-policies.go +++ b/cmd/workspace/tag-policies/tag-policies.go @@ -19,9 +19,10 @@ var cmdOverrides []func(*cobra.Command) func New() *cobra.Command { cmd := &cobra.Command{ - Use: "tag-policies", - Short: `The Tag Policy API allows you to manage tag policies in Databricks.`, - Long: `The Tag Policy API allows you to manage tag policies in Databricks.`, + Use: "tag-policies", + Short: `The Tag Policy API allows you to manage policies for governed tags in Databricks.`, + Long: `The Tag Policy API allows you to manage policies for governed tags in + Databricks.`, GroupID: "tags", Annotations: map[string]string{ "package": "tags", @@ -69,7 +70,7 @@ func newCreateTagPolicy() *cobra.Command { cmd.Short = `Create a new tag policy.` cmd.Long = `Create a new tag policy. - Creates a new tag policy.` + Creates a new tag policy, making the associated tag key governed.` cmd.Annotations = make(map[string]string) @@ -143,7 +144,8 @@ func newDeleteTagPolicy() *cobra.Command { cmd.Short = `Delete a tag policy.` cmd.Long = `Delete a tag policy. - Deletes a tag policy by its key.` + Deletes a tag policy by its associated governed tag's key, leaving that tag + key ungoverned.` cmd.Annotations = make(map[string]string) @@ -196,7 +198,7 @@ func newGetTagPolicy() *cobra.Command { cmd.Short = `Get a tag policy.` cmd.Long = `Get a tag policy. - Gets a single tag policy by its key.` + Gets a single tag policy by its associated governed tag's key.` cmd.Annotations = make(map[string]string) @@ -252,7 +254,7 @@ func newListTagPolicies() *cobra.Command { cmd.Short = `List tag policies.` cmd.Long = `List tag policies. - Lists all tag policies in the account.` + Lists the tag policies for all governed tags in the account.` cmd.Annotations = make(map[string]string) @@ -307,7 +309,7 @@ func newUpdateTagPolicy() *cobra.Command { cmd.Short = `Update an existing tag policy.` cmd.Long = `Update an existing tag policy. - Updates an existing tag policy. + Updates an existing tag policy for a single governed tag. Arguments: TAG_KEY: diff --git a/cmd/workspace/workspace-iam-v2/workspace-iam-v2.go b/cmd/workspace/workspace-iam-v2/workspace-iam-v2.go new file mode 100755 index 0000000000..bfa75ba936 --- /dev/null +++ b/cmd/workspace/workspace-iam-v2/workspace-iam-v2.go @@ -0,0 +1,361 @@ +// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT. + +package workspace_iam_v2 + +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/iamv2" + "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-iam-v2", + Short: `These APIs are used to manage identities and the workspace access of these identities in .`, + Long: `These APIs are used to manage identities and the workspace access of these + identities in .`, + GroupID: "iamv2", + Annotations: map[string]string{ + "package": "iamv2", + }, + RunE: root.ReportUnknownSubcommand, + } + + // Add methods + cmd.AddCommand(newGetWorkspaceAccessDetailLocal()) + cmd.AddCommand(newResolveGroupProxy()) + cmd.AddCommand(newResolveServicePrincipalProxy()) + cmd.AddCommand(newResolveUserProxy()) + + // Apply optional overrides to this command. + for _, fn := range cmdOverrides { + fn(cmd) + } + + return cmd +} + +// start get-workspace-access-detail-local 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 getWorkspaceAccessDetailLocalOverrides []func( + *cobra.Command, + *iamv2.GetWorkspaceAccessDetailLocalRequest, +) + +func newGetWorkspaceAccessDetailLocal() *cobra.Command { + cmd := &cobra.Command{} + + var getWorkspaceAccessDetailLocalReq iamv2.GetWorkspaceAccessDetailLocalRequest + + cmd.Flags().Var(&getWorkspaceAccessDetailLocalReq.View, "view", `Controls what fields are returned. Supported values: [BASIC, FULL]`) + + cmd.Use = "get-workspace-access-detail-local PRINCIPAL_ID" + cmd.Short = `Get workspace access details for a principal.` + cmd.Long = `Get workspace access details for a principal. + + Returns the access details for a principal in the current workspace. Allows + for checking access details for any provisioned principal (user, service + principal, or group) in the current workspace. * Provisioned principal here + refers to one that has been synced into Databricks from the customer's IdP or + added explicitly to Databricks via SCIM/UI. Allows for passing in a "view" + parameter to control what fields are returned (BASIC by default or FULL). + + Arguments: + PRINCIPAL_ID: Required. The internal ID of the principal (user/sp/group) for which the + access details are being requested.` + + 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) + + _, err = fmt.Sscan(args[0], &getWorkspaceAccessDetailLocalReq.PrincipalId) + if err != nil { + return fmt.Errorf("invalid PRINCIPAL_ID: %s", args[0]) + } + + response, err := w.WorkspaceIamV2.GetWorkspaceAccessDetailLocal(ctx, getWorkspaceAccessDetailLocalReq) + 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 getWorkspaceAccessDetailLocalOverrides { + fn(cmd, &getWorkspaceAccessDetailLocalReq) + } + + return cmd +} + +// start resolve-group-proxy 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 resolveGroupProxyOverrides []func( + *cobra.Command, + *iamv2.ResolveGroupProxyRequest, +) + +func newResolveGroupProxy() *cobra.Command { + cmd := &cobra.Command{} + + var resolveGroupProxyReq iamv2.ResolveGroupProxyRequest + var resolveGroupProxyJson flags.JsonFlag + + cmd.Flags().Var(&resolveGroupProxyJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "resolve-group-proxy EXTERNAL_ID" + cmd.Short = `Resolve an external group in the Databricks account.` + cmd.Long = `Resolve an external group in the Databricks account. + + Resolves a group with the given external ID from the customer's IdP. If the + group does not exist, it will be created in the account. If the customer is + not onboarded onto Automatic Identity Management (AIM), this will return an + error. + + Arguments: + EXTERNAL_ID: Required. The external ID of the group in the customer's IdP.` + + 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 'external_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 := resolveGroupProxyJson.Unmarshal(&resolveGroupProxyReq) + 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") { + resolveGroupProxyReq.ExternalId = args[0] + } + + response, err := w.WorkspaceIamV2.ResolveGroupProxy(ctx, resolveGroupProxyReq) + 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 resolveGroupProxyOverrides { + fn(cmd, &resolveGroupProxyReq) + } + + return cmd +} + +// start resolve-service-principal-proxy 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 resolveServicePrincipalProxyOverrides []func( + *cobra.Command, + *iamv2.ResolveServicePrincipalProxyRequest, +) + +func newResolveServicePrincipalProxy() *cobra.Command { + cmd := &cobra.Command{} + + var resolveServicePrincipalProxyReq iamv2.ResolveServicePrincipalProxyRequest + var resolveServicePrincipalProxyJson flags.JsonFlag + + cmd.Flags().Var(&resolveServicePrincipalProxyJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "resolve-service-principal-proxy EXTERNAL_ID" + cmd.Short = `Resolve an external service principal in the Databricks account.` + cmd.Long = `Resolve an external service principal in the Databricks account. + + Resolves an SP with the given external ID from the customer's IdP. If the SP + does not exist, it will be created. If the customer is not onboarded onto + Automatic Identity Management (AIM), this will return an error. + + Arguments: + EXTERNAL_ID: Required. The external ID of the service principal in the customer's IdP.` + + 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 'external_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 := resolveServicePrincipalProxyJson.Unmarshal(&resolveServicePrincipalProxyReq) + 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") { + resolveServicePrincipalProxyReq.ExternalId = args[0] + } + + response, err := w.WorkspaceIamV2.ResolveServicePrincipalProxy(ctx, resolveServicePrincipalProxyReq) + 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 resolveServicePrincipalProxyOverrides { + fn(cmd, &resolveServicePrincipalProxyReq) + } + + return cmd +} + +// start resolve-user-proxy 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 resolveUserProxyOverrides []func( + *cobra.Command, + *iamv2.ResolveUserProxyRequest, +) + +func newResolveUserProxy() *cobra.Command { + cmd := &cobra.Command{} + + var resolveUserProxyReq iamv2.ResolveUserProxyRequest + var resolveUserProxyJson flags.JsonFlag + + cmd.Flags().Var(&resolveUserProxyJson, "json", `either inline JSON string or @path/to/file.json with request body`) + + cmd.Use = "resolve-user-proxy EXTERNAL_ID" + cmd.Short = `Resolve an external user in the Databricks account.` + cmd.Long = `Resolve an external user in the Databricks account. + + Resolves a user with the given external ID from the customer's IdP. If the + user does not exist, it will be created. If the customer is not onboarded onto + Automatic Identity Management (AIM), this will return an error. + + Arguments: + EXTERNAL_ID: Required. The external ID of the user in the customer's IdP.` + + 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 'external_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 := resolveUserProxyJson.Unmarshal(&resolveUserProxyReq) + 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") { + resolveUserProxyReq.ExternalId = args[0] + } + + response, err := w.WorkspaceIamV2.ResolveUserProxy(ctx, resolveUserProxyReq) + 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 resolveUserProxyOverrides { + fn(cmd, &resolveUserProxyReq) + } + + return cmd +} + +// end service workspace_iamV2 diff --git a/experimental/python/databricks/bundles/jobs/_models/task.py b/experimental/python/databricks/bundles/jobs/_models/task.py index 2498c0db08..be497ff0f2 100644 --- a/experimental/python/databricks/bundles/jobs/_models/task.py +++ b/experimental/python/databricks/bundles/jobs/_models/task.py @@ -145,6 +145,13 @@ class Task: An option to disable auto optimization in serverless """ + disabled: VariableOrOptional[bool] = None + """ + :meta private: [EXPERIMENTAL] + + An optional flag to disable the task. If set to true, the task will not run even if it is part of a job. + """ + email_notifications: VariableOrOptional[TaskEmailNotifications] = None """ An optional set of email addresses that is notified when runs of this task begin or complete as well as when this task is deleted. The default behavior is to not send any emails. @@ -348,6 +355,13 @@ class TaskDict(TypedDict, total=False): An option to disable auto optimization in serverless """ + disabled: VariableOrOptional[bool] + """ + :meta private: [EXPERIMENTAL] + + An optional flag to disable the task. If set to true, the task will not run even if it is part of a job. + """ + email_notifications: VariableOrOptional[TaskEmailNotificationsParam] """ An optional set of email addresses that is notified when runs of this task begin or complete as well as when this task is deleted. The default behavior is to not send any emails. diff --git a/experimental/python/databricks/bundles/pipelines/_models/ingestion_source_type.py b/experimental/python/databricks/bundles/pipelines/_models/ingestion_source_type.py index cb8ceca59e..d9a90a022e 100644 --- a/experimental/python/databricks/bundles/pipelines/_models/ingestion_source_type.py +++ b/experimental/python/databricks/bundles/pipelines/_models/ingestion_source_type.py @@ -21,6 +21,7 @@ class IngestionSourceType(Enum): DYNAMICS365 = "DYNAMICS365" CONFLUENCE = "CONFLUENCE" META_MARKETING = "META_MARKETING" + FOREIGN_CATALOG = "FOREIGN_CATALOG" IngestionSourceTypeParam = ( @@ -43,6 +44,7 @@ class IngestionSourceType(Enum): "DYNAMICS365", "CONFLUENCE", "META_MARKETING", + "FOREIGN_CATALOG", ] | IngestionSourceType ) diff --git a/experimental/python/databricks/bundles/pipelines/_models/pipeline.py b/experimental/python/databricks/bundles/pipelines/_models/pipeline.py index 919238e743..0e698a64b8 100644 --- a/experimental/python/databricks/bundles/pipelines/_models/pipeline.py +++ b/experimental/python/databricks/bundles/pipelines/_models/pipeline.py @@ -184,9 +184,6 @@ class Pipeline(Resource): """ run_as: VariableOrOptional[RunAs] = None - """ - :meta private: [EXPERIMENTAL] - """ schema: VariableOrOptional[str] = None """ @@ -347,9 +344,6 @@ class PipelineDict(TypedDict, total=False): """ run_as: VariableOrOptional[RunAsParam] - """ - :meta private: [EXPERIMENTAL] - """ schema: VariableOrOptional[str] """ diff --git a/experimental/python/databricks/bundles/pipelines/_models/run_as.py b/experimental/python/databricks/bundles/pipelines/_models/run_as.py index dadceecac7..b4d52af00a 100644 --- a/experimental/python/databricks/bundles/pipelines/_models/run_as.py +++ b/experimental/python/databricks/bundles/pipelines/_models/run_as.py @@ -12,8 +12,6 @@ @dataclass(kw_only=True) class RunAs: """ - :meta private: [EXPERIMENTAL] - 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. Only `user_name` or `service_principal_name` can be specified. If both are specified, an error is thrown. diff --git a/go.mod b/go.mod index 603b000cd5..a6801fbc7f 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.4.0 // MIT github.com/briandowns/spinner v1.23.1 // Apache 2.0 - github.com/databricks/databricks-sdk-go v0.82.0 // Apache 2.0 + github.com/databricks/databricks-sdk-go v0.83.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 eb1dd69a4a..72379bfd10 100644 --- a/go.sum +++ b/go.sum @@ -33,8 +33,8 @@ github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZ 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.82.0 h1:Amosg1Jp6M3w04jrvL+sIdMyPx7M+D1W/JtYJFwsGGA= -github.com/databricks/databricks-sdk-go v0.82.0/go.mod h1:xBtjeP9nq+6MgTewZW1EcbRkD7aDY9gZvcRPcwPhZjw= +github.com/databricks/databricks-sdk-go v0.83.0 h1:Z7YGQ/FUt/Eb5laZYtpO1tln/HmpzPk5BiqxOjMsYLc= +github.com/databricks/databricks-sdk-go v0.83.0/go.mod h1:hWoHnHbNLjPKiTm5K/7bcIv3J3Pkgo5x9pPzh8K3RVE= 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=