diff --git a/.codegen/_openapi_sha b/.codegen/_openapi_sha index 68cd2f4be8..8622b29cac 100644 --- a/.codegen/_openapi_sha +++ b/.codegen/_openapi_sha @@ -1 +1 @@ -7016dcbf2e011459416cf408ce21143bcc4b3a25 \ No newline at end of file +a6a317df8327c9b1e5cb59a03a42ffa2aabeef6d \ No newline at end of file diff --git a/catalog/resource_credential.go b/catalog/resource_credential.go index 72f1ea5da1..0f5921c81c 100644 --- a/catalog/resource_credential.go +++ b/catalog/resource_credential.go @@ -88,7 +88,7 @@ func ResourceCredential() common.Resource { } // Bind the current workspace if the credential is isolated, otherwise the read will fail - return bindings.AddCurrentWorkspaceBindings(ctx, d, w, cred.Name, catalog.UpdateBindingsSecurableTypeServiceCredential) + return bindings.AddCurrentWorkspaceBindings(ctx, d, w, cred.Name, catalog.UpdateBindingsSecurableTypeCredential) }, Read: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error { w, err := c.WorkspaceClient() @@ -155,7 +155,7 @@ func ResourceCredential() common.Resource { return err } // Bind the current workspace if the credential is isolated, otherwise the read will fail - return bindings.AddCurrentWorkspaceBindings(ctx, d, w, updateCredRequest.NameArg, catalog.UpdateBindingsSecurableTypeServiceCredential) + return bindings.AddCurrentWorkspaceBindings(ctx, d, w, updateCredRequest.NameArg, catalog.UpdateBindingsSecurableTypeCredential) }, Delete: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error { force := d.Get("force_destroy").(bool) diff --git a/catalog/resource_credential_test.go b/catalog/resource_credential_test.go index c8f4573d4f..d215106fb7 100644 --- a/catalog/resource_credential_test.go +++ b/catalog/resource_credential_test.go @@ -110,7 +110,7 @@ func TestCreateIsolatedCredential(t *testing.T) { }, nil) w.GetMockWorkspaceBindingsAPI().EXPECT().UpdateBindings(mock.Anything, catalog.UpdateWorkspaceBindingsParameters{ SecurableName: "a", - SecurableType: catalog.UpdateBindingsSecurableTypeServiceCredential, + SecurableType: catalog.UpdateBindingsSecurableTypeCredential, Add: []catalog.WorkspaceBinding{ { WorkspaceId: int64(123456789101112), diff --git a/catalog/resource_workspace_binding.go b/catalog/resource_workspace_binding.go index de8da8cd10..8cad59774e 100644 --- a/catalog/resource_workspace_binding.go +++ b/catalog/resource_workspace_binding.go @@ -43,11 +43,14 @@ func ResourceWorkspaceBinding() common.Resource { Optional: true, Default: "catalog", } - common.CustomizeSchemaPath(m, "securable_type").SetValidateFunc(validation.StringInSlice([]string{"catalog", "external_location", "storage_credential"}, false)) - common.CustomizeSchemaPath(m, "binding_type").SetDefault(catalog.WorkspaceBindingBindingTypeBindingTypeReadWrite).SetValidateFunc(validation.StringInSlice([]string{ - string(catalog.WorkspaceBindingBindingTypeBindingTypeReadWrite), - string(catalog.WorkspaceBindingBindingTypeBindingTypeReadOnly), - }, false)) + common.CustomizeSchemaPath(m, "securable_type").SetValidateFunc(validation.StringInSlice([]string{ + "catalog", "external_location", "storage_credential", "credential"}, false)) + common.CustomizeSchemaPath(m, "binding_type").SetDefault( + catalog.WorkspaceBindingBindingTypeBindingTypeReadWrite).SetValidateFunc( + validation.StringInSlice([]string{ + string(catalog.WorkspaceBindingBindingTypeBindingTypeReadWrite), + string(catalog.WorkspaceBindingBindingTypeBindingTypeReadOnly), + }, false)) return m }, ) diff --git a/docs/resources/workspace_binding.md b/docs/resources/workspace_binding.md index e7dd0105af..2064bc5579 100644 --- a/docs/resources/workspace_binding.md +++ b/docs/resources/workspace_binding.md @@ -9,7 +9,7 @@ If you use workspaces to isolate user data access, you may want to limit access By default, Databricks assigns the securable to all workspaces attached to the current metastore. By using `databricks_workspace_binding`, the securable will be unassigned from all workspaces and only assigned explicitly using this resource. --> To use this resource the securable must have its isolation mode set to `ISOLATED` (for [databricks_catalog](catalog.md)) or `ISOLATION_MODE_ISOLATED` (for (for [databricks_external_location](external_location.md) or [databricks_storage_credential](storage_credential.md)) for the `isolation_mode` attribute. Alternatively, the isolation mode can be set using the UI or API by following [this guide](https://docs.databricks.com/data-governance/unity-catalog/create-catalogs.html#configuration), [this guide](https://docs.databricks.com/en/connect/unity-catalog/external-locations.html#workspace-binding) or [this guide](https://docs.databricks.com/en/connect/unity-catalog/storage-credentials.html#optional-assign-a-storage-credential-to-specific-workspaces). +-> To use this resource the securable must have its isolation mode set to `ISOLATED` (for [databricks_catalog](catalog.md)) or `ISOLATION_MODE_ISOLATED` (for (for [databricks_external_location](external_location.md), [databricks_storage_credential](storage_credential.md) or [databricks_credential](credential.md)) for the `isolation_mode` attribute. Alternatively, the isolation mode can be set using the UI or API by following [this guide](https://docs.databricks.com/data-governance/unity-catalog/create-catalogs.html#configuration), [this guide](https://docs.databricks.com/en/connect/unity-catalog/external-locations.html#workspace-binding) or [this guide](https://docs.databricks.com/en/connect/unity-catalog/storage-credentials.html#optional-assign-a-storage-credential-to-specific-workspaces). -> If the securable's isolation mode was set to `ISOLATED` using Terraform then the securable will have been automatically bound to the workspace it was created from. @@ -33,7 +33,7 @@ The following arguments are required: * `workspace_id` - ID of the workspace. Change forces creation of a new resource. * `securable_name` - Name of securable. Change forces creation of a new resource. -* `securable_type` - Type of securable. Can be `catalog`, `external-location` or `storage-credential`. Default to `catalog`. Change forces creation of a new resource. +* `securable_type` - Type of securable. Can be `catalog`, `external_location`, `storage_credential` or `credential`. Default to `catalog`. Change forces creation of a new resource. * `binding_type` - (Optional) Binding mode. Default to `BINDING_TYPE_READ_WRITE`. Possible values are `BINDING_TYPE_READ_ONLY`, `BINDING_TYPE_READ_WRITE`. ## Import diff --git a/go.mod b/go.mod index c2f9e17bb3..841dfbe0e5 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.22.0 toolchain go1.22.5 require ( - github.com/databricks/databricks-sdk-go v0.53.0 + github.com/databricks/databricks-sdk-go v0.54.0 github.com/golang-jwt/jwt/v4 v4.5.1 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/hcl v1.0.0 diff --git a/go.sum b/go.sum index 0aff3b872d..197b45a6f1 100644 --- a/go.sum +++ b/go.sum @@ -28,6 +28,8 @@ github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53E github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/databricks/databricks-sdk-go v0.53.0 h1:rZMXaTC3HNKZt+m4C4I/dY3EdZj+kl/sVd/Kdq55Qfo= github.com/databricks/databricks-sdk-go v0.53.0/go.mod h1:ds+zbv5mlQG7nFEU5ojLtgN/u0/9YzZmKQES/CfedzU= +github.com/databricks/databricks-sdk-go v0.54.0 h1:L8gsA3NXs+uYU3QtW/OUgjxMQxOH24k0MT9JhB3zLlM= +github.com/databricks/databricks-sdk-go v0.54.0/go.mod h1:ds+zbv5mlQG7nFEU5ojLtgN/u0/9YzZmKQES/CfedzU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/internal/acceptance/workspace_binding_test.go b/internal/acceptance/workspace_binding_test.go index f55f4ebd72..48c07b4858 100644 --- a/internal/acceptance/workspace_binding_test.go +++ b/internal/acceptance/workspace_binding_test.go @@ -30,6 +30,16 @@ func workspaceBindingTemplateWithWorkspaceId(workspaceId string) string { } isolation_mode = "ISOLATION_MODE_ISOLATED" } + + resource "databricks_credential" "credential" { + name = "service-cred-{var.RANDOM}" + aws_iam_role { + role_arn = "{env.TEST_METASTORE_DATA_ACCESS_ARN}" + } + purpose = "SERVICE" + skip_validation = true + isolation_mode = "ISOLATION_MODE_ISOLATED" + } resource "databricks_external_location" "some" { name = "external-{var.RANDOM}" @@ -40,28 +50,34 @@ func workspaceBindingTemplateWithWorkspaceId(workspaceId string) string { resource "databricks_workspace_binding" "dev" { catalog_name = databricks_catalog.dev.name - workspace_id = %s + workspace_id = %[1]s } resource "databricks_workspace_binding" "prod" { securable_name = databricks_catalog.prod.name securable_type = "catalog" - workspace_id = %s + workspace_id = %[1]s binding_type = "BINDING_TYPE_READ_ONLY" } resource "databricks_workspace_binding" "ext" { securable_name = databricks_external_location.some.id securable_type = "external_location" - workspace_id = %s + workspace_id = %[1]s } resource "databricks_workspace_binding" "cred" { securable_name = databricks_storage_credential.external.id securable_type = "storage_credential" - workspace_id = %s - } - `, workspaceId, workspaceId, workspaceId, workspaceId) + workspace_id = %[1]s + } + + resource "databricks_workspace_binding" "service_cred" { + securable_name = databricks_credential.credential.id + securable_type = "credential" + workspace_id = %[1]s + } + `, workspaceId) } func TestUcAccWorkspaceBindingToOtherWorkspace(t *testing.T) { diff --git a/internal/service/compute_tf/model.go b/internal/service/compute_tf/model.go index ad9792e562..b5e207bb13 100755 --- a/internal/service/compute_tf/model.go +++ b/internal/service/compute_tf/model.go @@ -965,9 +965,16 @@ type ClusterAttributes struct { // Data security mode decides what data governance model to use when // accessing data from a cluster. // - // * `NONE`: No security isolation for multiple users sharing the cluster. - // Data governance features are not available in this mode. * `SINGLE_USER`: - // A secure cluster that can only be exclusively used by a single user + // The following modes can only be used with `kind`. * + // `DATA_SECURITY_MODE_AUTO`: Databricks will choose the most appropriate + // access mode depending on your compute configuration. * + // `DATA_SECURITY_MODE_STANDARD`: Alias for `USER_ISOLATION`. * + // `DATA_SECURITY_MODE_DEDICATED`: Alias for `SINGLE_USER`. + // + // The following modes can be used regardless of `kind`. * `NONE`: No + // security isolation for multiple users sharing the cluster. Data + // governance features are not available in this mode. * `SINGLE_USER`: A + // secure cluster that can only be exclusively used by a single user // specified in `single_user_name`. Most programming languages, cluster // features and data governance features are available in this mode. * // `USER_ISOLATION`: A secure cluster that can be shared by multiple users. @@ -1012,6 +1019,19 @@ type ClusterAttributes struct { InitScripts types.List `tfsdk:"init_scripts" tf:"optional"` // The optional ID of the instance pool to which the cluster belongs. InstancePoolId types.String `tfsdk:"instance_pool_id" tf:"optional"` + // This field can only be used with `kind`. + // + // When set to true, Databricks will automatically set single node related + // `custom_tags`, `spark_conf`, and `num_workers` + IsSingleNode types.Bool `tfsdk:"is_single_node" tf:"optional"` + // The kind of compute described by this compute specification. + // + // Depending on `kind`, different validations and default values will be + // applied. + // + // The first usage of this value is for the simple cluster form where it + // sets `kind = CLASSIC_PREVIEW`. + Kind types.String `tfsdk:"kind" tf:"optional"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A @@ -1059,6 +1079,12 @@ type ClusterAttributes struct { // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. SshPublicKeys types.List `tfsdk:"ssh_public_keys" tf:"optional"` + // This field can only be used with `kind`. + // + // `effective_spark_version` is determined by `spark_version` (DBR release), + // this field `use_ml_runtime`, and whether `node_type_id` is gpu node or + // not. + UseMlRuntime types.Bool `tfsdk:"use_ml_runtime" tf:"optional"` WorkloadType types.List `tfsdk:"workload_type" tf:"optional,object"` } @@ -1114,6 +1140,8 @@ func (o ClusterAttributes) ToObjectValue(ctx context.Context) basetypes.ObjectVa "gcp_attributes": o.GcpAttributes, "init_scripts": o.InitScripts, "instance_pool_id": o.InstancePoolId, + "is_single_node": o.IsSingleNode, + "kind": o.Kind, "node_type_id": o.NodeTypeId, "policy_id": o.PolicyId, "runtime_engine": o.RuntimeEngine, @@ -1122,6 +1150,7 @@ func (o ClusterAttributes) ToObjectValue(ctx context.Context) basetypes.ObjectVa "spark_env_vars": o.SparkEnvVars, "spark_version": o.SparkVersion, "ssh_public_keys": o.SshPublicKeys, + "use_ml_runtime": o.UseMlRuntime, "workload_type": o.WorkloadType, }) } @@ -1159,6 +1188,8 @@ func (o ClusterAttributes) Type(ctx context.Context) attr.Type { ElemType: InitScriptInfo{}.Type(ctx), }, "instance_pool_id": types.StringType, + "is_single_node": types.BoolType, + "kind": types.StringType, "node_type_id": types.StringType, "policy_id": types.StringType, "runtime_engine": types.StringType, @@ -1173,6 +1204,7 @@ func (o ClusterAttributes) Type(ctx context.Context) attr.Type { "ssh_public_keys": basetypes.ListType{ ElemType: types.StringType, }, + "use_ml_runtime": types.BoolType, "workload_type": basetypes.ListType{ ElemType: WorkloadType{}.Type(ctx), }, @@ -1607,9 +1639,16 @@ type ClusterDetails struct { // Data security mode decides what data governance model to use when // accessing data from a cluster. // - // * `NONE`: No security isolation for multiple users sharing the cluster. - // Data governance features are not available in this mode. * `SINGLE_USER`: - // A secure cluster that can only be exclusively used by a single user + // The following modes can only be used with `kind`. * + // `DATA_SECURITY_MODE_AUTO`: Databricks will choose the most appropriate + // access mode depending on your compute configuration. * + // `DATA_SECURITY_MODE_STANDARD`: Alias for `USER_ISOLATION`. * + // `DATA_SECURITY_MODE_DEDICATED`: Alias for `SINGLE_USER`. + // + // The following modes can be used regardless of `kind`. * `NONE`: No + // security isolation for multiple users sharing the cluster. Data + // governance features are not available in this mode. * `SINGLE_USER`: A + // secure cluster that can only be exclusively used by a single user // specified in `single_user_name`. Most programming languages, cluster // features and data governance features are available in this mode. * // `USER_ISOLATION`: A secure cluster that can be shared by multiple users. @@ -1673,9 +1712,22 @@ type ClusterDetails struct { InitScripts types.List `tfsdk:"init_scripts" tf:"optional"` // The optional ID of the instance pool to which the cluster belongs. InstancePoolId types.String `tfsdk:"instance_pool_id" tf:"optional"` + // This field can only be used with `kind`. + // + // When set to true, Databricks will automatically set single node related + // `custom_tags`, `spark_conf`, and `num_workers` + IsSingleNode types.Bool `tfsdk:"is_single_node" tf:"optional"` // Port on which Spark JDBC server is listening, in the driver nod. No // service will be listeningon on this port in executor nodes. JdbcPort types.Int64 `tfsdk:"jdbc_port" tf:"optional"` + // The kind of compute described by this compute specification. + // + // Depending on `kind`, different validations and default values will be + // applied. + // + // The first usage of this value is for the simple cluster form where it + // sets `kind = CLASSIC_PREVIEW`. + Kind types.String `tfsdk:"kind" tf:"optional"` // the timestamp that the cluster was started/restarted LastRestartedTime types.Int64 `tfsdk:"last_restarted_time" tf:"optional"` // Time when the cluster driver last lost its state (due to a restart or @@ -1762,6 +1814,12 @@ type ClusterDetails struct { // Information about why the cluster was terminated. This field only appears // when the cluster is in a `TERMINATING` or `TERMINATED` state. TerminationReason types.List `tfsdk:"termination_reason" tf:"optional,object"` + // This field can only be used with `kind`. + // + // `effective_spark_version` is determined by `spark_version` (DBR release), + // this field `use_ml_runtime`, and whether `node_type_id` is gpu node or + // not. + UseMlRuntime types.Bool `tfsdk:"use_ml_runtime" tf:"optional"` WorkloadType types.List `tfsdk:"workload_type" tf:"optional,object"` } @@ -1834,7 +1892,9 @@ func (o ClusterDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue "gcp_attributes": o.GcpAttributes, "init_scripts": o.InitScripts, "instance_pool_id": o.InstancePoolId, + "is_single_node": o.IsSingleNode, "jdbc_port": o.JdbcPort, + "kind": o.Kind, "last_restarted_time": o.LastRestartedTime, "last_state_loss_time": o.LastStateLossTime, "node_type_id": o.NodeTypeId, @@ -1853,6 +1913,7 @@ func (o ClusterDetails) ToObjectValue(ctx context.Context) basetypes.ObjectValue "state_message": o.StateMessage, "terminated_time": o.TerminatedTime, "termination_reason": o.TerminationReason, + "use_ml_runtime": o.UseMlRuntime, "workload_type": o.WorkloadType, }) } @@ -1910,7 +1971,9 @@ func (o ClusterDetails) Type(ctx context.Context) attr.Type { ElemType: InitScriptInfo{}.Type(ctx), }, "instance_pool_id": types.StringType, + "is_single_node": types.BoolType, "jdbc_port": types.Int64Type, + "kind": types.StringType, "last_restarted_time": types.Int64Type, "last_state_loss_time": types.Int64Type, "node_type_id": types.StringType, @@ -1939,6 +2002,7 @@ func (o ClusterDetails) Type(ctx context.Context) attr.Type { "termination_reason": basetypes.ListType{ ElemType: TerminationReason{}.Type(ctx), }, + "use_ml_runtime": types.BoolType, "workload_type": basetypes.ListType{ ElemType: WorkloadType{}.Type(ctx), }, @@ -3605,9 +3669,16 @@ type ClusterSpec struct { // Data security mode decides what data governance model to use when // accessing data from a cluster. // - // * `NONE`: No security isolation for multiple users sharing the cluster. - // Data governance features are not available in this mode. * `SINGLE_USER`: - // A secure cluster that can only be exclusively used by a single user + // The following modes can only be used with `kind`. * + // `DATA_SECURITY_MODE_AUTO`: Databricks will choose the most appropriate + // access mode depending on your compute configuration. * + // `DATA_SECURITY_MODE_STANDARD`: Alias for `USER_ISOLATION`. * + // `DATA_SECURITY_MODE_DEDICATED`: Alias for `SINGLE_USER`. + // + // The following modes can be used regardless of `kind`. * `NONE`: No + // security isolation for multiple users sharing the cluster. Data + // governance features are not available in this mode. * `SINGLE_USER`: A + // secure cluster that can only be exclusively used by a single user // specified in `single_user_name`. Most programming languages, cluster // features and data governance features are available in this mode. * // `USER_ISOLATION`: A secure cluster that can be shared by multiple users. @@ -3652,6 +3723,19 @@ type ClusterSpec struct { InitScripts types.List `tfsdk:"init_scripts" tf:"optional"` // The optional ID of the instance pool to which the cluster belongs. InstancePoolId types.String `tfsdk:"instance_pool_id" tf:"optional"` + // This field can only be used with `kind`. + // + // When set to true, Databricks will automatically set single node related + // `custom_tags`, `spark_conf`, and `num_workers` + IsSingleNode types.Bool `tfsdk:"is_single_node" tf:"optional"` + // The kind of compute described by this compute specification. + // + // Depending on `kind`, different validations and default values will be + // applied. + // + // The first usage of this value is for the simple cluster form where it + // sets `kind = CLASSIC_PREVIEW`. + Kind types.String `tfsdk:"kind" tf:"optional"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A @@ -3710,6 +3794,12 @@ type ClusterSpec struct { // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. SshPublicKeys types.List `tfsdk:"ssh_public_keys" tf:"optional"` + // This field can only be used with `kind`. + // + // `effective_spark_version` is determined by `spark_version` (DBR release), + // this field `use_ml_runtime`, and whether `node_type_id` is gpu node or + // not. + UseMlRuntime types.Bool `tfsdk:"use_ml_runtime" tf:"optional"` WorkloadType types.List `tfsdk:"workload_type" tf:"optional,object"` } @@ -3768,6 +3858,8 @@ func (o ClusterSpec) ToObjectValue(ctx context.Context) basetypes.ObjectValue { "gcp_attributes": o.GcpAttributes, "init_scripts": o.InitScripts, "instance_pool_id": o.InstancePoolId, + "is_single_node": o.IsSingleNode, + "kind": o.Kind, "node_type_id": o.NodeTypeId, "num_workers": o.NumWorkers, "policy_id": o.PolicyId, @@ -3777,6 +3869,7 @@ func (o ClusterSpec) ToObjectValue(ctx context.Context) basetypes.ObjectValue { "spark_env_vars": o.SparkEnvVars, "spark_version": o.SparkVersion, "ssh_public_keys": o.SshPublicKeys, + "use_ml_runtime": o.UseMlRuntime, "workload_type": o.WorkloadType, }) } @@ -3818,6 +3911,8 @@ func (o ClusterSpec) Type(ctx context.Context) attr.Type { ElemType: InitScriptInfo{}.Type(ctx), }, "instance_pool_id": types.StringType, + "is_single_node": types.BoolType, + "kind": types.StringType, "node_type_id": types.StringType, "num_workers": types.Int64Type, "policy_id": types.StringType, @@ -3833,6 +3928,7 @@ func (o ClusterSpec) Type(ctx context.Context) attr.Type { "ssh_public_keys": basetypes.ListType{ ElemType: types.StringType, }, + "use_ml_runtime": types.BoolType, "workload_type": basetypes.ListType{ ElemType: WorkloadType{}.Type(ctx), }, @@ -4515,9 +4611,16 @@ type CreateCluster struct { // Data security mode decides what data governance model to use when // accessing data from a cluster. // - // * `NONE`: No security isolation for multiple users sharing the cluster. - // Data governance features are not available in this mode. * `SINGLE_USER`: - // A secure cluster that can only be exclusively used by a single user + // The following modes can only be used with `kind`. * + // `DATA_SECURITY_MODE_AUTO`: Databricks will choose the most appropriate + // access mode depending on your compute configuration. * + // `DATA_SECURITY_MODE_STANDARD`: Alias for `USER_ISOLATION`. * + // `DATA_SECURITY_MODE_DEDICATED`: Alias for `SINGLE_USER`. + // + // The following modes can be used regardless of `kind`. * `NONE`: No + // security isolation for multiple users sharing the cluster. Data + // governance features are not available in this mode. * `SINGLE_USER`: A + // secure cluster that can only be exclusively used by a single user // specified in `single_user_name`. Most programming languages, cluster // features and data governance features are available in this mode. * // `USER_ISOLATION`: A secure cluster that can be shared by multiple users. @@ -4562,6 +4665,19 @@ type CreateCluster struct { InitScripts types.List `tfsdk:"init_scripts" tf:"optional"` // The optional ID of the instance pool to which the cluster belongs. InstancePoolId types.String `tfsdk:"instance_pool_id" tf:"optional"` + // This field can only be used with `kind`. + // + // When set to true, Databricks will automatically set single node related + // `custom_tags`, `spark_conf`, and `num_workers` + IsSingleNode types.Bool `tfsdk:"is_single_node" tf:"optional"` + // The kind of compute described by this compute specification. + // + // Depending on `kind`, different validations and default values will be + // applied. + // + // The first usage of this value is for the simple cluster form where it + // sets `kind = CLASSIC_PREVIEW`. + Kind types.String `tfsdk:"kind" tf:"optional"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A @@ -4620,6 +4736,12 @@ type CreateCluster struct { // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. SshPublicKeys types.List `tfsdk:"ssh_public_keys" tf:"optional"` + // This field can only be used with `kind`. + // + // `effective_spark_version` is determined by `spark_version` (DBR release), + // this field `use_ml_runtime`, and whether `node_type_id` is gpu node or + // not. + UseMlRuntime types.Bool `tfsdk:"use_ml_runtime" tf:"optional"` WorkloadType types.List `tfsdk:"workload_type" tf:"optional,object"` } @@ -4680,6 +4802,8 @@ func (o CreateCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue "gcp_attributes": o.GcpAttributes, "init_scripts": o.InitScripts, "instance_pool_id": o.InstancePoolId, + "is_single_node": o.IsSingleNode, + "kind": o.Kind, "node_type_id": o.NodeTypeId, "num_workers": o.NumWorkers, "policy_id": o.PolicyId, @@ -4689,6 +4813,7 @@ func (o CreateCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue "spark_env_vars": o.SparkEnvVars, "spark_version": o.SparkVersion, "ssh_public_keys": o.SshPublicKeys, + "use_ml_runtime": o.UseMlRuntime, "workload_type": o.WorkloadType, }) } @@ -4733,6 +4858,8 @@ func (o CreateCluster) Type(ctx context.Context) attr.Type { ElemType: InitScriptInfo{}.Type(ctx), }, "instance_pool_id": types.StringType, + "is_single_node": types.BoolType, + "kind": types.StringType, "node_type_id": types.StringType, "num_workers": types.Int64Type, "policy_id": types.StringType, @@ -4748,6 +4875,7 @@ func (o CreateCluster) Type(ctx context.Context) attr.Type { "ssh_public_keys": basetypes.ListType{ ElemType: types.StringType, }, + "use_ml_runtime": types.BoolType, "workload_type": basetypes.ListType{ ElemType: WorkloadType{}.Type(ctx), }, @@ -6595,9 +6723,16 @@ type EditCluster struct { // Data security mode decides what data governance model to use when // accessing data from a cluster. // - // * `NONE`: No security isolation for multiple users sharing the cluster. - // Data governance features are not available in this mode. * `SINGLE_USER`: - // A secure cluster that can only be exclusively used by a single user + // The following modes can only be used with `kind`. * + // `DATA_SECURITY_MODE_AUTO`: Databricks will choose the most appropriate + // access mode depending on your compute configuration. * + // `DATA_SECURITY_MODE_STANDARD`: Alias for `USER_ISOLATION`. * + // `DATA_SECURITY_MODE_DEDICATED`: Alias for `SINGLE_USER`. + // + // The following modes can be used regardless of `kind`. * `NONE`: No + // security isolation for multiple users sharing the cluster. Data + // governance features are not available in this mode. * `SINGLE_USER`: A + // secure cluster that can only be exclusively used by a single user // specified in `single_user_name`. Most programming languages, cluster // features and data governance features are available in this mode. * // `USER_ISOLATION`: A secure cluster that can be shared by multiple users. @@ -6642,6 +6777,19 @@ type EditCluster struct { InitScripts types.List `tfsdk:"init_scripts" tf:"optional"` // The optional ID of the instance pool to which the cluster belongs. InstancePoolId types.String `tfsdk:"instance_pool_id" tf:"optional"` + // This field can only be used with `kind`. + // + // When set to true, Databricks will automatically set single node related + // `custom_tags`, `spark_conf`, and `num_workers` + IsSingleNode types.Bool `tfsdk:"is_single_node" tf:"optional"` + // The kind of compute described by this compute specification. + // + // Depending on `kind`, different validations and default values will be + // applied. + // + // The first usage of this value is for the simple cluster form where it + // sets `kind = CLASSIC_PREVIEW`. + Kind types.String `tfsdk:"kind" tf:"optional"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A @@ -6700,6 +6848,12 @@ type EditCluster struct { // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. SshPublicKeys types.List `tfsdk:"ssh_public_keys" tf:"optional"` + // This field can only be used with `kind`. + // + // `effective_spark_version` is determined by `spark_version` (DBR release), + // this field `use_ml_runtime`, and whether `node_type_id` is gpu node or + // not. + UseMlRuntime types.Bool `tfsdk:"use_ml_runtime" tf:"optional"` WorkloadType types.List `tfsdk:"workload_type" tf:"optional,object"` } @@ -6759,6 +6913,8 @@ func (o EditCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue { "gcp_attributes": o.GcpAttributes, "init_scripts": o.InitScripts, "instance_pool_id": o.InstancePoolId, + "is_single_node": o.IsSingleNode, + "kind": o.Kind, "node_type_id": o.NodeTypeId, "num_workers": o.NumWorkers, "policy_id": o.PolicyId, @@ -6768,6 +6924,7 @@ func (o EditCluster) ToObjectValue(ctx context.Context) basetypes.ObjectValue { "spark_env_vars": o.SparkEnvVars, "spark_version": o.SparkVersion, "ssh_public_keys": o.SshPublicKeys, + "use_ml_runtime": o.UseMlRuntime, "workload_type": o.WorkloadType, }) } @@ -6810,6 +6967,8 @@ func (o EditCluster) Type(ctx context.Context) attr.Type { ElemType: InitScriptInfo{}.Type(ctx), }, "instance_pool_id": types.StringType, + "is_single_node": types.BoolType, + "kind": types.StringType, "node_type_id": types.StringType, "num_workers": types.Int64Type, "policy_id": types.StringType, @@ -6825,6 +6984,7 @@ func (o EditCluster) Type(ctx context.Context) attr.Type { "ssh_public_keys": basetypes.ListType{ ElemType: types.StringType, }, + "use_ml_runtime": types.BoolType, "workload_type": basetypes.ListType{ ElemType: WorkloadType{}.Type(ctx), }, @@ -15483,9 +15643,16 @@ type UpdateClusterResource struct { // Data security mode decides what data governance model to use when // accessing data from a cluster. // - // * `NONE`: No security isolation for multiple users sharing the cluster. - // Data governance features are not available in this mode. * `SINGLE_USER`: - // A secure cluster that can only be exclusively used by a single user + // The following modes can only be used with `kind`. * + // `DATA_SECURITY_MODE_AUTO`: Databricks will choose the most appropriate + // access mode depending on your compute configuration. * + // `DATA_SECURITY_MODE_STANDARD`: Alias for `USER_ISOLATION`. * + // `DATA_SECURITY_MODE_DEDICATED`: Alias for `SINGLE_USER`. + // + // The following modes can be used regardless of `kind`. * `NONE`: No + // security isolation for multiple users sharing the cluster. Data + // governance features are not available in this mode. * `SINGLE_USER`: A + // secure cluster that can only be exclusively used by a single user // specified in `single_user_name`. Most programming languages, cluster // features and data governance features are available in this mode. * // `USER_ISOLATION`: A secure cluster that can be shared by multiple users. @@ -15530,6 +15697,19 @@ type UpdateClusterResource struct { InitScripts types.List `tfsdk:"init_scripts" tf:"optional"` // The optional ID of the instance pool to which the cluster belongs. InstancePoolId types.String `tfsdk:"instance_pool_id" tf:"optional"` + // This field can only be used with `kind`. + // + // When set to true, Databricks will automatically set single node related + // `custom_tags`, `spark_conf`, and `num_workers` + IsSingleNode types.Bool `tfsdk:"is_single_node" tf:"optional"` + // The kind of compute described by this compute specification. + // + // Depending on `kind`, different validations and default values will be + // applied. + // + // The first usage of this value is for the simple cluster form where it + // sets `kind = CLASSIC_PREVIEW`. + Kind types.String `tfsdk:"kind" tf:"optional"` // This field encodes, through a single value, the resources available to // each of the Spark nodes in this cluster. For example, the Spark nodes can // be provisioned and optimized for memory or compute intensive workloads. A @@ -15588,6 +15768,12 @@ type UpdateClusterResource struct { // cluster. The corresponding private keys can be used to login with the // user name `ubuntu` on port `2200`. Up to 10 keys can be specified. SshPublicKeys types.List `tfsdk:"ssh_public_keys" tf:"optional"` + // This field can only be used with `kind`. + // + // `effective_spark_version` is determined by `spark_version` (DBR release), + // this field `use_ml_runtime`, and whether `node_type_id` is gpu node or + // not. + UseMlRuntime types.Bool `tfsdk:"use_ml_runtime" tf:"optional"` WorkloadType types.List `tfsdk:"workload_type" tf:"optional,object"` } @@ -15645,6 +15831,8 @@ func (o UpdateClusterResource) ToObjectValue(ctx context.Context) basetypes.Obje "gcp_attributes": o.GcpAttributes, "init_scripts": o.InitScripts, "instance_pool_id": o.InstancePoolId, + "is_single_node": o.IsSingleNode, + "kind": o.Kind, "node_type_id": o.NodeTypeId, "num_workers": o.NumWorkers, "policy_id": o.PolicyId, @@ -15654,6 +15842,7 @@ func (o UpdateClusterResource) ToObjectValue(ctx context.Context) basetypes.Obje "spark_env_vars": o.SparkEnvVars, "spark_version": o.SparkVersion, "ssh_public_keys": o.SshPublicKeys, + "use_ml_runtime": o.UseMlRuntime, "workload_type": o.WorkloadType, }) } @@ -15694,6 +15883,8 @@ func (o UpdateClusterResource) Type(ctx context.Context) attr.Type { ElemType: InitScriptInfo{}.Type(ctx), }, "instance_pool_id": types.StringType, + "is_single_node": types.BoolType, + "kind": types.StringType, "node_type_id": types.StringType, "num_workers": types.Int64Type, "policy_id": types.StringType, @@ -15709,6 +15900,7 @@ func (o UpdateClusterResource) Type(ctx context.Context) attr.Type { "ssh_public_keys": basetypes.ListType{ ElemType: types.StringType, }, + "use_ml_runtime": types.BoolType, "workload_type": basetypes.ListType{ ElemType: WorkloadType{}.Type(ctx), }, diff --git a/internal/service/dashboards_tf/model.go b/internal/service/dashboards_tf/model.go index 71b2320c15..dbde593949 100755 --- a/internal/service/dashboards_tf/model.go +++ b/internal/service/dashboards_tf/model.go @@ -1998,6 +1998,10 @@ type MigrateDashboardRequest struct { ParentPath types.String `tfsdk:"parent_path" tf:"optional"` // UUID of the dashboard to be migrated. SourceDashboardId types.String `tfsdk:"source_dashboard_id" tf:""` + // Flag to indicate if mustache parameter syntax ({{ param }}) should be + // auto-updated to named syntax (:param) when converting datasets in the + // dashboard. + UpdateParameterSyntax types.Bool `tfsdk:"update_parameter_syntax" tf:"optional"` } func (newState *MigrateDashboardRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan MigrateDashboardRequest) { @@ -2024,9 +2028,10 @@ func (o MigrateDashboardRequest) ToObjectValue(ctx context.Context) basetypes.Ob return types.ObjectValueMust( o.Type(ctx).(basetypes.ObjectType).AttrTypes, map[string]attr.Value{ - "display_name": o.DisplayName, - "parent_path": o.ParentPath, - "source_dashboard_id": o.SourceDashboardId, + "display_name": o.DisplayName, + "parent_path": o.ParentPath, + "source_dashboard_id": o.SourceDashboardId, + "update_parameter_syntax": o.UpdateParameterSyntax, }) } @@ -2034,9 +2039,10 @@ func (o MigrateDashboardRequest) ToObjectValue(ctx context.Context) basetypes.Ob func (o MigrateDashboardRequest) Type(ctx context.Context) attr.Type { return types.ObjectType{ AttrTypes: map[string]attr.Type{ - "display_name": types.StringType, - "parent_path": types.StringType, - "source_dashboard_id": types.StringType, + "display_name": types.StringType, + "parent_path": types.StringType, + "source_dashboard_id": types.StringType, + "update_parameter_syntax": types.BoolType, }, } } diff --git a/internal/service/jobs_tf/model.go b/internal/service/jobs_tf/model.go index 2c6cdea10c..3bdba0fce8 100755 --- a/internal/service/jobs_tf/model.go +++ b/internal/service/jobs_tf/model.go @@ -243,6 +243,8 @@ type BaseRun struct { // failures. * `RUN_JOB_TASK`: Indicates a run that is triggered using a Run // Job task. * `FILE_ARRIVAL`: Indicates a run that is triggered by a file // arrival. * `TABLE`: Indicates a run that is triggered by a table update. + // * `CONTINUOUS_RESTART`: Indicates a run created by user to manually + // restart a continuous job run. Trigger types.String `tfsdk:"trigger" tf:"optional"` // Additional details about what triggered the run TriggerInfo types.List `tfsdk:"trigger_info" tf:"optional,object"` @@ -855,7 +857,7 @@ func (o CancelRunResponse) Type(ctx context.Context) attr.Type { } } -// Stores the run state of the clean room notebook V1 task. +// Stores the run state of the clean rooms notebook task. type CleanRoomTaskRunState struct { // A value indicating the run's current lifecycle state. This field is // always available in the response. @@ -904,6 +906,92 @@ func (o CleanRoomTaskRunState) Type(ctx context.Context) attr.Type { } } +type CleanRoomsNotebookTask struct { + // The clean room that the notebook belongs to. + CleanRoomName types.String `tfsdk:"clean_room_name" tf:""` + // Checksum to validate the freshness of the notebook resource (i.e. the + // notebook being run is the latest version). It can be fetched by calling + // the :method:cleanroomassets/get API. + Etag types.String `tfsdk:"etag" tf:"optional"` + // Base parameters to be used for the clean room notebook job. + NotebookBaseParameters types.Map `tfsdk:"notebook_base_parameters" tf:"optional"` + // Name of the notebook being run. + NotebookName types.String `tfsdk:"notebook_name" tf:""` +} + +func (newState *CleanRoomsNotebookTask) SyncEffectiveFieldsDuringCreateOrUpdate(plan CleanRoomsNotebookTask) { +} + +func (newState *CleanRoomsNotebookTask) SyncEffectiveFieldsDuringRead(existingState CleanRoomsNotebookTask) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CleanRoomsNotebookTask. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CleanRoomsNotebookTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "notebook_base_parameters": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CleanRoomsNotebookTask +// only implements ToObjectValue() and Type(). +func (o CleanRoomsNotebookTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "clean_room_name": o.CleanRoomName, + "etag": o.Etag, + "notebook_base_parameters": o.NotebookBaseParameters, + "notebook_name": o.NotebookName, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CleanRoomsNotebookTask) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "clean_room_name": types.StringType, + "etag": types.StringType, + "notebook_base_parameters": basetypes.MapType{ + ElemType: types.StringType, + }, + "notebook_name": types.StringType, + }, + } +} + +// GetNotebookBaseParameters returns the value of the NotebookBaseParameters field in CleanRoomsNotebookTask as +// a map of string to types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *CleanRoomsNotebookTask) GetNotebookBaseParameters(ctx context.Context) (map[string]types.String, bool) { + if o.NotebookBaseParameters.IsNull() || o.NotebookBaseParameters.IsUnknown() { + return nil, false + } + var v map[string]types.String + d := o.NotebookBaseParameters.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetNotebookBaseParameters sets the value of the NotebookBaseParameters field in CleanRoomsNotebookTask. +func (o *CleanRoomsNotebookTask) SetNotebookBaseParameters(ctx context.Context, v map[string]types.String) { + vs := make(map[string]attr.Value, len(v)) + for k, e := range v { + vs[k] = e + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["notebook_base_parameters"] + t = t.(attr.TypeWithElementType).ElementType() + o.NotebookBaseParameters = types.MapValueMust(t, vs) +} + type ClusterInstance struct { // The canonical identifier for the cluster used by a run. This field is // always available for runs on existing clusters. For runs on new clusters, @@ -5596,13 +5684,13 @@ type JobsHealthRule struct { // // * `RUN_DURATION_SECONDS`: Expected total time for a run in seconds. * // `STREAMING_BACKLOG_BYTES`: An estimate of the maximum bytes of data - // waiting to be consumed across all streams. This metric is in Private + // waiting to be consumed across all streams. This metric is in Public // Preview. * `STREAMING_BACKLOG_RECORDS`: An estimate of the maximum offset - // lag across all streams. This metric is in Private Preview. * + // lag across all streams. This metric is in Public Preview. * // `STREAMING_BACKLOG_SECONDS`: An estimate of the maximum consumer delay - // across all streams. This metric is in Private Preview. * + // across all streams. This metric is in Public Preview. * // `STREAMING_BACKLOG_FILES`: An estimate of the maximum number of - // outstanding files across all streams. This metric is in Private Preview. + // outstanding files across all streams. This metric is in Public Preview. Metric types.String `tfsdk:"metric" tf:""` // Specifies the operator used to compare the health metric value with the // specified threshold. @@ -8518,6 +8606,8 @@ type Run struct { // failures. * `RUN_JOB_TASK`: Indicates a run that is triggered using a Run // Job task. * `FILE_ARRIVAL`: Indicates a run that is triggered by a file // arrival. * `TABLE`: Indicates a run that is triggered by a table update. + // * `CONTINUOUS_RESTART`: Indicates a run created by user to manually + // restart a continuous job run. Trigger types.String `tfsdk:"trigger" tf:"optional"` // Additional details about what triggered the run TriggerInfo types.List `tfsdk:"trigger_info" tf:"optional,object"` @@ -10966,6 +11056,11 @@ type RunTask struct { // retried only until they succeed, and the maximum `attempt_number` is the // same as the `max_retries` value for the job. AttemptNumber types.Int64 `tfsdk:"attempt_number" tf:"optional"` + // The task runs a [clean rooms] notebook when the + // `clean_rooms_notebook_task` field is present. + // + // [clean rooms]: https://docs.databricks.com/en/clean-rooms/index.html + CleanRoomsNotebookTask types.List `tfsdk:"clean_rooms_notebook_task" tf:"optional,object"` // The time in milliseconds it took to terminate the cluster and clean up // any associated artifacts. The duration of a task run is the sum of the // `setup_duration`, `execution_duration`, and the `cleanup_duration`. The @@ -11139,28 +11234,29 @@ func (newState *RunTask) SyncEffectiveFieldsDuringRead(existingState RunTask) { // SDK values. func (a RunTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { return map[string]reflect.Type{ - "cluster_instance": reflect.TypeOf(ClusterInstance{}), - "condition_task": reflect.TypeOf(RunConditionTask{}), - "dbt_task": reflect.TypeOf(DbtTask{}), - "depends_on": reflect.TypeOf(TaskDependency{}), - "email_notifications": reflect.TypeOf(JobEmailNotifications{}), - "for_each_task": reflect.TypeOf(RunForEachTask{}), - "git_source": reflect.TypeOf(GitSource{}), - "library": reflect.TypeOf(compute_tf.Library{}), - "new_cluster": reflect.TypeOf(compute_tf.ClusterSpec{}), - "notebook_task": reflect.TypeOf(NotebookTask{}), - "notification_settings": reflect.TypeOf(TaskNotificationSettings{}), - "pipeline_task": reflect.TypeOf(PipelineTask{}), - "python_wheel_task": reflect.TypeOf(PythonWheelTask{}), - "resolved_values": reflect.TypeOf(ResolvedValues{}), - "run_job_task": reflect.TypeOf(RunJobTask{}), - "spark_jar_task": reflect.TypeOf(SparkJarTask{}), - "spark_python_task": reflect.TypeOf(SparkPythonTask{}), - "spark_submit_task": reflect.TypeOf(SparkSubmitTask{}), - "sql_task": reflect.TypeOf(SqlTask{}), - "state": reflect.TypeOf(RunState{}), - "status": reflect.TypeOf(RunStatus{}), - "webhook_notifications": reflect.TypeOf(WebhookNotifications{}), + "clean_rooms_notebook_task": reflect.TypeOf(CleanRoomsNotebookTask{}), + "cluster_instance": reflect.TypeOf(ClusterInstance{}), + "condition_task": reflect.TypeOf(RunConditionTask{}), + "dbt_task": reflect.TypeOf(DbtTask{}), + "depends_on": reflect.TypeOf(TaskDependency{}), + "email_notifications": reflect.TypeOf(JobEmailNotifications{}), + "for_each_task": reflect.TypeOf(RunForEachTask{}), + "git_source": reflect.TypeOf(GitSource{}), + "library": reflect.TypeOf(compute_tf.Library{}), + "new_cluster": reflect.TypeOf(compute_tf.ClusterSpec{}), + "notebook_task": reflect.TypeOf(NotebookTask{}), + "notification_settings": reflect.TypeOf(TaskNotificationSettings{}), + "pipeline_task": reflect.TypeOf(PipelineTask{}), + "python_wheel_task": reflect.TypeOf(PythonWheelTask{}), + "resolved_values": reflect.TypeOf(ResolvedValues{}), + "run_job_task": reflect.TypeOf(RunJobTask{}), + "spark_jar_task": reflect.TypeOf(SparkJarTask{}), + "spark_python_task": reflect.TypeOf(SparkPythonTask{}), + "spark_submit_task": reflect.TypeOf(SparkSubmitTask{}), + "sql_task": reflect.TypeOf(SqlTask{}), + "state": reflect.TypeOf(RunState{}), + "status": reflect.TypeOf(RunStatus{}), + "webhook_notifications": reflect.TypeOf(WebhookNotifications{}), } } @@ -11171,45 +11267,46 @@ func (o RunTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { return types.ObjectValueMust( o.Type(ctx).(basetypes.ObjectType).AttrTypes, map[string]attr.Value{ - "attempt_number": o.AttemptNumber, - "cleanup_duration": o.CleanupDuration, - "cluster_instance": o.ClusterInstance, - "condition_task": o.ConditionTask, - "dbt_task": o.DbtTask, - "depends_on": o.DependsOn, - "description": o.Description, - "email_notifications": o.EmailNotifications, - "end_time": o.EndTime, - "environment_key": o.EnvironmentKey, - "execution_duration": o.ExecutionDuration, - "existing_cluster_id": o.ExistingClusterId, - "for_each_task": o.ForEachTask, - "git_source": o.GitSource, - "job_cluster_key": o.JobClusterKey, - "library": o.Libraries, - "new_cluster": o.NewCluster, - "notebook_task": o.NotebookTask, - "notification_settings": o.NotificationSettings, - "pipeline_task": o.PipelineTask, - "python_wheel_task": o.PythonWheelTask, - "queue_duration": o.QueueDuration, - "resolved_values": o.ResolvedValues, - "run_duration": o.RunDuration, - "run_id": o.RunId, - "run_if": o.RunIf, - "run_job_task": o.RunJobTask, - "run_page_url": o.RunPageUrl, - "setup_duration": o.SetupDuration, - "spark_jar_task": o.SparkJarTask, - "spark_python_task": o.SparkPythonTask, - "spark_submit_task": o.SparkSubmitTask, - "sql_task": o.SqlTask, - "start_time": o.StartTime, - "state": o.State, - "status": o.Status, - "task_key": o.TaskKey, - "timeout_seconds": o.TimeoutSeconds, - "webhook_notifications": o.WebhookNotifications, + "attempt_number": o.AttemptNumber, + "clean_rooms_notebook_task": o.CleanRoomsNotebookTask, + "cleanup_duration": o.CleanupDuration, + "cluster_instance": o.ClusterInstance, + "condition_task": o.ConditionTask, + "dbt_task": o.DbtTask, + "depends_on": o.DependsOn, + "description": o.Description, + "email_notifications": o.EmailNotifications, + "end_time": o.EndTime, + "environment_key": o.EnvironmentKey, + "execution_duration": o.ExecutionDuration, + "existing_cluster_id": o.ExistingClusterId, + "for_each_task": o.ForEachTask, + "git_source": o.GitSource, + "job_cluster_key": o.JobClusterKey, + "library": o.Libraries, + "new_cluster": o.NewCluster, + "notebook_task": o.NotebookTask, + "notification_settings": o.NotificationSettings, + "pipeline_task": o.PipelineTask, + "python_wheel_task": o.PythonWheelTask, + "queue_duration": o.QueueDuration, + "resolved_values": o.ResolvedValues, + "run_duration": o.RunDuration, + "run_id": o.RunId, + "run_if": o.RunIf, + "run_job_task": o.RunJobTask, + "run_page_url": o.RunPageUrl, + "setup_duration": o.SetupDuration, + "spark_jar_task": o.SparkJarTask, + "spark_python_task": o.SparkPythonTask, + "spark_submit_task": o.SparkSubmitTask, + "sql_task": o.SqlTask, + "start_time": o.StartTime, + "state": o.State, + "status": o.Status, + "task_key": o.TaskKey, + "timeout_seconds": o.TimeoutSeconds, + "webhook_notifications": o.WebhookNotifications, }) } @@ -11217,7 +11314,10 @@ func (o RunTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { func (o RunTask) Type(ctx context.Context) attr.Type { return types.ObjectType{ AttrTypes: map[string]attr.Type{ - "attempt_number": types.Int64Type, + "attempt_number": types.Int64Type, + "clean_rooms_notebook_task": basetypes.ListType{ + ElemType: CleanRoomsNotebookTask{}.Type(ctx), + }, "cleanup_duration": types.Int64Type, "cluster_instance": basetypes.ListType{ ElemType: ClusterInstance{}.Type(ctx), @@ -11304,6 +11404,32 @@ func (o RunTask) Type(ctx context.Context) attr.Type { } } +// GetCleanRoomsNotebookTask returns the value of the CleanRoomsNotebookTask field in RunTask as +// a CleanRoomsNotebookTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *RunTask) GetCleanRoomsNotebookTask(ctx context.Context) (CleanRoomsNotebookTask, bool) { + var e CleanRoomsNotebookTask + if o.CleanRoomsNotebookTask.IsNull() || o.CleanRoomsNotebookTask.IsUnknown() { + return e, false + } + var v []CleanRoomsNotebookTask + d := o.CleanRoomsNotebookTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCleanRoomsNotebookTask sets the value of the CleanRoomsNotebookTask field in RunTask. +func (o *RunTask) SetCleanRoomsNotebookTask(ctx context.Context, v CleanRoomsNotebookTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["clean_rooms_notebook_task"] + o.CleanRoomsNotebookTask = types.ListValueMust(t, vs) +} + // GetClusterInstance returns the value of the ClusterInstance field in RunTask as // a ClusterInstance value. // If the field is unknown or null, the boolean return value is false. @@ -13700,6 +13826,11 @@ func (o SubmitRunResponse) Type(ctx context.Context) attr.Type { } type SubmitTask struct { + // The task runs a [clean rooms] notebook when the + // `clean_rooms_notebook_task` field is present. + // + // [clean rooms]: https://docs.databricks.com/en/clean-rooms/index.html + CleanRoomsNotebookTask types.List `tfsdk:"clean_rooms_notebook_task" tf:"optional,object"` // The task evaluates a condition that can be used to control the execution // of other tasks when the `condition_task` field is present. The condition // task does not require a cluster to execute and does not support retries @@ -13814,24 +13945,25 @@ func (newState *SubmitTask) SyncEffectiveFieldsDuringRead(existingState SubmitTa // SDK values. func (a SubmitTask) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { return map[string]reflect.Type{ - "condition_task": reflect.TypeOf(ConditionTask{}), - "dbt_task": reflect.TypeOf(DbtTask{}), - "depends_on": reflect.TypeOf(TaskDependency{}), - "email_notifications": reflect.TypeOf(JobEmailNotifications{}), - "for_each_task": reflect.TypeOf(ForEachTask{}), - "health": reflect.TypeOf(JobsHealthRules{}), - "library": reflect.TypeOf(compute_tf.Library{}), - "new_cluster": reflect.TypeOf(compute_tf.ClusterSpec{}), - "notebook_task": reflect.TypeOf(NotebookTask{}), - "notification_settings": reflect.TypeOf(TaskNotificationSettings{}), - "pipeline_task": reflect.TypeOf(PipelineTask{}), - "python_wheel_task": reflect.TypeOf(PythonWheelTask{}), - "run_job_task": reflect.TypeOf(RunJobTask{}), - "spark_jar_task": reflect.TypeOf(SparkJarTask{}), - "spark_python_task": reflect.TypeOf(SparkPythonTask{}), - "spark_submit_task": reflect.TypeOf(SparkSubmitTask{}), - "sql_task": reflect.TypeOf(SqlTask{}), - "webhook_notifications": reflect.TypeOf(WebhookNotifications{}), + "clean_rooms_notebook_task": reflect.TypeOf(CleanRoomsNotebookTask{}), + "condition_task": reflect.TypeOf(ConditionTask{}), + "dbt_task": reflect.TypeOf(DbtTask{}), + "depends_on": reflect.TypeOf(TaskDependency{}), + "email_notifications": reflect.TypeOf(JobEmailNotifications{}), + "for_each_task": reflect.TypeOf(ForEachTask{}), + "health": reflect.TypeOf(JobsHealthRules{}), + "library": reflect.TypeOf(compute_tf.Library{}), + "new_cluster": reflect.TypeOf(compute_tf.ClusterSpec{}), + "notebook_task": reflect.TypeOf(NotebookTask{}), + "notification_settings": reflect.TypeOf(TaskNotificationSettings{}), + "pipeline_task": reflect.TypeOf(PipelineTask{}), + "python_wheel_task": reflect.TypeOf(PythonWheelTask{}), + "run_job_task": reflect.TypeOf(RunJobTask{}), + "spark_jar_task": reflect.TypeOf(SparkJarTask{}), + "spark_python_task": reflect.TypeOf(SparkPythonTask{}), + "spark_submit_task": reflect.TypeOf(SparkSubmitTask{}), + "sql_task": reflect.TypeOf(SqlTask{}), + "webhook_notifications": reflect.TypeOf(WebhookNotifications{}), } } @@ -13842,30 +13974,31 @@ func (o SubmitTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { return types.ObjectValueMust( o.Type(ctx).(basetypes.ObjectType).AttrTypes, map[string]attr.Value{ - "condition_task": o.ConditionTask, - "dbt_task": o.DbtTask, - "depends_on": o.DependsOn, - "description": o.Description, - "email_notifications": o.EmailNotifications, - "environment_key": o.EnvironmentKey, - "existing_cluster_id": o.ExistingClusterId, - "for_each_task": o.ForEachTask, - "health": o.Health, - "library": o.Libraries, - "new_cluster": o.NewCluster, - "notebook_task": o.NotebookTask, - "notification_settings": o.NotificationSettings, - "pipeline_task": o.PipelineTask, - "python_wheel_task": o.PythonWheelTask, - "run_if": o.RunIf, - "run_job_task": o.RunJobTask, - "spark_jar_task": o.SparkJarTask, - "spark_python_task": o.SparkPythonTask, - "spark_submit_task": o.SparkSubmitTask, - "sql_task": o.SqlTask, - "task_key": o.TaskKey, - "timeout_seconds": o.TimeoutSeconds, - "webhook_notifications": o.WebhookNotifications, + "clean_rooms_notebook_task": o.CleanRoomsNotebookTask, + "condition_task": o.ConditionTask, + "dbt_task": o.DbtTask, + "depends_on": o.DependsOn, + "description": o.Description, + "email_notifications": o.EmailNotifications, + "environment_key": o.EnvironmentKey, + "existing_cluster_id": o.ExistingClusterId, + "for_each_task": o.ForEachTask, + "health": o.Health, + "library": o.Libraries, + "new_cluster": o.NewCluster, + "notebook_task": o.NotebookTask, + "notification_settings": o.NotificationSettings, + "pipeline_task": o.PipelineTask, + "python_wheel_task": o.PythonWheelTask, + "run_if": o.RunIf, + "run_job_task": o.RunJobTask, + "spark_jar_task": o.SparkJarTask, + "spark_python_task": o.SparkPythonTask, + "spark_submit_task": o.SparkSubmitTask, + "sql_task": o.SqlTask, + "task_key": o.TaskKey, + "timeout_seconds": o.TimeoutSeconds, + "webhook_notifications": o.WebhookNotifications, }) } @@ -13873,6 +14006,9 @@ func (o SubmitTask) ToObjectValue(ctx context.Context) basetypes.ObjectValue { func (o SubmitTask) Type(ctx context.Context) attr.Type { return types.ObjectType{ AttrTypes: map[string]attr.Type{ + "clean_rooms_notebook_task": basetypes.ListType{ + ElemType: CleanRoomsNotebookTask{}.Type(ctx), + }, "condition_task": basetypes.ListType{ ElemType: ConditionTask{}.Type(ctx), }, @@ -13937,6 +14073,32 @@ func (o SubmitTask) Type(ctx context.Context) attr.Type { } } +// GetCleanRoomsNotebookTask returns the value of the CleanRoomsNotebookTask field in SubmitTask as +// a CleanRoomsNotebookTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *SubmitTask) GetCleanRoomsNotebookTask(ctx context.Context) (CleanRoomsNotebookTask, bool) { + var e CleanRoomsNotebookTask + if o.CleanRoomsNotebookTask.IsNull() || o.CleanRoomsNotebookTask.IsUnknown() { + return e, false + } + var v []CleanRoomsNotebookTask + d := o.CleanRoomsNotebookTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCleanRoomsNotebookTask sets the value of the CleanRoomsNotebookTask field in SubmitTask. +func (o *SubmitTask) SetCleanRoomsNotebookTask(ctx context.Context, v CleanRoomsNotebookTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["clean_rooms_notebook_task"] + o.CleanRoomsNotebookTask = types.ListValueMust(t, vs) +} + // GetConditionTask returns the value of the ConditionTask field in SubmitTask as // a ConditionTask value. // If the field is unknown or null, the boolean return value is false. @@ -14496,6 +14658,11 @@ func (o *TableUpdateTriggerConfiguration) SetTableNames(ctx context.Context, v [ } type Task struct { + // The task runs a [clean rooms] notebook when the + // `clean_rooms_notebook_task` field is present. + // + // [clean rooms]: https://docs.databricks.com/en/clean-rooms/index.html + CleanRoomsNotebookTask types.List `tfsdk:"clean_rooms_notebook_task" tf:"optional,object"` // The task evaluates a condition that can be used to control the execution // of other tasks when the `condition_task` field is present. The condition // task does not require a cluster to execute and does not support retries @@ -14633,24 +14800,25 @@ func (newState *Task) SyncEffectiveFieldsDuringRead(existingState Task) { // SDK values. func (a Task) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { return map[string]reflect.Type{ - "condition_task": reflect.TypeOf(ConditionTask{}), - "dbt_task": reflect.TypeOf(DbtTask{}), - "depends_on": reflect.TypeOf(TaskDependency{}), - "email_notifications": reflect.TypeOf(TaskEmailNotifications{}), - "for_each_task": reflect.TypeOf(ForEachTask{}), - "health": reflect.TypeOf(JobsHealthRules{}), - "library": reflect.TypeOf(compute_tf.Library{}), - "new_cluster": reflect.TypeOf(compute_tf.ClusterSpec{}), - "notebook_task": reflect.TypeOf(NotebookTask{}), - "notification_settings": reflect.TypeOf(TaskNotificationSettings{}), - "pipeline_task": reflect.TypeOf(PipelineTask{}), - "python_wheel_task": reflect.TypeOf(PythonWheelTask{}), - "run_job_task": reflect.TypeOf(RunJobTask{}), - "spark_jar_task": reflect.TypeOf(SparkJarTask{}), - "spark_python_task": reflect.TypeOf(SparkPythonTask{}), - "spark_submit_task": reflect.TypeOf(SparkSubmitTask{}), - "sql_task": reflect.TypeOf(SqlTask{}), - "webhook_notifications": reflect.TypeOf(WebhookNotifications{}), + "clean_rooms_notebook_task": reflect.TypeOf(CleanRoomsNotebookTask{}), + "condition_task": reflect.TypeOf(ConditionTask{}), + "dbt_task": reflect.TypeOf(DbtTask{}), + "depends_on": reflect.TypeOf(TaskDependency{}), + "email_notifications": reflect.TypeOf(TaskEmailNotifications{}), + "for_each_task": reflect.TypeOf(ForEachTask{}), + "health": reflect.TypeOf(JobsHealthRules{}), + "library": reflect.TypeOf(compute_tf.Library{}), + "new_cluster": reflect.TypeOf(compute_tf.ClusterSpec{}), + "notebook_task": reflect.TypeOf(NotebookTask{}), + "notification_settings": reflect.TypeOf(TaskNotificationSettings{}), + "pipeline_task": reflect.TypeOf(PipelineTask{}), + "python_wheel_task": reflect.TypeOf(PythonWheelTask{}), + "run_job_task": reflect.TypeOf(RunJobTask{}), + "spark_jar_task": reflect.TypeOf(SparkJarTask{}), + "spark_python_task": reflect.TypeOf(SparkPythonTask{}), + "spark_submit_task": reflect.TypeOf(SparkSubmitTask{}), + "sql_task": reflect.TypeOf(SqlTask{}), + "webhook_notifications": reflect.TypeOf(WebhookNotifications{}), } } @@ -14661,6 +14829,7 @@ func (o Task) ToObjectValue(ctx context.Context) basetypes.ObjectValue { return types.ObjectValueMust( o.Type(ctx).(basetypes.ObjectType).AttrTypes, map[string]attr.Value{ + "clean_rooms_notebook_task": o.CleanRoomsNotebookTask, "condition_task": o.ConditionTask, "dbt_task": o.DbtTask, "depends_on": o.DependsOn, @@ -14697,6 +14866,9 @@ func (o Task) ToObjectValue(ctx context.Context) basetypes.ObjectValue { func (o Task) Type(ctx context.Context) attr.Type { return types.ObjectType{ AttrTypes: map[string]attr.Type{ + "clean_rooms_notebook_task": basetypes.ListType{ + ElemType: CleanRoomsNotebookTask{}.Type(ctx), + }, "condition_task": basetypes.ListType{ ElemType: ConditionTask{}.Type(ctx), }, @@ -14766,6 +14938,32 @@ func (o Task) Type(ctx context.Context) attr.Type { } } +// GetCleanRoomsNotebookTask returns the value of the CleanRoomsNotebookTask field in Task as +// a CleanRoomsNotebookTask value. +// If the field is unknown or null, the boolean return value is false. +func (o *Task) GetCleanRoomsNotebookTask(ctx context.Context) (CleanRoomsNotebookTask, bool) { + var e CleanRoomsNotebookTask + if o.CleanRoomsNotebookTask.IsNull() || o.CleanRoomsNotebookTask.IsUnknown() { + return e, false + } + var v []CleanRoomsNotebookTask + d := o.CleanRoomsNotebookTask.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetCleanRoomsNotebookTask sets the value of the CleanRoomsNotebookTask field in Task. +func (o *Task) SetCleanRoomsNotebookTask(ctx context.Context, v CleanRoomsNotebookTask) { + vs := []attr.Value{v.ToObjectValue(ctx)} + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["clean_rooms_notebook_task"] + o.CleanRoomsNotebookTask = types.ListValueMust(t, vs) +} + // GetConditionTask returns the value of the ConditionTask field in Task as // a ConditionTask value. // If the field is unknown or null, the boolean return value is false. diff --git a/internal/service/oauth2_tf/model.go b/internal/service/oauth2_tf/model.go index e2e8defbdf..a9562ec7b0 100755 --- a/internal/service/oauth2_tf/model.go +++ b/internal/service/oauth2_tf/model.go @@ -21,6 +21,83 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types/basetypes" ) +// Create account federation policy +type CreateAccountFederationPolicyRequest struct { + Policy types.Object `tfsdk:"policy" tf:"optional,object"` + // The identifier for the federation policy. If unspecified, the id will be + // assigned by Databricks. + PolicyId types.String `tfsdk:"-"` +} + +func (newState *CreateAccountFederationPolicyRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateAccountFederationPolicyRequest) { +} + +func (newState *CreateAccountFederationPolicyRequest) SyncEffectiveFieldsDuringRead(existingState CreateAccountFederationPolicyRequest) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateAccountFederationPolicyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateAccountFederationPolicyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "policy": reflect.TypeOf(FederationPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateAccountFederationPolicyRequest +// only implements ToObjectValue() and Type(). +func (o CreateAccountFederationPolicyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "policy": o.Policy, + "policy_id": o.PolicyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateAccountFederationPolicyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "policy": FederationPolicy{}.Type(ctx), + "policy_id": types.StringType, + }, + } +} + +// GetPolicy returns the value of the Policy field in CreateAccountFederationPolicyRequest as +// a FederationPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateAccountFederationPolicyRequest) GetPolicy(ctx context.Context) (FederationPolicy, bool) { + var e FederationPolicy + if o.Policy.IsNull() || o.Policy.IsUnknown() { + return e, false + } + var v []FederationPolicy + d := o.Policy.As(ctx, &v, basetypes.ObjectAsOptions{ + UnhandledNullAsEmpty: true, + UnhandledUnknownAsEmpty: true, + }) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPolicy sets the value of the Policy field in CreateAccountFederationPolicyRequest. +func (o *CreateAccountFederationPolicyRequest) SetPolicy(ctx context.Context, v FederationPolicy) { + vs := v.ToObjectValue(ctx) + o.Policy = vs +} + type CreateCustomAppIntegration struct { // This field indicates whether an OAuth client secret is required to // authenticate this client. @@ -339,6 +416,87 @@ func (o CreatePublishedAppIntegrationOutput) Type(ctx context.Context) attr.Type } } +// Create service principal federation policy +type CreateServicePrincipalFederationPolicyRequest struct { + Policy types.Object `tfsdk:"policy" tf:"optional,object"` + // The identifier for the federation policy. If unspecified, the id will be + // assigned by Databricks. + PolicyId types.String `tfsdk:"-"` + // The service principal id for the federation policy. + ServicePrincipalId types.Int64 `tfsdk:"-"` +} + +func (newState *CreateServicePrincipalFederationPolicyRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan CreateServicePrincipalFederationPolicyRequest) { +} + +func (newState *CreateServicePrincipalFederationPolicyRequest) SyncEffectiveFieldsDuringRead(existingState CreateServicePrincipalFederationPolicyRequest) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in CreateServicePrincipalFederationPolicyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a CreateServicePrincipalFederationPolicyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "policy": reflect.TypeOf(FederationPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, CreateServicePrincipalFederationPolicyRequest +// only implements ToObjectValue() and Type(). +func (o CreateServicePrincipalFederationPolicyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "policy": o.Policy, + "policy_id": o.PolicyId, + "service_principal_id": o.ServicePrincipalId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o CreateServicePrincipalFederationPolicyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "policy": FederationPolicy{}.Type(ctx), + "policy_id": types.StringType, + "service_principal_id": types.Int64Type, + }, + } +} + +// GetPolicy returns the value of the Policy field in CreateServicePrincipalFederationPolicyRequest as +// a FederationPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *CreateServicePrincipalFederationPolicyRequest) GetPolicy(ctx context.Context) (FederationPolicy, bool) { + var e FederationPolicy + if o.Policy.IsNull() || o.Policy.IsUnknown() { + return e, false + } + var v []FederationPolicy + d := o.Policy.As(ctx, &v, basetypes.ObjectAsOptions{ + UnhandledNullAsEmpty: true, + UnhandledUnknownAsEmpty: true, + }) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPolicy sets the value of the Policy field in CreateServicePrincipalFederationPolicyRequest. +func (o *CreateServicePrincipalFederationPolicyRequest) SetPolicy(ctx context.Context, v FederationPolicy) { + vs := v.ToObjectValue(ctx) + o.Policy = vs +} + // Create service principal secret type CreateServicePrincipalSecretRequest struct { // The service principal ID. @@ -490,6 +648,48 @@ func (o DataPlaneInfo) Type(ctx context.Context) attr.Type { } } +// Delete account federation policy +type DeleteAccountFederationPolicyRequest struct { + PolicyId types.String `tfsdk:"-"` +} + +func (newState *DeleteAccountFederationPolicyRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan DeleteAccountFederationPolicyRequest) { +} + +func (newState *DeleteAccountFederationPolicyRequest) SyncEffectiveFieldsDuringRead(existingState DeleteAccountFederationPolicyRequest) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteAccountFederationPolicyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteAccountFederationPolicyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteAccountFederationPolicyRequest +// only implements ToObjectValue() and Type(). +func (o DeleteAccountFederationPolicyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "policy_id": o.PolicyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteAccountFederationPolicyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "policy_id": types.StringType, + }, + } +} + type DeleteCustomAppIntegrationOutput struct { } @@ -682,6 +882,52 @@ func (o DeleteResponse) Type(ctx context.Context) attr.Type { } } +// Delete service principal federation policy +type DeleteServicePrincipalFederationPolicyRequest struct { + PolicyId types.String `tfsdk:"-"` + // The service principal id for the federation policy. + ServicePrincipalId types.Int64 `tfsdk:"-"` +} + +func (newState *DeleteServicePrincipalFederationPolicyRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan DeleteServicePrincipalFederationPolicyRequest) { +} + +func (newState *DeleteServicePrincipalFederationPolicyRequest) SyncEffectiveFieldsDuringRead(existingState DeleteServicePrincipalFederationPolicyRequest) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in DeleteServicePrincipalFederationPolicyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a DeleteServicePrincipalFederationPolicyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, DeleteServicePrincipalFederationPolicyRequest +// only implements ToObjectValue() and Type(). +func (o DeleteServicePrincipalFederationPolicyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "policy_id": o.PolicyId, + "service_principal_id": o.ServicePrincipalId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o DeleteServicePrincipalFederationPolicyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "policy_id": types.StringType, + "service_principal_id": types.Int64Type, + }, + } +} + // Delete service principal secret type DeleteServicePrincipalSecretRequest struct { // The secret ID. @@ -729,6 +975,143 @@ func (o DeleteServicePrincipalSecretRequest) Type(ctx context.Context) attr.Type } } +type FederationPolicy struct { + // Creation time of the federation policy. + CreateTime types.String `tfsdk:"create_time" tf:"computed"` + // Description of the federation policy. + Description types.String `tfsdk:"description" tf:"optional"` + // Name of the federation policy. The name must contain only lowercase + // alphanumeric characters, numbers, and hyphens. It must be unique within + // the account. + Name types.String `tfsdk:"name" tf:"optional"` + // Specifies the policy to use for validating OIDC claims in your federated + // tokens. + OidcPolicy types.Object `tfsdk:"oidc_policy" tf:"optional,object"` + // Unique, immutable id of the federation policy. + Uid types.String `tfsdk:"uid" tf:"computed"` + // Last update time of the federation policy. + UpdateTime types.String `tfsdk:"update_time" tf:"computed"` +} + +func (newState *FederationPolicy) SyncEffectiveFieldsDuringCreateOrUpdate(plan FederationPolicy) { +} + +func (newState *FederationPolicy) SyncEffectiveFieldsDuringRead(existingState FederationPolicy) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in FederationPolicy. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a FederationPolicy) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "oidc_policy": reflect.TypeOf(OidcFederationPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, FederationPolicy +// only implements ToObjectValue() and Type(). +func (o FederationPolicy) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "create_time": o.CreateTime, + "description": o.Description, + "name": o.Name, + "oidc_policy": o.OidcPolicy, + "uid": o.Uid, + "update_time": o.UpdateTime, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o FederationPolicy) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "create_time": types.StringType, + "description": types.StringType, + "name": types.StringType, + "oidc_policy": OidcFederationPolicy{}.Type(ctx), + "uid": types.StringType, + "update_time": types.StringType, + }, + } +} + +// GetOidcPolicy returns the value of the OidcPolicy field in FederationPolicy as +// a OidcFederationPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *FederationPolicy) GetOidcPolicy(ctx context.Context) (OidcFederationPolicy, bool) { + var e OidcFederationPolicy + if o.OidcPolicy.IsNull() || o.OidcPolicy.IsUnknown() { + return e, false + } + var v []OidcFederationPolicy + d := o.OidcPolicy.As(ctx, &v, basetypes.ObjectAsOptions{ + UnhandledNullAsEmpty: true, + UnhandledUnknownAsEmpty: true, + }) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetOidcPolicy sets the value of the OidcPolicy field in FederationPolicy. +func (o *FederationPolicy) SetOidcPolicy(ctx context.Context, v OidcFederationPolicy) { + vs := v.ToObjectValue(ctx) + o.OidcPolicy = vs +} + +// Get account federation policy +type GetAccountFederationPolicyRequest struct { + PolicyId types.String `tfsdk:"-"` +} + +func (newState *GetAccountFederationPolicyRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetAccountFederationPolicyRequest) { +} + +func (newState *GetAccountFederationPolicyRequest) SyncEffectiveFieldsDuringRead(existingState GetAccountFederationPolicyRequest) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetAccountFederationPolicyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a GetAccountFederationPolicyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetAccountFederationPolicyRequest +// only implements ToObjectValue() and Type(). +func (o GetAccountFederationPolicyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "policy_id": o.PolicyId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o GetAccountFederationPolicyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "policy_id": types.StringType, + }, + } +} + type GetCustomAppIntegrationOutput struct { // The client id of the custom OAuth app ClientId types.String `tfsdk:"client_id" tf:"optional"` @@ -1302,47 +1685,139 @@ func (o *GetPublishedAppsOutput) SetApps(ctx context.Context, v []PublishedAppOu o.Apps = types.ListValueMust(t, vs) } -// Get custom oauth app integrations -type ListCustomAppIntegrationsRequest struct { - IncludeCreatorUsername types.Bool `tfsdk:"-"` - - PageSize types.Int64 `tfsdk:"-"` - - PageToken types.String `tfsdk:"-"` +// Get service principal federation policy +type GetServicePrincipalFederationPolicyRequest struct { + PolicyId types.String `tfsdk:"-"` + // The service principal id for the federation policy. + ServicePrincipalId types.Int64 `tfsdk:"-"` } -func (newState *ListCustomAppIntegrationsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListCustomAppIntegrationsRequest) { +func (newState *GetServicePrincipalFederationPolicyRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan GetServicePrincipalFederationPolicyRequest) { } -func (newState *ListCustomAppIntegrationsRequest) SyncEffectiveFieldsDuringRead(existingState ListCustomAppIntegrationsRequest) { +func (newState *GetServicePrincipalFederationPolicyRequest) SyncEffectiveFieldsDuringRead(existingState GetServicePrincipalFederationPolicyRequest) { } -// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListCustomAppIntegrationsRequest. +// GetComplexFieldTypes returns a map of the types of elements in complex fields in GetServicePrincipalFederationPolicyRequest. // Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry // the type information of their elements in the Go type system. This function provides a way to // retrieve the type information of the elements in complex fields at runtime. The values of the map // are the reflected types of the contained elements. They must be either primitive values from the // plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF // SDK values. -func (a ListCustomAppIntegrationsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { +func (a GetServicePrincipalFederationPolicyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { return map[string]reflect.Type{} } // TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise -// interfere with how the plugin framework retrieves and sets values in state. Thus, ListCustomAppIntegrationsRequest +// interfere with how the plugin framework retrieves and sets values in state. Thus, GetServicePrincipalFederationPolicyRequest // only implements ToObjectValue() and Type(). -func (o ListCustomAppIntegrationsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { +func (o GetServicePrincipalFederationPolicyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { return types.ObjectValueMust( o.Type(ctx).(basetypes.ObjectType).AttrTypes, map[string]attr.Value{ - "include_creator_username": o.IncludeCreatorUsername, - "page_size": o.PageSize, - "page_token": o.PageToken, + "policy_id": o.PolicyId, + "service_principal_id": o.ServicePrincipalId, }) } // Type implements basetypes.ObjectValuable. -func (o ListCustomAppIntegrationsRequest) Type(ctx context.Context) attr.Type { +func (o GetServicePrincipalFederationPolicyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "policy_id": types.StringType, + "service_principal_id": types.Int64Type, + }, + } +} + +// List account federation policies +type ListAccountFederationPoliciesRequest struct { + PageSize types.Int64 `tfsdk:"-"` + + PageToken types.String `tfsdk:"-"` +} + +func (newState *ListAccountFederationPoliciesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListAccountFederationPoliciesRequest) { +} + +func (newState *ListAccountFederationPoliciesRequest) SyncEffectiveFieldsDuringRead(existingState ListAccountFederationPoliciesRequest) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListAccountFederationPoliciesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListAccountFederationPoliciesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListAccountFederationPoliciesRequest +// only implements ToObjectValue() and Type(). +func (o ListAccountFederationPoliciesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListAccountFederationPoliciesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + }, + } +} + +// Get custom oauth app integrations +type ListCustomAppIntegrationsRequest struct { + IncludeCreatorUsername types.Bool `tfsdk:"-"` + + PageSize types.Int64 `tfsdk:"-"` + + PageToken types.String `tfsdk:"-"` +} + +func (newState *ListCustomAppIntegrationsRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListCustomAppIntegrationsRequest) { +} + +func (newState *ListCustomAppIntegrationsRequest) SyncEffectiveFieldsDuringRead(existingState ListCustomAppIntegrationsRequest) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListCustomAppIntegrationsRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListCustomAppIntegrationsRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListCustomAppIntegrationsRequest +// only implements ToObjectValue() and Type(). +func (o ListCustomAppIntegrationsRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "include_creator_username": o.IncludeCreatorUsername, + "page_size": o.PageSize, + "page_token": o.PageToken, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListCustomAppIntegrationsRequest) Type(ctx context.Context) attr.Type { return types.ObjectType{ AttrTypes: map[string]attr.Type{ "include_creator_username": types.BoolType, @@ -1352,6 +1827,81 @@ func (o ListCustomAppIntegrationsRequest) Type(ctx context.Context) attr.Type { } } +type ListFederationPoliciesResponse struct { + NextPageToken types.String `tfsdk:"next_page_token" tf:"optional"` + + Policies types.List `tfsdk:"policies" tf:"optional"` +} + +func (newState *ListFederationPoliciesResponse) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListFederationPoliciesResponse) { +} + +func (newState *ListFederationPoliciesResponse) SyncEffectiveFieldsDuringRead(existingState ListFederationPoliciesResponse) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListFederationPoliciesResponse. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListFederationPoliciesResponse) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "policies": reflect.TypeOf(FederationPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListFederationPoliciesResponse +// only implements ToObjectValue() and Type(). +func (o ListFederationPoliciesResponse) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "next_page_token": o.NextPageToken, + "policies": o.Policies, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListFederationPoliciesResponse) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "next_page_token": types.StringType, + "policies": basetypes.ListType{ + ElemType: FederationPolicy{}.Type(ctx), + }, + }, + } +} + +// GetPolicies returns the value of the Policies field in ListFederationPoliciesResponse as +// a slice of FederationPolicy values. +// If the field is unknown or null, the boolean return value is false. +func (o *ListFederationPoliciesResponse) GetPolicies(ctx context.Context) ([]FederationPolicy, bool) { + if o.Policies.IsNull() || o.Policies.IsUnknown() { + return nil, false + } + var v []FederationPolicy + d := o.Policies.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetPolicies sets the value of the Policies field in ListFederationPoliciesResponse. +func (o *ListFederationPoliciesResponse) SetPolicies(ctx context.Context, v []FederationPolicy) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e.ToObjectValue(ctx)) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["policies"] + t = t.(attr.TypeWithElementType).ElementType() + o.Policies = types.ListValueMust(t, vs) +} + // Get all the published OAuth apps type ListOAuthPublishedAppsRequest struct { // The max number of OAuth published apps to return in one page. @@ -1445,6 +1995,56 @@ func (o ListPublishedAppIntegrationsRequest) Type(ctx context.Context) attr.Type } } +// List service principal federation policies +type ListServicePrincipalFederationPoliciesRequest struct { + PageSize types.Int64 `tfsdk:"-"` + + PageToken types.String `tfsdk:"-"` + // The service principal id for the federation policy. + ServicePrincipalId types.Int64 `tfsdk:"-"` +} + +func (newState *ListServicePrincipalFederationPoliciesRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan ListServicePrincipalFederationPoliciesRequest) { +} + +func (newState *ListServicePrincipalFederationPoliciesRequest) SyncEffectiveFieldsDuringRead(existingState ListServicePrincipalFederationPoliciesRequest) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in ListServicePrincipalFederationPoliciesRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a ListServicePrincipalFederationPoliciesRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{} +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, ListServicePrincipalFederationPoliciesRequest +// only implements ToObjectValue() and Type(). +func (o ListServicePrincipalFederationPoliciesRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "page_size": o.PageSize, + "page_token": o.PageToken, + "service_principal_id": o.ServicePrincipalId, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o ListServicePrincipalFederationPoliciesRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "page_size": types.Int64Type, + "page_token": types.StringType, + "service_principal_id": types.Int64Type, + }, + } +} + // List service principal secrets type ListServicePrincipalSecretsRequest struct { // An opaque page token which was the `next_page_token` in the response of @@ -1576,6 +2176,109 @@ func (o *ListServicePrincipalSecretsResponse) SetSecrets(ctx context.Context, v o.Secrets = types.ListValueMust(t, vs) } +// Specifies the policy to use for validating OIDC claims in your federated +// tokens. +type OidcFederationPolicy struct { + // The allowed token audiences, as specified in the 'aud' claim of federated + // tokens. The audience identifier is intended to represent the recipient of + // the token. Can be any non-empty string value. As long as the audience in + // the token matches at least one audience in the policy, the token is + // considered a match. If audiences is unspecified, defaults to your + // Databricks account id. + Audiences types.List `tfsdk:"audiences" tf:"optional"` + // The required token issuer, as specified in the 'iss' claim of federated + // tokens. + Issuer types.String `tfsdk:"issuer" tf:"optional"` + // The public keys used to validate the signature of federated tokens, in + // JWKS format. If unspecified (recommended), Databricks automatically + // fetches the public keys from your issuer’s well known endpoint. + // Databricks strongly recommends relying on your issuer’s well known + // endpoint for discovering public keys. + JwksJson types.String `tfsdk:"jwks_json" tf:"optional"` + // The required token subject, as specified in the subject claim of + // federated tokens. Must be specified for service principal federation + // policies. Must not be specified for account federation policies. + Subject types.String `tfsdk:"subject" tf:"optional"` + // The claim that contains the subject of the token. If unspecified, the + // default value is 'sub'. + SubjectClaim types.String `tfsdk:"subject_claim" tf:"optional"` +} + +func (newState *OidcFederationPolicy) SyncEffectiveFieldsDuringCreateOrUpdate(plan OidcFederationPolicy) { +} + +func (newState *OidcFederationPolicy) SyncEffectiveFieldsDuringRead(existingState OidcFederationPolicy) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in OidcFederationPolicy. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a OidcFederationPolicy) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "audiences": reflect.TypeOf(types.String{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, OidcFederationPolicy +// only implements ToObjectValue() and Type(). +func (o OidcFederationPolicy) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "audiences": o.Audiences, + "issuer": o.Issuer, + "jwks_json": o.JwksJson, + "subject": o.Subject, + "subject_claim": o.SubjectClaim, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o OidcFederationPolicy) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "audiences": basetypes.ListType{ + ElemType: types.StringType, + }, + "issuer": types.StringType, + "jwks_json": types.StringType, + "subject": types.StringType, + "subject_claim": types.StringType, + }, + } +} + +// GetAudiences returns the value of the Audiences field in OidcFederationPolicy as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *OidcFederationPolicy) GetAudiences(ctx context.Context) ([]types.String, bool) { + if o.Audiences.IsNull() || o.Audiences.IsUnknown() { + return nil, false + } + var v []types.String + d := o.Audiences.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetAudiences sets the value of the Audiences field in OidcFederationPolicy. +func (o *OidcFederationPolicy) SetAudiences(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["audiences"] + t = t.(attr.TypeWithElementType).ElementType() + o.Audiences = types.ListValueMust(t, vs) +} + type PublishedAppOutput struct { // Unique ID of the published OAuth app. AppId types.String `tfsdk:"app_id" tf:"optional"` @@ -1807,6 +2510,89 @@ func (o TokenAccessPolicy) Type(ctx context.Context) attr.Type { } } +// Update account federation policy +type UpdateAccountFederationPolicyRequest struct { + Policy types.Object `tfsdk:"policy" tf:"optional,object"` + + PolicyId types.String `tfsdk:"-"` + // Field mask is required to be passed into the PATCH request. Field mask + // specifies which fields of the setting payload will be updated. The field + // mask needs to be supplied as single string. To specify multiple fields in + // the field mask, use comma as the separator (no space). + UpdateMask types.String `tfsdk:"-"` +} + +func (newState *UpdateAccountFederationPolicyRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateAccountFederationPolicyRequest) { +} + +func (newState *UpdateAccountFederationPolicyRequest) SyncEffectiveFieldsDuringRead(existingState UpdateAccountFederationPolicyRequest) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateAccountFederationPolicyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateAccountFederationPolicyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "policy": reflect.TypeOf(FederationPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateAccountFederationPolicyRequest +// only implements ToObjectValue() and Type(). +func (o UpdateAccountFederationPolicyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "policy": o.Policy, + "policy_id": o.PolicyId, + "update_mask": o.UpdateMask, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateAccountFederationPolicyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "policy": FederationPolicy{}.Type(ctx), + "policy_id": types.StringType, + "update_mask": types.StringType, + }, + } +} + +// GetPolicy returns the value of the Policy field in UpdateAccountFederationPolicyRequest as +// a FederationPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateAccountFederationPolicyRequest) GetPolicy(ctx context.Context) (FederationPolicy, bool) { + var e FederationPolicy + if o.Policy.IsNull() || o.Policy.IsUnknown() { + return e, false + } + var v []FederationPolicy + d := o.Policy.As(ctx, &v, basetypes.ObjectAsOptions{ + UnhandledNullAsEmpty: true, + UnhandledUnknownAsEmpty: true, + }) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPolicy sets the value of the Policy field in UpdateAccountFederationPolicyRequest. +func (o *UpdateAccountFederationPolicyRequest) SetPolicy(ctx context.Context, v FederationPolicy) { + vs := v.ToObjectValue(ctx) + o.Policy = vs +} + type UpdateCustomAppIntegration struct { IntegrationId types.String `tfsdk:"-"` // List of OAuth redirect urls to be updated in the custom OAuth app @@ -2062,3 +2848,90 @@ func (o UpdatePublishedAppIntegrationOutput) Type(ctx context.Context) attr.Type AttrTypes: map[string]attr.Type{}, } } + +// Update service principal federation policy +type UpdateServicePrincipalFederationPolicyRequest struct { + Policy types.Object `tfsdk:"policy" tf:"optional,object"` + + PolicyId types.String `tfsdk:"-"` + // The service principal id for the federation policy. + ServicePrincipalId types.Int64 `tfsdk:"-"` + // Field mask is required to be passed into the PATCH request. Field mask + // specifies which fields of the setting payload will be updated. The field + // mask needs to be supplied as single string. To specify multiple fields in + // the field mask, use comma as the separator (no space). + UpdateMask types.String `tfsdk:"-"` +} + +func (newState *UpdateServicePrincipalFederationPolicyRequest) SyncEffectiveFieldsDuringCreateOrUpdate(plan UpdateServicePrincipalFederationPolicyRequest) { +} + +func (newState *UpdateServicePrincipalFederationPolicyRequest) SyncEffectiveFieldsDuringRead(existingState UpdateServicePrincipalFederationPolicyRequest) { +} + +// GetComplexFieldTypes returns a map of the types of elements in complex fields in UpdateServicePrincipalFederationPolicyRequest. +// Container types (types.Map, types.List, types.Set) and object types (types.Object) do not carry +// the type information of their elements in the Go type system. This function provides a way to +// retrieve the type information of the elements in complex fields at runtime. The values of the map +// are the reflected types of the contained elements. They must be either primitive values from the +// plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF +// SDK values. +func (a UpdateServicePrincipalFederationPolicyRequest) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { + return map[string]reflect.Type{ + "policy": reflect.TypeOf(FederationPolicy{}), + } +} + +// TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise +// interfere with how the plugin framework retrieves and sets values in state. Thus, UpdateServicePrincipalFederationPolicyRequest +// only implements ToObjectValue() and Type(). +func (o UpdateServicePrincipalFederationPolicyRequest) ToObjectValue(ctx context.Context) basetypes.ObjectValue { + return types.ObjectValueMust( + o.Type(ctx).(basetypes.ObjectType).AttrTypes, + map[string]attr.Value{ + "policy": o.Policy, + "policy_id": o.PolicyId, + "service_principal_id": o.ServicePrincipalId, + "update_mask": o.UpdateMask, + }) +} + +// Type implements basetypes.ObjectValuable. +func (o UpdateServicePrincipalFederationPolicyRequest) Type(ctx context.Context) attr.Type { + return types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "policy": FederationPolicy{}.Type(ctx), + "policy_id": types.StringType, + "service_principal_id": types.Int64Type, + "update_mask": types.StringType, + }, + } +} + +// GetPolicy returns the value of the Policy field in UpdateServicePrincipalFederationPolicyRequest as +// a FederationPolicy value. +// If the field is unknown or null, the boolean return value is false. +func (o *UpdateServicePrincipalFederationPolicyRequest) GetPolicy(ctx context.Context) (FederationPolicy, bool) { + var e FederationPolicy + if o.Policy.IsNull() || o.Policy.IsUnknown() { + return e, false + } + var v []FederationPolicy + d := o.Policy.As(ctx, &v, basetypes.ObjectAsOptions{ + UnhandledNullAsEmpty: true, + UnhandledUnknownAsEmpty: true, + }) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + if len(v) == 0 { + return e, false + } + return v[0], true +} + +// SetPolicy sets the value of the Policy field in UpdateServicePrincipalFederationPolicyRequest. +func (o *UpdateServicePrincipalFederationPolicyRequest) SetPolicy(ctx context.Context, v FederationPolicy) { + vs := v.ToObjectValue(ctx) + o.Policy = vs +} diff --git a/internal/service/pipelines_tf/model.go b/internal/service/pipelines_tf/model.go index 311cb5ccbd..df1086f49f 100755 --- a/internal/service/pipelines_tf/model.go +++ b/internal/service/pipelines_tf/model.go @@ -5014,7 +5014,7 @@ type RestartWindow struct { // Days of week in which the restart is allowed to happen (within a // five-hour window starting at start_hour). If not specified all days of // the week will be used. - DaysOfWeek types.String `tfsdk:"days_of_week" tf:"optional"` + DaysOfWeek types.List `tfsdk:"days_of_week" tf:"optional"` // An integer between 0 and 23 denoting the start hour for the restart // window in the 24-hour day. Continuous pipeline restart is triggered only // within a five-hour window starting at this hour. @@ -5039,7 +5039,9 @@ func (newState *RestartWindow) SyncEffectiveFieldsDuringRead(existingState Resta // plugin framework type system (types.String{}, types.Bool{}, types.Int64{}, types.Float64{}) or TF // SDK values. func (a RestartWindow) GetComplexFieldTypes(ctx context.Context) map[string]reflect.Type { - return map[string]reflect.Type{} + return map[string]reflect.Type{ + "days_of_week": reflect.TypeOf(types.String{}), + } } // TFSDK types cannot implement the ObjectValuable interface directly, as it would otherwise @@ -5059,13 +5061,41 @@ func (o RestartWindow) ToObjectValue(ctx context.Context) basetypes.ObjectValue func (o RestartWindow) Type(ctx context.Context) attr.Type { return types.ObjectType{ AttrTypes: map[string]attr.Type{ - "days_of_week": types.StringType, + "days_of_week": basetypes.ListType{ + ElemType: types.StringType, + }, "start_hour": types.Int64Type, "time_zone_id": types.StringType, }, } } +// GetDaysOfWeek returns the value of the DaysOfWeek field in RestartWindow as +// a slice of types.String values. +// If the field is unknown or null, the boolean return value is false. +func (o *RestartWindow) GetDaysOfWeek(ctx context.Context) ([]types.String, bool) { + if o.DaysOfWeek.IsNull() || o.DaysOfWeek.IsUnknown() { + return nil, false + } + var v []types.String + d := o.DaysOfWeek.ElementsAs(ctx, &v, true) + if d.HasError() { + panic(pluginfwcommon.DiagToString(d)) + } + return v, true +} + +// SetDaysOfWeek sets the value of the DaysOfWeek field in RestartWindow. +func (o *RestartWindow) SetDaysOfWeek(ctx context.Context, v []types.String) { + vs := make([]attr.Value, 0, len(v)) + for _, e := range v { + vs = append(vs, e) + } + t := o.Type(ctx).(basetypes.ObjectType).AttrTypes["days_of_week"] + t = t.(attr.TypeWithElementType).ElementType() + o.DaysOfWeek = types.ListValueMust(t, vs) +} + type SchemaSpec struct { // Required. Destination catalog to store tables. DestinationCatalog types.String `tfsdk:"destination_catalog" tf:"optional"`