Skip to content

Commit

Permalink
Various improvements from feedback from .NET SDK review (Azure#31198)
Browse files Browse the repository at this point in the history
  • Loading branch information
gerrytan authored and markcowl committed Oct 29, 2024
1 parent be46a17 commit 2d0da3b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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", [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down

0 comments on commit 2d0da3b

Please sign in to comment.