Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various improvements from feedback from .NET SDK review #31198

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ import "@azure-tools/typespec-client-generator-core";
import "./main.tsp";

using Azure.ClientGenerator.Core;
using Azure.ResourceManager;
using Microsoft.AzureTerraform;

@@clientName(BaseExportModel, "CommonExportProperties", "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(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