Skip to content

Commit 6e52be1

Browse files
magodogerrytan
authored andcommitted
Terraform: Change exportEerraform endpoint to LRO (Azure#18782)
* terraform: Modify the `exportTerraform` RT to be LRO * Update * prettier * spell * CI validation * More CI issue fixes * typo * Add readme.go.md * typo * prettier * suppression * Update suppression
1 parent 2a93587 commit 6e52be1

File tree

7 files changed

+191
-12
lines changed

7 files changed

+191
-12
lines changed

cSpell.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,13 @@
14041404
"sfmc",
14051405
"sfmc's"
14061406
]
1407+
},
1408+
{
1409+
"filename": "**/specification/terraform/resource-manager/Microsoft.AzureTerraform/**/*.json",
1410+
"words": [
1411+
"azurerm",
1412+
"azapi"
1413+
]
14071414
}
14081415
],
14091416
"enableFiletypes": [

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@
1010
}
1111
},
1212
"responses": {
13-
"200": {
14-
"body": {
15-
"configuration": "resource \"azurerm_resource_group\" \"res-0\" {\n location = \"westeurope\"\n name = \"rg1\"\n}",
16-
"errors": null,
17-
"skippedResources": null
13+
"202": {
14+
"headers": {
15+
"Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzureTerraform/operationStatus/00000000-0000-0000-0000-000000000000?api-version=2023-07-01-preview",
16+
"Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzureTerraform/operationStatus/00000000-0000-0000-0000-000000000000?api-version=2023-07-01-preview"
1817
}
1918
}
2019
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"parameters": {
3+
"subscriptionId": "00000000-0000-0000-0000-000000000000",
4+
"operationId": "00000000-0000-0000-0000-000000000000",
5+
"api-version": "2023-07-01-preview"
6+
},
7+
"responses": {
8+
"200": {
9+
"headers": {},
10+
"body": {
11+
"id": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzureTerraform/operationStatus/00000000-0000-0000-0000-000000000000?api-version=2023-07-01-preview",
12+
"name": "00000000-0000-0000-0000-000000000000",
13+
"startTime": "2024-07-08T08:48:46.3160075Z",
14+
"endTime": "2024-07-08T08:49:23.7083Z",
15+
"status": "Succeeded",
16+
"properties": {
17+
"configuration": "resource \"azurerm_resource_group\" \"res-0\" {\n location = \"westeurope\"\n name = \"rg1\"\n}",
18+
"errors": null,
19+
"skippedResources": null
20+
}
21+
}
22+
},
23+
"202": {
24+
"headers": {
25+
"Azure-AsyncOperation": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzureTerraform/operationStatus/00000000-0000-0000-0000-000000000000?api-version=2023-07-01-preview",
26+
"Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzureTerraform/operationStatus/00000000-0000-0000-0000-000000000000?api-version=2023-07-01-preview"
27+
},
28+
"body": {
29+
"id": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzureTerraform/operationStatus/00000000-0000-0000-0000-000000000000?api-version=2023-07-01-preview",
30+
"name": "00000000-0000-0000-0000-000000000000",
31+
"startTime": "2024-07-08T08:48:46.3160075Z",
32+
"status": "InProgress"
33+
}
34+
}
35+
}
36+
}

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

Lines changed: 129 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,66 @@
7070
}
7171
}
7272
},
73+
"/subscriptions/{subscriptionId}/providers/Microsoft.AzureTerraform/operationStatuses/{operationId}": {
74+
"get": {
75+
"x-ms-examples": {
76+
"Get specific operation status": {
77+
"$ref": "./examples/GetOperationStatus.json"
78+
}
79+
},
80+
"tags": [
81+
"OperationStatuses"
82+
],
83+
"operationId": "OperationStatuses_Get",
84+
"description": "Get the status of a long running azure asynchronous operation.",
85+
"parameters": [
86+
{
87+
"$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/OperationIdParameter"
88+
},
89+
{
90+
"$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/ApiVersionParameter"
91+
},
92+
{
93+
"$ref": "../../../../../common-types/resource-management/v5/types.json#/parameters/SubscriptionIdParameter"
94+
}
95+
],
96+
"responses": {
97+
"200": {
98+
"description": "Finalized operation status.",
99+
"schema": {
100+
"$ref": "#/definitions/OperationStatus"
101+
}
102+
},
103+
"202": {
104+
"description": "InProgress operation status.",
105+
"headers": {
106+
"Location": {
107+
"type": "string",
108+
"description": "The Location header contains the URL where the status of the long running operation can be checked."
109+
},
110+
"Azure-AsyncOperation": {
111+
"type": "string",
112+
"description": "The Azure-AsyncOperation header contains the URL where the status of the long running operation can be checked."
113+
},
114+
"Retry-After": {
115+
"type": "integer",
116+
"format": "int32",
117+
"description": "The Retry-After header can indicate how long the client should wait before polling the operation status."
118+
}
119+
},
120+
"schema": {
121+
"$ref": "#/definitions/OperationStatus"
122+
}
123+
},
124+
"default": {
125+
"description": "Error response returned if request was unsuccessful.",
126+
"schema": {
127+
"$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/ErrorResponse"
128+
}
129+
}
130+
}
131+
}
132+
},
73133
"/subscriptions/{subscriptionId}/providers/Microsoft.AzureTerraform/exportTerraform": {
74134
"post": {
75135
"tags": [
@@ -89,10 +149,22 @@
89149
}
90150
],
91151
"responses": {
92-
"200": {
93-
"description": "OK - Returns the template.",
94-
"schema": {
95-
"$ref": "#/definitions/ExportResult"
152+
"202": {
153+
"description": "Export request accepted.",
154+
"headers": {
155+
"Location": {
156+
"type": "string",
157+
"description": "The Location header contains the URL where the status of the long running operation can be checked."
158+
},
159+
"Azure-AsyncOperation": {
160+
"type": "string",
161+
"description": "The Azure-AsyncOperation header contains the URL where the status of the long running operation can be checked."
162+
},
163+
"Retry-After": {
164+
"type": "integer",
165+
"format": "int32",
166+
"description": "The Retry-After header can indicate how long the client should wait before polling the operation status."
167+
}
96168
}
97169
},
98170
"default": {
@@ -106,7 +178,11 @@
106178
"ExportTerraform": {
107179
"$ref": "./examples/ExportTerraform.json"
108180
}
109-
}
181+
},
182+
"x-ms-long-running-operation-options": {
183+
"final-state-via": "azure-async-operation"
184+
},
185+
"x-ms-long-running-operation": true
110186
}
111187
}
112188
},
@@ -203,7 +279,11 @@
203279
"azurerm",
204280
"azapi"
205281
],
206-
"default": "azurerm"
282+
"default": "azurerm",
283+
"x-ms-enum": {
284+
"name": "targetProvider",
285+
"modelAsString": true
286+
}
207287
},
208288
"fullProperties": {
209289
"description": "Whether to output all non-computed properties in the generated Terraform configuration? This probably needs manual modifications to make it valid",
@@ -257,6 +337,49 @@
257337
"x-ms-identifiers": []
258338
}
259339
}
340+
},
341+
"OperationStatus": {
342+
"description": "The status of the LRO operation.",
343+
"type": "object",
344+
"allOf": [
345+
{
346+
"$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/ErrorResponse"
347+
}
348+
],
349+
"properties": {
350+
"id": {
351+
"type": "string",
352+
"description": "The operation status resource Id."
353+
},
354+
"name": {
355+
"type": "string",
356+
"description": "The operation name."
357+
},
358+
"startTime": {
359+
"type": "string",
360+
"description": "The start time of the operation.",
361+
"format": "date-time",
362+
"readOnly": true
363+
},
364+
"endTime": {
365+
"type": "string",
366+
"description": "The end time of the operation.",
367+
"format": "date-time",
368+
"readOnly": true
369+
},
370+
"status": {
371+
"type": "string",
372+
"description": "The status of the operation."
373+
},
374+
"percentComplete": {
375+
"description": "The progress percentage of the operation, ranges from 0 to 100",
376+
"type": "number",
377+
"format": "double"
378+
},
379+
"properties": {
380+
"$ref": "#/definitions/ExportResult"
381+
}
382+
}
260383
}
261384
},
262385
"parameters": {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Go
2+
3+
These settings apply only when `--go` is specified on the command line.
4+
5+
```yaml $(go) && $(track2)
6+
azure-arm: true
7+
license-header: MICROSOFT_MIT_NO_VERSION
8+
module-name: sdk/resourcemanager/terraform/armterraform
9+
module: github.com/Azure/azure-sdk-for-go/$(module-name)
10+
output-folder: $(go-sdk-folder)/$(module-name)
11+
```

specification/terraform/resource-manager/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ title: AzureTerraformManagementClient
2929
description: AzureTerraform Client
3030
openapi-type: arm
3131
openapi-subtype: providerHub
32-
tag: package-2023-07
32+
tag: package-2023-07-01-preview
3333
```
3434
3535
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- tool: TypeSpecRequirement
2+
path: resource-manager/Microsoft.AzureTerraform/preview/2023-07-01-preview/**/*.json
3+
reason: AzureTerraform service was onboarded before TypeSpec is required. We are bypassing the TypeSpec requirement for development, while will be supporting it in the public swagger repo.

0 commit comments

Comments
 (0)