From 0688b44fed4c55a265838c4fa3854df9a1691058 Mon Sep 17 00:00:00 2001 From: Dariusz Porowski <3431813+DariuszPorowski@users.noreply.github.com> Date: Thu, 20 Feb 2025 23:04:24 +0100 Subject: [PATCH] docs: add missing examples for kql_database and ml_model (#258) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # 📥 Pull Request ## ❓ What are you trying to address - Add missing examples for `fabric_kql_database` - Add missing examples for `fabric_ml_model` - Misc: standardize pointers for model setters --- .../unreleased/changed-20250214-162024.yaml | 5 +++ .../unreleased/changed-20250214-162108.yaml | 5 +++ docs/data-sources/kql_database.md | 21 ++++++++++ docs/data-sources/notebook.md | 12 +++--- docs/resources/kql_database.md | 39 +++++++++++++++++-- docs/resources/ml_model.md | 18 +++++++++ .../fabric_kql_database/data-source.tf | 21 ++++++++++ .../fabric_notebook/data-source.tf | 12 +++--- .../resources/fabric_eventhouse/providers.tf | 4 ++ .../fabric_kql_database/providers.tf | 4 ++ .../resources/fabric_kql_database/resource.tf | 39 +++++++++++++++++-- examples/resources/fabric_ml_model/import.sh | 2 + examples/resources/fabric_ml_model/outputs.tf | 3 ++ .../resources/fabric_ml_model/providers.tf | 11 ++++++ .../resources/fabric_ml_model/resource.tf | 4 ++ internal/provider/client/logging.go | 3 +- internal/services/environment/models.go | 8 ++-- .../services/kqldatabase/data_kql_database.go | 2 +- .../kqldatabase/data_kql_databases.go | 2 +- internal/services/kqldatabase/models.go | 2 +- .../kqldatabase/resource_kql_database.go | 2 +- internal/services/lakehouse/models.go | 4 +- .../spark/models_spark_custom_pool.go | 8 ++-- .../models_spark_environment_settings.go | 8 ++-- .../spark/models_spark_workspace_settings.go | 24 ++++++------ .../data_spark_job_definition.go | 2 +- .../data_spark_job_definitions.go | 2 +- .../services/sparkjobdefinition/models.go | 2 +- .../resource_spark_job_definition.go | 2 +- internal/services/warehouse/data_warehouse.go | 2 +- .../services/warehouse/data_warehouses.go | 2 +- internal/services/warehouse/models.go | 2 +- .../services/warehouse/resource_warehouse.go | 2 +- internal/services/workspace/models.go | 8 ++-- .../models_data_workspace_role_assignments.go | 4 +- .../workspace/models_workspace_git.go | 4 +- 36 files changed, 227 insertions(+), 68 deletions(-) create mode 100644 .changes/unreleased/changed-20250214-162024.yaml create mode 100644 .changes/unreleased/changed-20250214-162108.yaml create mode 100644 examples/resources/fabric_ml_model/import.sh create mode 100644 examples/resources/fabric_ml_model/outputs.tf create mode 100644 examples/resources/fabric_ml_model/providers.tf create mode 100644 examples/resources/fabric_ml_model/resource.tf diff --git a/.changes/unreleased/changed-20250214-162024.yaml b/.changes/unreleased/changed-20250214-162024.yaml new file mode 100644 index 00000000..f01609f3 --- /dev/null +++ b/.changes/unreleased/changed-20250214-162024.yaml @@ -0,0 +1,5 @@ +kind: changed +body: Added missing example for `fabric_ml_model` resource. +time: 2025-02-14T16:20:24.7564261+01:00 +custom: + Issue: "258" diff --git a/.changes/unreleased/changed-20250214-162108.yaml b/.changes/unreleased/changed-20250214-162108.yaml new file mode 100644 index 00000000..8041c275 --- /dev/null +++ b/.changes/unreleased/changed-20250214-162108.yaml @@ -0,0 +1,5 @@ +kind: changed +body: Added missing example for `fabric_kql_database` resource/data-source. +time: 2025-02-14T16:21:08.4928042+01:00 +custom: + Issue: "258" diff --git a/docs/data-sources/kql_database.md b/docs/data-sources/kql_database.md index a4fac753..d6a3826a 100644 --- a/docs/data-sources/kql_database.md +++ b/docs/data-sources/kql_database.md @@ -19,16 +19,37 @@ Use this data source to fetch a [KQL Database](https://learn.microsoft.com/fabri ## Example Usage ```terraform +# Get item details by id data "fabric_kql_database" "example_by_id" { id = "11111111-1111-1111-1111-111111111111" workspace_id = "00000000-0000-0000-0000-000000000000" } +# Get item details by name data "fabric_kql_database" "example_by_name" { display_name = "example" workspace_id = "00000000-0000-0000-0000-000000000000" } +# Get item details with definition +# Examples uses `id` but `display_name` can be used as well +data "fabric_kql_database" "example_definition" { + id = "11111111-1111-1111-1111-111111111111" + workspace_id = "00000000-0000-0000-0000-000000000000" + format = "Default" + output_definition = true +} + +# Access the content of the definition with JSONPath expression +output "example_definition_content_jsonpath" { + value = provider::fabric::content_decode(data.fabric_kql_database.example_definition.definition["DatabaseProperties.json"].content, ".") +} + +# Access the content of the definition as JSON object +output "example_definition_content_object" { + value = provider::fabric::content_decode(data.fabric_kql_database.example_definition.definition["DatabaseProperties.json"].content) +} + # This is an invalid data source # Do not specify `id` and `display_name` in the same data source block # data "fabric_kql_database" "example" { diff --git a/docs/data-sources/notebook.md b/docs/data-sources/notebook.md index a3b3552a..d90e3ea5 100644 --- a/docs/data-sources/notebook.md +++ b/docs/data-sources/notebook.md @@ -19,18 +19,18 @@ Use this data source to fetch a [Notebook](https://learn.microsoft.com/fabric/da ## Example Usage ```terraform -# Get item details by name -data "fabric_notebook" "example_by_name" { - display_name = "example" - workspace_id = "00000000-0000-0000-0000-000000000000" -} - # Get item details by id data "fabric_notebook" "example_by_id" { id = "11111111-1111-1111-1111-111111111111" workspace_id = "00000000-0000-0000-0000-000000000000" } +# Get item details by name +data "fabric_notebook" "example_by_name" { + display_name = "example" + workspace_id = "00000000-0000-0000-0000-000000000000" +} + # Get item details with definition # Examples uses `id` but `display_name` can be used as well data "fabric_notebook" "example_definition" { diff --git a/docs/resources/kql_database.md b/docs/resources/kql_database.md index 6c930dcb..7f2e58f2 100644 --- a/docs/resources/kql_database.md +++ b/docs/resources/kql_database.md @@ -19,7 +19,7 @@ Use this resource to manage a [KQL Database](https://learn.microsoft.com/fabric/ ## Example Usage ```terraform -# Example 1 - Create a ReadWrite KQL database +# Example 1 - Item with configuration, no definition - create a ReadWrite KQL database resource "fabric_kql_database" "example1" { display_name = "example1" workspace_id = "00000000-0000-0000-0000-000000000000" @@ -30,7 +30,7 @@ resource "fabric_kql_database" "example1" { } } -# Example 2 - Create a Shortcut KQL database to source Azure Data Explorer cluster +# Example 2 - Item with configuration, no definition - create a Shortcut KQL database to source Azure Data Explorer cluster resource "fabric_kql_database" "example2" { display_name = "example2" workspace_id = "00000000-0000-0000-0000-000000000000" @@ -43,7 +43,7 @@ resource "fabric_kql_database" "example2" { } } -# Example 3 - Create a Shortcut KQL database to source Azure Data Explorer cluster with invitation token +# Example 3 - Item with configuration, no definition - create a Shortcut KQL database to source Azure Data Explorer cluster with invitation token resource "fabric_kql_database" "example3" { display_name = "example3" workspace_id = "00000000-0000-0000-0000-000000000000" @@ -55,7 +55,7 @@ resource "fabric_kql_database" "example3" { } } -# Example 4 - Create a Shortcut KQL database to source KQL database +# Example 4 - Item with configuration, no definition - create a Shortcut KQL database to source KQL database resource "fabric_kql_database" "example4" { display_name = "example4" workspace_id = "00000000-0000-0000-0000-000000000000" @@ -66,6 +66,37 @@ resource "fabric_kql_database" "example4" { source_database_name = "MyDatabase" } } + + +# Example 5 - Item with definition bootstrapping only +resource "fabric_kql_database" "example5" { + display_name = "example5" + description = "example with definition bootstrapping" + workspace_id = "00000000-0000-0000-0000-000000000000" + format = "Default" + definition_update_enabled = false # <-- Disable definition update + definition = { + "DatabaseProperties.json" = { + source = "${local.path}/DatabaseProperties.json.tmpl" + } + } +} + +# Example 6 - Item with definition update when source or tokens changed +resource "fabric_kql_database" "example6" { + display_name = "example6" + description = "example with definition update when source or tokens changed" + workspace_id = "00000000-0000-0000-0000-000000000000" + format = "Default" + definition = { + "DatabaseProperties.json" = { + source = "${local.path}/DatabaseProperties.json.tmpl" + tokens = { + "MyKey" = "MyValue" + } + } + } +} ``` diff --git a/docs/resources/ml_model.md b/docs/resources/ml_model.md index 65cacfec..15750df0 100644 --- a/docs/resources/ml_model.md +++ b/docs/resources/ml_model.md @@ -19,6 +19,15 @@ Use this resource to manage [ML Model](https://learn.microsoft.com/fabric/data-s ~> This resource is in **preview**. To access it, you must explicitly enable the `preview` mode in the provider level configuration. +## Example Usage + +```terraform +resource "fabric_ml_model" "example" { + display_name = "example" + workspace_id = "00000000-0000-0000-0000-000000000000" +} +``` + ## Schema @@ -46,3 +55,12 @@ Optional: - `delete` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs. - `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled. - `update` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). + +## Import + +Import is supported using the following syntax: + +```shell +# terraform import fabric_ml_model.example "/" +terraform import fabric_ml_model.example "00000000-0000-0000-0000-000000000000/11111111-1111-1111-1111-111111111111" +``` diff --git a/examples/data-sources/fabric_kql_database/data-source.tf b/examples/data-sources/fabric_kql_database/data-source.tf index b8877cbf..507f8c77 100644 --- a/examples/data-sources/fabric_kql_database/data-source.tf +++ b/examples/data-sources/fabric_kql_database/data-source.tf @@ -1,13 +1,34 @@ +# Get item details by id data "fabric_kql_database" "example_by_id" { id = "11111111-1111-1111-1111-111111111111" workspace_id = "00000000-0000-0000-0000-000000000000" } +# Get item details by name data "fabric_kql_database" "example_by_name" { display_name = "example" workspace_id = "00000000-0000-0000-0000-000000000000" } +# Get item details with definition +# Examples uses `id` but `display_name` can be used as well +data "fabric_kql_database" "example_definition" { + id = "11111111-1111-1111-1111-111111111111" + workspace_id = "00000000-0000-0000-0000-000000000000" + format = "Default" + output_definition = true +} + +# Access the content of the definition with JSONPath expression +output "example_definition_content_jsonpath" { + value = provider::fabric::content_decode(data.fabric_kql_database.example_definition.definition["DatabaseProperties.json"].content, ".") +} + +# Access the content of the definition as JSON object +output "example_definition_content_object" { + value = provider::fabric::content_decode(data.fabric_kql_database.example_definition.definition["DatabaseProperties.json"].content) +} + # This is an invalid data source # Do not specify `id` and `display_name` in the same data source block # data "fabric_kql_database" "example" { diff --git a/examples/data-sources/fabric_notebook/data-source.tf b/examples/data-sources/fabric_notebook/data-source.tf index e7210117..21339793 100644 --- a/examples/data-sources/fabric_notebook/data-source.tf +++ b/examples/data-sources/fabric_notebook/data-source.tf @@ -1,15 +1,15 @@ -# Get item details by name -data "fabric_notebook" "example_by_name" { - display_name = "example" - workspace_id = "00000000-0000-0000-0000-000000000000" -} - # Get item details by id data "fabric_notebook" "example_by_id" { id = "11111111-1111-1111-1111-111111111111" workspace_id = "00000000-0000-0000-0000-000000000000" } +# Get item details by name +data "fabric_notebook" "example_by_name" { + display_name = "example" + workspace_id = "00000000-0000-0000-0000-000000000000" +} + # Get item details with definition # Examples uses `id` but `display_name` can be used as well data "fabric_notebook" "example_definition" { diff --git a/examples/resources/fabric_eventhouse/providers.tf b/examples/resources/fabric_eventhouse/providers.tf index 0c8bdbf5..0157f83a 100644 --- a/examples/resources/fabric_eventhouse/providers.tf +++ b/examples/resources/fabric_eventhouse/providers.tf @@ -9,3 +9,7 @@ terraform { } provider "fabric" {} + +locals { + path = abspath(join("/", [path.root, "..", "..", "..", "internal", "testhelp", "fixtures", "eventhouse"])) +} diff --git a/examples/resources/fabric_kql_database/providers.tf b/examples/resources/fabric_kql_database/providers.tf index 0c8bdbf5..1f15e82e 100644 --- a/examples/resources/fabric_kql_database/providers.tf +++ b/examples/resources/fabric_kql_database/providers.tf @@ -9,3 +9,7 @@ terraform { } provider "fabric" {} + +locals { + path = abspath(join("/", [path.root, "..", "..", "..", "internal", "testhelp", "fixtures", "kql_database"])) +} diff --git a/examples/resources/fabric_kql_database/resource.tf b/examples/resources/fabric_kql_database/resource.tf index 39c6477a..8bd9700a 100644 --- a/examples/resources/fabric_kql_database/resource.tf +++ b/examples/resources/fabric_kql_database/resource.tf @@ -1,4 +1,4 @@ -# Example 1 - Create a ReadWrite KQL database +# Example 1 - Item with configuration, no definition - create a ReadWrite KQL database resource "fabric_kql_database" "example1" { display_name = "example1" workspace_id = "00000000-0000-0000-0000-000000000000" @@ -9,7 +9,7 @@ resource "fabric_kql_database" "example1" { } } -# Example 2 - Create a Shortcut KQL database to source Azure Data Explorer cluster +# Example 2 - Item with configuration, no definition - create a Shortcut KQL database to source Azure Data Explorer cluster resource "fabric_kql_database" "example2" { display_name = "example2" workspace_id = "00000000-0000-0000-0000-000000000000" @@ -22,7 +22,7 @@ resource "fabric_kql_database" "example2" { } } -# Example 3 - Create a Shortcut KQL database to source Azure Data Explorer cluster with invitation token +# Example 3 - Item with configuration, no definition - create a Shortcut KQL database to source Azure Data Explorer cluster with invitation token resource "fabric_kql_database" "example3" { display_name = "example3" workspace_id = "00000000-0000-0000-0000-000000000000" @@ -34,7 +34,7 @@ resource "fabric_kql_database" "example3" { } } -# Example 4 - Create a Shortcut KQL database to source KQL database +# Example 4 - Item with configuration, no definition - create a Shortcut KQL database to source KQL database resource "fabric_kql_database" "example4" { display_name = "example4" workspace_id = "00000000-0000-0000-0000-000000000000" @@ -45,3 +45,34 @@ resource "fabric_kql_database" "example4" { source_database_name = "MyDatabase" } } + + +# Example 5 - Item with definition bootstrapping only +resource "fabric_kql_database" "example5" { + display_name = "example5" + description = "example with definition bootstrapping" + workspace_id = "00000000-0000-0000-0000-000000000000" + format = "Default" + definition_update_enabled = false # <-- Disable definition update + definition = { + "DatabaseProperties.json" = { + source = "${local.path}/DatabaseProperties.json.tmpl" + } + } +} + +# Example 6 - Item with definition update when source or tokens changed +resource "fabric_kql_database" "example6" { + display_name = "example6" + description = "example with definition update when source or tokens changed" + workspace_id = "00000000-0000-0000-0000-000000000000" + format = "Default" + definition = { + "DatabaseProperties.json" = { + source = "${local.path}/DatabaseProperties.json.tmpl" + tokens = { + "MyKey" = "MyValue" + } + } + } +} diff --git a/examples/resources/fabric_ml_model/import.sh b/examples/resources/fabric_ml_model/import.sh new file mode 100644 index 00000000..1ff95530 --- /dev/null +++ b/examples/resources/fabric_ml_model/import.sh @@ -0,0 +1,2 @@ +# terraform import fabric_ml_model.example "/" +terraform import fabric_ml_model.example "00000000-0000-0000-0000-000000000000/11111111-1111-1111-1111-111111111111" diff --git a/examples/resources/fabric_ml_model/outputs.tf b/examples/resources/fabric_ml_model/outputs.tf new file mode 100644 index 00000000..04736c52 --- /dev/null +++ b/examples/resources/fabric_ml_model/outputs.tf @@ -0,0 +1,3 @@ +output "example" { + value = resource.fabric_ml_model.example +} diff --git a/examples/resources/fabric_ml_model/providers.tf b/examples/resources/fabric_ml_model/providers.tf new file mode 100644 index 00000000..0c8bdbf5 --- /dev/null +++ b/examples/resources/fabric_ml_model/providers.tf @@ -0,0 +1,11 @@ +terraform { + required_version = ">= 1.8, < 2.0" + required_providers { + fabric = { + source = "microsoft/fabric" + version = "0.0.0" # Check for the latest version on the Terraform Registry + } + } +} + +provider "fabric" {} diff --git a/examples/resources/fabric_ml_model/resource.tf b/examples/resources/fabric_ml_model/resource.tf new file mode 100644 index 00000000..0549abb5 --- /dev/null +++ b/examples/resources/fabric_ml_model/resource.tf @@ -0,0 +1,4 @@ +resource "fabric_ml_model" "example" { + display_name = "example" + workspace_id = "00000000-0000-0000-0000-000000000000" +} diff --git a/internal/provider/client/logging.go b/internal/provider/client/logging.go index 0d0b3913..dfb29ac8 100644 --- a/internal/provider/client/logging.go +++ b/internal/provider/client/logging.go @@ -27,8 +27,7 @@ func NewFabricSDKLoggerSubsystem(ctx context.Context) (context.Context, hclog.Le // Enable azcore logging if the target level is not "off" if targetLevel != hclog.Off { - err := os.Setenv(AzureSDKLoggingEnvVar, AzureSDKLoggingAll) - if err != nil { + if err := os.Setenv(AzureSDKLoggingEnvVar, AzureSDKLoggingAll); err != nil { return ctx, targetLevel, err } } diff --git a/internal/services/environment/models.go b/internal/services/environment/models.go index f0cb5d61..432bf8f3 100644 --- a/internal/services/environment/models.go +++ b/internal/services/environment/models.go @@ -82,7 +82,7 @@ func (to *environmentComponentPublishInfoModel) set(ctx context.Context, from *f if from.SparkLibraries != nil { sparkLibrariesModel := &environmentSparkLibrariesModel{} - sparkLibrariesModel.set(from.SparkLibraries) + sparkLibrariesModel.set(*from.SparkLibraries) if diags := sparkLibraries.Set(ctx, sparkLibrariesModel); diags.HasError() { return diags @@ -95,7 +95,7 @@ func (to *environmentComponentPublishInfoModel) set(ctx context.Context, from *f if from.SparkSettings != nil { sparkSettingsModel := &environmentSparkSettingsModel{} - sparkSettingsModel.set(from.SparkSettings) + sparkSettingsModel.set(*from.SparkSettings) if diags := sparkSettings.Set(ctx, sparkSettingsModel); diags.HasError() { return diags @@ -111,7 +111,7 @@ type environmentSparkLibrariesModel struct { State types.String `tfsdk:"state"` } -func (to *environmentSparkLibrariesModel) set(from *fabenvironment.SparkLibraries) { +func (to *environmentSparkLibrariesModel) set(from fabenvironment.SparkLibraries) { to.State = types.StringPointerValue((*string)(from.State)) } @@ -119,6 +119,6 @@ type environmentSparkSettingsModel struct { State types.String `tfsdk:"state"` } -func (to *environmentSparkSettingsModel) set(from *fabenvironment.SparkSettings) { +func (to *environmentSparkSettingsModel) set(from fabenvironment.SparkSettings) { to.State = types.StringPointerValue((*string)(from.State)) } diff --git a/internal/services/kqldatabase/data_kql_database.go b/internal/services/kqldatabase/data_kql_database.go index 594c03a0..f6e905c5 100644 --- a/internal/services/kqldatabase/data_kql_database.go +++ b/internal/services/kqldatabase/data_kql_database.go @@ -22,7 +22,7 @@ func NewDataSourceKQLDatabase() datasource.DataSource { if from != nil { propertiesModel := &kqlDatabasePropertiesModel{} - propertiesModel.set(from) + propertiesModel.set(*from) if diags := properties.Set(ctx, propertiesModel); diags.HasError() { return diags diff --git a/internal/services/kqldatabase/data_kql_databases.go b/internal/services/kqldatabase/data_kql_databases.go index cc53812a..76b35dfa 100644 --- a/internal/services/kqldatabase/data_kql_databases.go +++ b/internal/services/kqldatabase/data_kql_databases.go @@ -21,7 +21,7 @@ func NewDataSourceKQLDatabases() datasource.DataSource { if from != nil { propertiesModel := &kqlDatabasePropertiesModel{} - propertiesModel.set(from) + propertiesModel.set(*from) if diags := properties.Set(ctx, propertiesModel); diags.HasError() { return diags diff --git a/internal/services/kqldatabase/models.go b/internal/services/kqldatabase/models.go index 25eec149..b6d646bd 100644 --- a/internal/services/kqldatabase/models.go +++ b/internal/services/kqldatabase/models.go @@ -19,7 +19,7 @@ type kqlDatabasePropertiesModel struct { // OneLakeCachingPeriod types.String `tfsdk:"onelake_caching_period"` } -func (to *kqlDatabasePropertiesModel) set(from *fabkqldatabase.Properties) { +func (to *kqlDatabasePropertiesModel) set(from fabkqldatabase.Properties) { to.DatabaseType = types.StringPointerValue((*string)(from.DatabaseType)) to.EventhouseID = customtypes.NewUUIDPointerValue(from.ParentEventhouseItemID) to.IngestionServiceURI = customtypes.NewURLPointerValue(from.IngestionServiceURI) diff --git a/internal/services/kqldatabase/resource_kql_database.go b/internal/services/kqldatabase/resource_kql_database.go index 604c20c5..9827ddcf 100644 --- a/internal/services/kqldatabase/resource_kql_database.go +++ b/internal/services/kqldatabase/resource_kql_database.go @@ -67,7 +67,7 @@ func NewResourceKQLDatabase() resource.Resource { if from != nil { propertiesModel := &kqlDatabasePropertiesModel{} - propertiesModel.set(from) + propertiesModel.set(*from) if diags := properties.Set(ctx, propertiesModel); diags.HasError() { return diags diff --git a/internal/services/lakehouse/models.go b/internal/services/lakehouse/models.go index d613528c..9ade70b5 100644 --- a/internal/services/lakehouse/models.go +++ b/internal/services/lakehouse/models.go @@ -26,7 +26,7 @@ func (to *lakehousePropertiesModel) set(ctx context.Context, from *fablakehouse. if from.SQLEndpointProperties != nil { sqlEndpointPropertiesModel := &lakehouseSQLEndpointPropertiesModel{} - sqlEndpointPropertiesModel.set(from.SQLEndpointProperties) + sqlEndpointPropertiesModel.set(*from.SQLEndpointProperties) if diags := sqlEndpointProperties.Set(ctx, sqlEndpointPropertiesModel); diags.HasError() { return diags @@ -47,7 +47,7 @@ type lakehouseSQLEndpointPropertiesModel struct { ProvisioningStatus types.String `tfsdk:"provisioning_status"` } -func (to *lakehouseSQLEndpointPropertiesModel) set(from *fablakehouse.SQLEndpointProperties) { +func (to *lakehouseSQLEndpointPropertiesModel) set(from fablakehouse.SQLEndpointProperties) { to.ID = customtypes.NewUUIDPointerValue(from.ID) to.ConnectionString = types.StringPointerValue(from.ConnectionString) to.ProvisioningStatus = types.StringPointerValue((*string)(from.ProvisioningStatus)) diff --git a/internal/services/spark/models_spark_custom_pool.go b/internal/services/spark/models_spark_custom_pool.go index fa3be0f9..d9278475 100644 --- a/internal/services/spark/models_spark_custom_pool.go +++ b/internal/services/spark/models_spark_custom_pool.go @@ -48,7 +48,7 @@ func (to *baseSparkCustomPoolModel) set(ctx context.Context, from fabspark.Custo if from.AutoScale != nil { autoScaleModel := &sparkCustomPoolAutoScaleModel{} - autoScaleModel.set(from.AutoScale) + autoScaleModel.set(*from.AutoScale) if diags := autoScale.Set(ctx, autoScaleModel); diags.HasError() { return diags @@ -61,7 +61,7 @@ func (to *baseSparkCustomPoolModel) set(ctx context.Context, from fabspark.Custo if from.DynamicExecutorAllocation != nil { dynamicExecutorAllocationModel := &sparkCustomPoolDynamicExecutorAllocationModel{} - dynamicExecutorAllocationModel.set(from.DynamicExecutorAllocation) + dynamicExecutorAllocationModel.set(*from.DynamicExecutorAllocation) if diags := dynamicExecutorAllocation.Set(ctx, dynamicExecutorAllocationModel); diags.HasError() { return diags @@ -79,7 +79,7 @@ type sparkCustomPoolAutoScaleModel struct { MaxNodeCount types.Int32 `tfsdk:"max_node_count"` } -func (to *sparkCustomPoolAutoScaleModel) set(from *fabspark.AutoScaleProperties) { +func (to *sparkCustomPoolAutoScaleModel) set(from fabspark.AutoScaleProperties) { to.Enabled = types.BoolPointerValue(from.Enabled) to.MinNodeCount = types.Int32PointerValue(from.MinNodeCount) to.MaxNodeCount = types.Int32PointerValue(from.MaxNodeCount) @@ -91,7 +91,7 @@ type sparkCustomPoolDynamicExecutorAllocationModel struct { MaxExecutors types.Int32 `tfsdk:"max_executors"` } -func (to *sparkCustomPoolDynamicExecutorAllocationModel) set(from *fabspark.DynamicExecutorAllocationProperties) { +func (to *sparkCustomPoolDynamicExecutorAllocationModel) set(from fabspark.DynamicExecutorAllocationProperties) { to.Enabled = types.BoolPointerValue(from.Enabled) to.MinExecutors = types.Int32PointerValue(from.MinExecutors) to.MaxExecutors = types.Int32PointerValue(from.MaxExecutors) diff --git a/internal/services/spark/models_spark_environment_settings.go b/internal/services/spark/models_spark_environment_settings.go index cad97aeb..ec8d7d9c 100644 --- a/internal/services/spark/models_spark_environment_settings.go +++ b/internal/services/spark/models_spark_environment_settings.go @@ -88,7 +88,7 @@ func (to *baseSparkEnvironmentSettingsModel) set(ctx context.Context, from faben if from.DynamicExecutorAllocation != nil { dynamicExecutorAllocationModel := &dynamicExecutorAllocationPropertiesModel{} - dynamicExecutorAllocationModel.set(from.DynamicExecutorAllocation) + dynamicExecutorAllocationModel.set(*from.DynamicExecutorAllocation) if diags := dynamicExecutorAllocation.Set(ctx, dynamicExecutorAllocationModel); diags.HasError() { return diags @@ -101,7 +101,7 @@ func (to *baseSparkEnvironmentSettingsModel) set(ctx context.Context, from faben if from.InstancePool != nil { instancePoolModel := &instancePoolPropertiesModel{} - instancePoolModel.set(from.InstancePool) + instancePoolModel.set(*from.InstancePool) if diags := instancePool.Set(ctx, instancePoolModel); diags.HasError() { return diags @@ -119,7 +119,7 @@ type dynamicExecutorAllocationPropertiesModel struct { MaxExecutors types.Int32 `tfsdk:"max_executors"` } -func (to *dynamicExecutorAllocationPropertiesModel) set(from *fabenvironment.DynamicExecutorAllocationProperties) { +func (to *dynamicExecutorAllocationPropertiesModel) set(from fabenvironment.DynamicExecutorAllocationProperties) { to.Enabled = types.BoolPointerValue(from.Enabled) to.MinExecutors = types.Int32PointerValue(from.MinExecutors) to.MaxExecutors = types.Int32PointerValue(from.MaxExecutors) @@ -131,7 +131,7 @@ type instancePoolPropertiesModel struct { Type types.String `tfsdk:"type"` } -func (to *instancePoolPropertiesModel) set(from *fabenvironment.InstancePool) { +func (to *instancePoolPropertiesModel) set(from fabenvironment.InstancePool) { to.ID = customtypes.NewUUIDPointerValue(from.ID) to.Name = types.StringPointerValue(from.Name) to.Type = types.StringPointerValue((*string)(from.Type)) diff --git a/internal/services/spark/models_spark_workspace_settings.go b/internal/services/spark/models_spark_workspace_settings.go index e6b2076d..268d1068 100644 --- a/internal/services/spark/models_spark_workspace_settings.go +++ b/internal/services/spark/models_spark_workspace_settings.go @@ -42,7 +42,7 @@ func (to *baseSparkWorkspaceSettingsModel) set(ctx context.Context, from fabspar if from.AutomaticLog != nil { automaticLogModel := &automaticLogPropertiesModel{} - automaticLogModel.set(from.AutomaticLog) + automaticLogModel.set(*from.AutomaticLog) if diags := automaticLog.Set(ctx, automaticLogModel); diags.HasError() { return diags @@ -55,7 +55,7 @@ func (to *baseSparkWorkspaceSettingsModel) set(ctx context.Context, from fabspar if from.Environment != nil { environmentModel := &environmentPropertiesModel{} - environmentModel.set(from.Environment) + environmentModel.set(*from.Environment) if diags := environment.Set(ctx, environmentModel); diags.HasError() { return diags @@ -68,7 +68,7 @@ func (to *baseSparkWorkspaceSettingsModel) set(ctx context.Context, from fabspar if from.HighConcurrency != nil { highConcurrencyModel := &highConcurrencyPropertiesModel{} - highConcurrencyModel.set(from.HighConcurrency) + highConcurrencyModel.set(*from.HighConcurrency) if diags := highConcurrency.Set(ctx, highConcurrencyModel); diags.HasError() { return diags @@ -81,7 +81,7 @@ func (to *baseSparkWorkspaceSettingsModel) set(ctx context.Context, from fabspar if from.Job != nil { jobModel := &jobPropertiesModel{} - jobModel.set(from.Job) + jobModel.set(*from.Job) if diags := job.Set(ctx, jobModel); diags.HasError() { return diags @@ -113,7 +113,7 @@ type automaticLogPropertiesModel struct { Enabled types.Bool `tfsdk:"enabled"` } -func (to *automaticLogPropertiesModel) set(from *fabspark.AutomaticLogProperties) { +func (to *automaticLogPropertiesModel) set(from fabspark.AutomaticLogProperties) { to.Enabled = types.BoolPointerValue(from.Enabled) } @@ -122,7 +122,7 @@ type environmentPropertiesModel struct { RuntimeVersion types.String `tfsdk:"runtime_version"` } -func (to *environmentPropertiesModel) set(from *fabspark.EnvironmentProperties) { +func (to *environmentPropertiesModel) set(from fabspark.EnvironmentProperties) { to.Name = types.StringPointerValue(from.Name) to.RuntimeVersion = types.StringPointerValue(from.RuntimeVersion) } @@ -132,7 +132,7 @@ type highConcurrencyPropertiesModel struct { NotebookPipelineRunEnabled types.Bool `tfsdk:"notebook_pipeline_run_enabled"` } -func (to *highConcurrencyPropertiesModel) set(from *fabspark.HighConcurrencyProperties) { +func (to *highConcurrencyPropertiesModel) set(from fabspark.HighConcurrencyProperties) { to.NotebookInteractiveRunEnabled = types.BoolPointerValue(from.NotebookInteractiveRunEnabled) to.NotebookPipelineRunEnabled = types.BoolPointerValue(from.NotebookPipelineRunEnabled) } @@ -142,7 +142,7 @@ type jobPropertiesModel struct { SessionTimeoutInMinutes types.Int32 `tfsdk:"session_timeout_in_minutes"` } -func (to *jobPropertiesModel) set(from *fabspark.JobsProperties) { +func (to *jobPropertiesModel) set(from fabspark.JobsProperties) { to.ConservativeJobAdmissionEnabled = types.BoolPointerValue(from.ConservativeJobAdmissionEnabled) to.SessionTimeoutInMinutes = types.Int32PointerValue(from.SessionTimeoutInMinutes) } @@ -160,7 +160,7 @@ func (to *poolPropertiesModel) set(ctx context.Context, from *fabspark.PoolPrope if from.DefaultPool != nil { defaultPoolModel := &defaultPoolPropertiesModel{} - defaultPoolModel.set(from.DefaultPool) + defaultPoolModel.set(*from.DefaultPool) if diags := defaultPool.Set(ctx, defaultPoolModel); diags.HasError() { return diags @@ -173,7 +173,7 @@ func (to *poolPropertiesModel) set(ctx context.Context, from *fabspark.PoolPrope if from.StarterPool != nil { starterPoolModel := &starterPoolPropertiesModel{} - starterPoolModel.set(from.StarterPool) + starterPoolModel.set(*from.StarterPool) if diags := starterPool.Set(ctx, starterPoolModel); diags.HasError() { return diags @@ -191,7 +191,7 @@ type defaultPoolPropertiesModel struct { Type types.String `tfsdk:"type"` } -func (to *defaultPoolPropertiesModel) set(from *fabspark.InstancePool) { +func (to *defaultPoolPropertiesModel) set(from fabspark.InstancePool) { to.ID = customtypes.NewUUIDPointerValue(from.ID) to.Name = types.StringPointerValue(from.Name) to.Type = types.StringPointerValue((*string)(from.Type)) @@ -202,7 +202,7 @@ type starterPoolPropertiesModel struct { MaxExecutors types.Int32 `tfsdk:"max_executors"` } -func (to *starterPoolPropertiesModel) set(from *fabspark.StarterPoolProperties) { +func (to *starterPoolPropertiesModel) set(from fabspark.StarterPoolProperties) { to.MaxNodeCount = types.Int32PointerValue(from.MaxNodeCount) to.MaxExecutors = types.Int32PointerValue(from.MaxExecutors) } diff --git a/internal/services/sparkjobdefinition/data_spark_job_definition.go b/internal/services/sparkjobdefinition/data_spark_job_definition.go index 9a382a9e..bd82052c 100644 --- a/internal/services/sparkjobdefinition/data_spark_job_definition.go +++ b/internal/services/sparkjobdefinition/data_spark_job_definition.go @@ -22,7 +22,7 @@ func NewDataSourceSparkJobDefinition() datasource.DataSource { if from != nil { propertiesModel := &sparkJobDefinitionPropertiesModel{} - propertiesModel.set(from) + propertiesModel.set(*from) if diags := properties.Set(ctx, propertiesModel); diags.HasError() { return diags diff --git a/internal/services/sparkjobdefinition/data_spark_job_definitions.go b/internal/services/sparkjobdefinition/data_spark_job_definitions.go index 8d516bcd..3f6e640d 100644 --- a/internal/services/sparkjobdefinition/data_spark_job_definitions.go +++ b/internal/services/sparkjobdefinition/data_spark_job_definitions.go @@ -21,7 +21,7 @@ func NewDataSourceSparkJobDefinitions() datasource.DataSource { if from != nil { propertiesModel := &sparkJobDefinitionPropertiesModel{} - propertiesModel.set(from) + propertiesModel.set(*from) if diags := properties.Set(ctx, propertiesModel); diags.HasError() { return diags diff --git a/internal/services/sparkjobdefinition/models.go b/internal/services/sparkjobdefinition/models.go index c91c16c8..5a915082 100644 --- a/internal/services/sparkjobdefinition/models.go +++ b/internal/services/sparkjobdefinition/models.go @@ -13,6 +13,6 @@ type sparkJobDefinitionPropertiesModel struct { OneLakeRootPath customtypes.URL `tfsdk:"onelake_root_path"` } -func (to *sparkJobDefinitionPropertiesModel) set(from *fabsparkjobdefinition.Properties) { +func (to *sparkJobDefinitionPropertiesModel) set(from fabsparkjobdefinition.Properties) { to.OneLakeRootPath = customtypes.NewURLPointerValue(from.OneLakeRootPath) } diff --git a/internal/services/sparkjobdefinition/resource_spark_job_definition.go b/internal/services/sparkjobdefinition/resource_spark_job_definition.go index a6c1aad0..fa1c5b1c 100644 --- a/internal/services/sparkjobdefinition/resource_spark_job_definition.go +++ b/internal/services/sparkjobdefinition/resource_spark_job_definition.go @@ -23,7 +23,7 @@ func NewResourceSparkJobDefinition() resource.Resource { if from != nil { propertiesModel := &sparkJobDefinitionPropertiesModel{} - propertiesModel.set(from) + propertiesModel.set(*from) diags := properties.Set(ctx, propertiesModel) if diags.HasError() { diff --git a/internal/services/warehouse/data_warehouse.go b/internal/services/warehouse/data_warehouse.go index d1e4bcc4..f7c7236b 100644 --- a/internal/services/warehouse/data_warehouse.go +++ b/internal/services/warehouse/data_warehouse.go @@ -22,7 +22,7 @@ func NewDataSourceWarehouse() datasource.DataSource { if from != nil { propertiesModel := &warehousePropertiesModel{} - propertiesModel.set(from) + propertiesModel.set(*from) if diags := properties.Set(ctx, propertiesModel); diags.HasError() { return diags diff --git a/internal/services/warehouse/data_warehouses.go b/internal/services/warehouse/data_warehouses.go index 1cd8bf7e..2735bad9 100644 --- a/internal/services/warehouse/data_warehouses.go +++ b/internal/services/warehouse/data_warehouses.go @@ -21,7 +21,7 @@ func NewDataSourceWarehouses() datasource.DataSource { if from != nil { propertiesModel := &warehousePropertiesModel{} - propertiesModel.set(from) + propertiesModel.set(*from) if diags := properties.Set(ctx, propertiesModel); diags.HasError() { return diags diff --git a/internal/services/warehouse/models.go b/internal/services/warehouse/models.go index 7bbfe917..70675cf8 100644 --- a/internal/services/warehouse/models.go +++ b/internal/services/warehouse/models.go @@ -15,7 +15,7 @@ type warehousePropertiesModel struct { LastUpdatedTime timetypes.RFC3339 `tfsdk:"last_updated_time"` } -func (to *warehousePropertiesModel) set(from *fabwarehouse.Properties) { +func (to *warehousePropertiesModel) set(from fabwarehouse.Properties) { to.ConnectionString = types.StringPointerValue(from.ConnectionString) to.CreatedDate = timetypes.NewRFC3339TimePointerValue(from.CreatedDate) to.LastUpdatedTime = timetypes.NewRFC3339TimePointerValue(from.LastUpdatedTime) diff --git a/internal/services/warehouse/resource_warehouse.go b/internal/services/warehouse/resource_warehouse.go index e87ed75d..37af548e 100644 --- a/internal/services/warehouse/resource_warehouse.go +++ b/internal/services/warehouse/resource_warehouse.go @@ -21,7 +21,7 @@ func NewResourceWarehouse() resource.Resource { if from != nil { propertiesModel := &warehousePropertiesModel{} - propertiesModel.set(from) + propertiesModel.set(*from) if diags := properties.Set(ctx, propertiesModel); diags.HasError() { return diags diff --git a/internal/services/workspace/models.go b/internal/services/workspace/models.go index 27bd8c0d..bb803d45 100644 --- a/internal/services/workspace/models.go +++ b/internal/services/workspace/models.go @@ -37,7 +37,7 @@ func (to *baseWorkspaceInfoModel) set(ctx context.Context, from fabcore.Workspac if from.OneLakeEndpoints != nil { oneLakeEndpointsModel := &oneLakeEndpointsModel{} - oneLakeEndpointsModel.set(from.OneLakeEndpoints) + oneLakeEndpointsModel.set(*from.OneLakeEndpoints) if diags := oneLakeEndpoints.Set(ctx, oneLakeEndpointsModel); diags.HasError() { return diags @@ -50,7 +50,7 @@ func (to *baseWorkspaceInfoModel) set(ctx context.Context, from fabcore.Workspac if from.WorkspaceIdentity != nil { workspaceIdentityModel := &workspaceIdentityModel{} - workspaceIdentityModel.set(from.WorkspaceIdentity) + workspaceIdentityModel.set(*from.WorkspaceIdentity) if diags := workspaceIdentity.Set(ctx, workspaceIdentityModel); diags.HasError() { return diags @@ -84,7 +84,7 @@ type workspaceIdentityModel struct { ServicePrincipalID customtypes.UUID `tfsdk:"service_principal_id"` } -func (to *workspaceIdentityModel) set(from *fabcore.WorkspaceIdentity) { +func (to *workspaceIdentityModel) set(from fabcore.WorkspaceIdentity) { to.Type = types.StringValue(workspaceIdentityTypes[0]) to.ApplicationID = customtypes.NewUUIDPointerValue(from.ApplicationID) to.ServicePrincipalID = customtypes.NewUUIDPointerValue(from.ServicePrincipalID) @@ -95,7 +95,7 @@ type oneLakeEndpointsModel struct { DfsEndpoint customtypes.URL `tfsdk:"dfs_endpoint"` } -func (to *oneLakeEndpointsModel) set(from *fabcore.OneLakeEndpoints) { +func (to *oneLakeEndpointsModel) set(from fabcore.OneLakeEndpoints) { to.BlobEndpoint = customtypes.NewURLPointerValue(from.BlobEndpoint) to.DfsEndpoint = customtypes.NewURLPointerValue(from.DfsEndpoint) } diff --git a/internal/services/workspace/models_data_workspace_role_assignments.go b/internal/services/workspace/models_data_workspace_role_assignments.go index 25220d39..8d1eb7ed 100644 --- a/internal/services/workspace/models_data_workspace_role_assignments.go +++ b/internal/services/workspace/models_data_workspace_role_assignments.go @@ -50,7 +50,7 @@ func (to *workspaceRoleAssignmentModel) set(ctx context.Context, from fabcore.Wo to.Role = types.StringPointerValue((*string)(from.Role)) detailsModel := &principalDetailsModel{} - detailsModel.set(from.Principal, to) + detailsModel.set(*from.Principal, to) if diags := to.Details.Set(ctx, detailsModel); diags.HasError() { return diags @@ -66,7 +66,7 @@ type principalDetailsModel struct { ParentPrincipalID customtypes.UUID `tfsdk:"parent_principal_id"` } -func (to *principalDetailsModel) set(from *fabcore.Principal, roleAssignment *workspaceRoleAssignmentModel) { +func (to *principalDetailsModel) set(from fabcore.Principal, roleAssignment *workspaceRoleAssignmentModel) { to.UserPrincipalName = types.StringNull() to.GroupType = types.StringNull() to.AppID = customtypes.NewUUIDNull() diff --git a/internal/services/workspace/models_workspace_git.go b/internal/services/workspace/models_workspace_git.go index cd5ad026..23158bfa 100644 --- a/internal/services/workspace/models_workspace_git.go +++ b/internal/services/workspace/models_workspace_git.go @@ -45,7 +45,7 @@ func (to *baseWorkspaceGitModel) set(ctx context.Context, from fabcore.GitConnec if from.GitSyncDetails != nil { syncDetailsModel := &gitSyncDetailsModel{} - syncDetailsModel.set(from.GitSyncDetails) + syncDetailsModel.set(*from.GitSyncDetails) if diags := syncDetails.Set(ctx, syncDetailsModel); diags.HasError() { return diags @@ -77,7 +77,7 @@ type gitSyncDetailsModel struct { LastSyncTime timetypes.RFC3339 `tfsdk:"last_sync_time"` } -func (to *gitSyncDetailsModel) set(from *fabcore.GitSyncDetails) { +func (to *gitSyncDetailsModel) set(from fabcore.GitSyncDetails) { to.Head = types.StringPointerValue(from.Head) to.LastSyncTime = timetypes.NewRFC3339TimePointerValue(from.LastSyncTime) }