Skip to content

Commit 2d0da3b

Browse files
gerrytanmarkcowl
authored andcommitted
Various improvements from feedback from .NET SDK review (Azure#31198)
1 parent be46a17 commit 2d0da3b

File tree

3 files changed

+33
-4
lines changed
  • specification/terraform

3 files changed

+33
-4
lines changed

specification/terraform/Microsoft.AzureTerraform.Management/client.tsp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,29 @@ import "@azure-tools/typespec-client-generator-core";
22
import "./main.tsp";
33

44
using Azure.ClientGenerator.Core;
5+
using Azure.ResourceManager;
56
using Microsoft.AzureTerraform;
67

8+
@@clientName(Type, "CommonExportType", "csharp");
9+
@@clientName(BaseExportModel, "CommonExportProperties", "csharp");
10+
@@clientName(BaseExportModel.fullProperties,
11+
"IsOutputFullPropertiesEnabled",
12+
"csharp"
13+
);
14+
@@clientName(BaseExportModel.maskSensitive, "IsMaskSensitiveEnabled", "csharp");
15+
// Name ending with "Resource" is reserved for ARM resource in .NET SDK
16+
// Refer to https://github.com/Azure/azure-sdk-for-net/blob/4dacd22df0cf904b11cb3b1389aa566c552fdd0f/common/ManagementTestShared/Redesign/InheritanceCheckTests.cs#L23
17+
@@clientName(ExportQuery, "ExportQueryTerraform", "csharp");
18+
@@clientName(ExportQuery.recursive, "IsRecursive", "csharp");
19+
@@clientName(ExportResource, "ExportResourceTerraform", "csharp");
20+
@@clientName(ExportResourceGroup, "ExportResourceGroupTerraform", "csharp");
21+
@@clientName(ExportResult, "TerraformExportResult", "csharp");
22+
@@clientName(ExportResult.skippedResources, "SkippedResourceIds", "csharp");
23+
@@clientName(ResourceProvisioningState,
24+
"TerraformResourceProvisioningState",
25+
"csharp"
26+
);
27+
@@clientName(targetProvider, "TargetTerraformProvider", "csharp");
28+
@@clientName(targetProvider.azapi, "AzApi", "csharp");
29+
@@clientName(targetProvider.azurerm, "AzureRM", "csharp");
730
@@clientName(Terraform.exportTerraform, "ExportTerraform", "csharp");

specification/terraform/Microsoft.AzureTerraform.Management/models.tsp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import "@typespec/rest";
22
import "@typespec/http";
3+
import "@azure-tools/typespec-azure-core";
34
import "@azure-tools/typespec-azure-resource-manager";
45

56
using TypeSpec.Rest;
67
using TypeSpec.Http;
8+
using Azure.Core;
79
using Azure.ResourceManager;
810
using Azure.ResourceManager.Foundations;
911
using OpenAPI;
@@ -65,7 +67,7 @@ model ExportQuery extends BaseExportModel {
6567
@doc("Export parameter for individual resources.")
6668
model ExportResource extends BaseExportModel {
6769
@doc("The id of the resource to be exported")
68-
resourceIds: string[];
70+
resourceIds: armResourceIdentifier[];
6971

7072
@doc("The Terraform resource name. Only works when `resourceIds` contains only one item.")
7173
resourceName?: string = "res-0";
@@ -101,7 +103,7 @@ model ExportResult {
101103
configuration?: string;
102104

103105
@doc("A list of Azure resources which are not exported to Terraform due to there is no corresponding resources in Terraform")
104-
skippedResources?: string[];
106+
skippedResources?: armResourceIdentifier[];
105107

106108
@doc("A list of errors derived during exporting each resource")
107109
@extension("x-ms-identifiers", [])

specification/terraform/resource-manager/Microsoft.AzureTerraform/preview/2023-07-01-preview/export.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,9 @@
273273
"type": "array",
274274
"description": "The id of the resource to be exported",
275275
"items": {
276-
"type": "string"
276+
"type": "string",
277+
"format": "arm-id",
278+
"description": "A type definition that refers the id to an Azure Resource Manager resource."
277279
}
278280
},
279281
"resourceName": {
@@ -337,7 +339,9 @@
337339
"type": "array",
338340
"description": "A list of Azure resources which are not exported to Terraform due to there is no corresponding resources in Terraform",
339341
"items": {
340-
"type": "string"
342+
"type": "string",
343+
"format": "arm-id",
344+
"description": "A type definition that refers the id to an Azure Resource Manager resource."
341345
}
342346
},
343347
"errors": {

0 commit comments

Comments
 (0)