From f0f1de59d208c0955fbb4a19d2186c82bd3b2cae Mon Sep 17 00:00:00 2001 From: Gerry Tan Date: Tue, 29 Oct 2024 14:17:31 +1100 Subject: [PATCH] Various improvements from feedback from .NET SDK review (#31198) --- .../client.tsp | 23 +++++++++++++++++++ .../models.tsp | 6 +++-- .../preview/2023-07-01-preview/export.json | 8 +++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/specification/terraform/Microsoft.AzureTerraform.Management/client.tsp b/specification/terraform/Microsoft.AzureTerraform.Management/client.tsp index ccb51a59817e..ccee335ee281 100644 --- a/specification/terraform/Microsoft.AzureTerraform.Management/client.tsp +++ b/specification/terraform/Microsoft.AzureTerraform.Management/client.tsp @@ -2,6 +2,29 @@ import "@azure-tools/typespec-client-generator-core"; import "./main.tsp"; using Azure.ClientGenerator.Core; +using Azure.ResourceManager; using Microsoft.AzureTerraform; +@@clientName(Type, "CommonExportType", "csharp"); +@@clientName(BaseExportModel, "CommonExportProperties", "csharp"); +@@clientName(BaseExportModel.fullProperties, + "IsOutputFullPropertiesEnabled", + "csharp" +); +@@clientName(BaseExportModel.maskSensitive, "IsMaskSensitiveEnabled", "csharp"); +// Name ending with "Resource" is reserved for ARM resource in .NET SDK +// Refer to https://github.com/Azure/azure-sdk-for-net/blob/4dacd22df0cf904b11cb3b1389aa566c552fdd0f/common/ManagementTestShared/Redesign/InheritanceCheckTests.cs#L23 +@@clientName(ExportQuery, "ExportQueryTerraform", "csharp"); +@@clientName(ExportQuery.recursive, "IsRecursive", "csharp"); +@@clientName(ExportResource, "ExportResourceTerraform", "csharp"); +@@clientName(ExportResourceGroup, "ExportResourceGroupTerraform", "csharp"); +@@clientName(ExportResult, "TerraformExportResult", "csharp"); +@@clientName(ExportResult.skippedResources, "SkippedResourceIds", "csharp"); +@@clientName(ResourceProvisioningState, + "TerraformResourceProvisioningState", + "csharp" +); +@@clientName(targetProvider, "TargetTerraformProvider", "csharp"); +@@clientName(targetProvider.azapi, "AzApi", "csharp"); +@@clientName(targetProvider.azurerm, "AzureRM", "csharp"); @@clientName(Terraform.exportTerraform, "ExportTerraform", "csharp"); diff --git a/specification/terraform/Microsoft.AzureTerraform.Management/models.tsp b/specification/terraform/Microsoft.AzureTerraform.Management/models.tsp index 2f471a013c3f..154a5b737b3c 100644 --- a/specification/terraform/Microsoft.AzureTerraform.Management/models.tsp +++ b/specification/terraform/Microsoft.AzureTerraform.Management/models.tsp @@ -1,9 +1,11 @@ import "@typespec/rest"; import "@typespec/http"; +import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; using TypeSpec.Rest; using TypeSpec.Http; +using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Foundations; using OpenAPI; @@ -65,7 +67,7 @@ model ExportQuery extends BaseExportModel { @doc("Export parameter for individual resources.") model ExportResource extends BaseExportModel { @doc("The id of the resource to be exported") - resourceIds: string[]; + resourceIds: armResourceIdentifier[]; @doc("The Terraform resource name. Only works when `resourceIds` contains only one item.") resourceName?: string = "res-0"; @@ -101,7 +103,7 @@ model ExportResult { configuration?: string; @doc("A list of Azure resources which are not exported to Terraform due to there is no corresponding resources in Terraform") - skippedResources?: string[]; + skippedResources?: armResourceIdentifier[]; @doc("A list of errors derived during exporting each resource") @extension("x-ms-identifiers", []) diff --git a/specification/terraform/resource-manager/Microsoft.AzureTerraform/preview/2023-07-01-preview/export.json b/specification/terraform/resource-manager/Microsoft.AzureTerraform/preview/2023-07-01-preview/export.json index 59f4192cb53b..00a264c31dde 100644 --- a/specification/terraform/resource-manager/Microsoft.AzureTerraform/preview/2023-07-01-preview/export.json +++ b/specification/terraform/resource-manager/Microsoft.AzureTerraform/preview/2023-07-01-preview/export.json @@ -273,7 +273,9 @@ "type": "array", "description": "The id of the resource to be exported", "items": { - "type": "string" + "type": "string", + "format": "arm-id", + "description": "A type definition that refers the id to an Azure Resource Manager resource." } }, "resourceName": { @@ -337,7 +339,9 @@ "type": "array", "description": "A list of Azure resources which are not exported to Terraform due to there is no corresponding resources in Terraform", "items": { - "type": "string" + "type": "string", + "format": "arm-id", + "description": "A type definition that refers the id to an Azure Resource Manager resource." } }, "errors": {