Skip to content

Commit d8fc592

Browse files
authored
[PS] Migrate Nginx module to autorest v4 (#28236)
1 parent c67b70a commit d8fc592

File tree

60 files changed

+4733
-999
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+4733
-999
lines changed

src/Nginx/Nginx.Autorest/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
2121
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
2222
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - Nginx")]
23-
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.2.0")]
24-
[assembly: System.Reflection.AssemblyVersionAttribute("1.2.0")]
23+
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.2.1")]
24+
[assembly: System.Reflection.AssemblyVersionAttribute("1.2.1")]
2525
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
2626
[assembly: System.CLSCompliantAttribute(false)]
27-

src/Nginx/Nginx.Autorest/README.md

Lines changed: 32 additions & 237 deletions
Original file line numberDiff line numberDiff line change
@@ -38,271 +38,66 @@ root-module-name: $(prefix).Nginx
3838
title: Nginx
3939
module-version: 0.1.0
4040
subject-prefix: Nginx
41-
nested-object-to-string: true
42-
43-
# If there are post APIs for some kinds of actions in the RP, you may need to
44-
# uncomment following line to support viaIdentity for these post APIs
45-
# identity-correction-for-post: true
46-
47-
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
48-
use-extension:
49-
"@autorest/powershell": "3.x"
41+
flatten-userassignedidentity: false
42+
disable-transform-identity-type: true
5043

5144
directive:
5245
# Following is two common directive which are normally required in all the RPs
5346
# 1. Remove the unexpanded parameter set
5447
# 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
5548
- where:
56-
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
49+
variant: ^(Create|Update|Analysis)(?!.*?(Expanded|JsonFilePath|JsonString))|^CreateViaIdentityExpanded$
5750
remove: true
5851
- where:
5952
subject: Configuration|Certificate|Deployment
6053
verb: Set
6154
remove: true
62-
# ProvisioningState readonly
55+
- where:
56+
subject: Deployment
57+
variant: CreateExpanded|UpdateExpanded|UpdateViaIdentityExpanded
58+
hide: true
59+
# Required properties for deployment
6360
- from: swagger-document
64-
where: $.definitions.ProvisioningState
61+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}"].put.parameters[4]
6562
transform: >-
6663
return {
67-
"enum": [
68-
"Accepted",
69-
"Creating",
70-
"Updating",
71-
"Deleting",
72-
"Succeeded",
73-
"Failed",
74-
"Canceled",
75-
"Deleted",
76-
"NotSpecified"
77-
],
78-
"type": "string",
79-
"readOnly": true,
80-
"x-ms-enum": {
81-
"modelAsString": true,
82-
"name": "ProvisioningState"
64+
"in": "body",
65+
"name": "body",
66+
"required": true,
67+
"schema": {
68+
"$ref": "#/definitions/NginxDeployment"
8369
}
8470
}
85-
# Required properties for deployment
8671
- from: swagger-document
8772
where: $.definitions.NginxDeploymentProperties
88-
transform: >-
89-
return {
90-
"type": "object",
91-
"properties": {
92-
"provisioningState": {
93-
"$ref": "#/definitions/ProvisioningState"
94-
},
95-
"nginxVersion": {
96-
"type": "string",
97-
"readOnly": true
98-
},
99-
"managedResourceGroup": {
100-
"type": "string",
101-
"description": "The managed resource group to deploy VNet injection related network resources."
102-
},
103-
"networkProfile": {
104-
"$ref": "#/definitions/NginxNetworkProfile"
105-
},
106-
"ipAddress": {
107-
"type": "string",
108-
"description": "The IP address of the deployment.",
109-
"readOnly": true
110-
},
111-
"enableDiagnosticsSupport": {
112-
"type": "boolean"
113-
},
114-
"logging": {
115-
"$ref": "#/definitions/NginxLogging"
116-
},
117-
"scalingProperties": {
118-
"$ref": "#/definitions/NginxDeploymentScalingProperties"
119-
},
120-
"userProfile": {
121-
"$ref": "#/definitions/NginxDeploymentUserProfile"
122-
}
123-
},
124-
"required": [
125-
"networkProfile"
126-
]
127-
}
73+
transform: $['required']= ['networkProfile']
12874
- from: swagger-document
12975
where: $.definitions.NginxDeployment
130-
transform: >-
131-
return {
132-
"type": "object",
133-
"x-ms-azure-resource": true,
134-
"properties": {
135-
"id": {
136-
"type": "string",
137-
"readOnly": true
138-
},
139-
"name": {
140-
"type": "string",
141-
"readOnly": true
142-
},
143-
"type": {
144-
"type": "string",
145-
"readOnly": true
146-
},
147-
"identity": {
148-
"$ref": "#/definitions/IdentityProperties"
149-
},
150-
"properties": {
151-
"$ref": "#/definitions/NginxDeploymentProperties"
152-
},
153-
"tags": {
154-
"type": "object",
155-
"additionalProperties": {
156-
"type": "string"
157-
}
158-
},
159-
"sku": {
160-
"$ref": "#/definitions/ResourceSku",
161-
},
162-
"location": {
163-
"type": "string",
164-
},
165-
"systemData": {
166-
"$ref": "../../../../../common-types/resource-management/v2/types.json#/definitions/systemData",
167-
"readOnly": true
168-
}
169-
},
170-
"required": [
171-
"properties",
172-
"location",
173-
"sku"
174-
]
175-
}
76+
transform: $['required'] = ['properties','location','sku']
17677
# Required properties for Certificates
17778
- from: swagger-document
178-
where: $.definitions.NginxCertificate
79+
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/certificates/{certificateName}"].put.parameters[5]
17980
transform: >-
18081
return {
181-
"type": "object",
182-
"x-ms-azure-resource": true,
183-
"properties": {
184-
"id": {
185-
"type": "string",
186-
"readOnly": true
187-
},
188-
"name": {
189-
"type": "string",
190-
"readOnly": true
191-
},
192-
"type": {
193-
"type": "string",
194-
"readOnly": true
195-
},
196-
"properties": {
197-
"$ref": "#/definitions/NginxCertificateProperties"
198-
},
199-
"location": {
200-
"type": "string"
201-
},
202-
"systemData": {
203-
"$ref": "../../../../../common-types/resource-management/v2/types.json#/definitions/systemData",
204-
"readOnly": true
205-
}
206-
},
207-
"required": [
208-
"properties"
209-
]
82+
"in": "body",
83+
"name": "body",
84+
"required": true,
85+
"description": "The certificate",
86+
"schema": {
87+
"$ref": "#/definitions/NginxCertificate"
88+
}
21089
}
90+
- from: swagger-document
91+
where: $.definitions.NginxCertificate
92+
transform: $['required'] = ['properties']
21193
- from: swagger-document
21294
where: $.definitions.NginxCertificateProperties
213-
transform: >-
214-
return {
215-
"type": "object",
216-
"properties": {
217-
"provisioningState": {
218-
"$ref": "#/definitions/ProvisioningState"
219-
},
220-
"keyVirtualPath": {
221-
"type": "string"
222-
},
223-
"certificateVirtualPath": {
224-
"type": "string"
225-
},
226-
"keyVaultSecretId": {
227-
"type": "string"
228-
}
229-
},
230-
"required": [
231-
"keyVirtualPath",
232-
"certificateVirtualPath",
233-
"keyVaultSecretId"
234-
]
235-
}
95+
transform: $['required'] = ['keyVirtualPath', 'certificateVirtualPath', 'keyVaultSecretId']
23696
- model-cmdlet:
237-
- NginxConfigurationFile
238-
- NginxPrivateIPAddress
239-
- NginxPublicIPAddress
240-
# - NginxNetworkProfile
97+
- model-name: NginxConfigurationFile
98+
- model-name: NginxPrivateIPAddress
99+
- model-name: NginxPublicIPAddress
100+
- model-name: NginxNetworkProfile
241101
- no-inline:
242102
- NginxNetworkProfile
243-
- where:
244-
verb: Get|Update|New
245-
subject: Configuration
246-
set:
247-
breaking-change:
248-
deprecated-output-properties:
249-
- File
250-
- ProtectedFile
251-
- PackageProtectedFile
252-
new-output-properties:
253-
- File
254-
- ProtectedFile
255-
- PackageProtectedFile
256-
change-description: The types of the properties File, ProtectedFile and PackageProtectedFile will be changed from fixed array to 'List'.
257-
deprecated-by-version: 2.0.0
258-
deprecated-by-azversion: 15.0.0
259-
change-effective-date: 2025/11/03
260-
- where:
261-
verb: Get|Update|New
262-
subject: Deployment
263-
set:
264-
breaking-change:
265-
deprecated-output-properties:
266-
- PrivateIPAddress
267-
- PublicIPAddress
268-
- AutoScaleSettingProfile
269-
new-output-properties:
270-
- PrivateIPAddress
271-
- PublicIPAddress
272-
- AutoScaleSettingProfile
273-
change-description: The types of the properties PrivateIPAddress, ProtectedFile and AutoScaleSettingProfile will be changed from fixed array to 'List'.
274-
deprecated-by-version: 2.0.0
275-
deprecated-by-azversion: 15.0.0
276-
change-effective-date: 2025/11/03
277-
- where:
278-
verb: Invoke
279-
subject: AnalysisConfiguration
280-
set:
281-
breaking-change:
282-
deprecated-output-properties:
283-
- DataError
284-
new-output-properties:
285-
- DataError
286-
change-description: The type of the property DataError will be changed from fixed array to 'List'.
287-
deprecated-by-version: 7.0.0
288-
deprecated-by-azversion: 15.0.0
289-
change-effective-date: 2025/11/03
290-
- where:
291-
verb: Invoke
292-
subject: AnalysisConfiguration
293-
variant: ^Analysis$|^AnalysisViaIdentity$
294-
set:
295-
breaking-change:
296-
change-description: The parameter set 'Analysis' and 'AnalysisViaIdentity' will be removed.
297-
deprecated-by-version: 7.0.0
298-
deprecated-by-azversion: 15.0.0
299-
change-effective-date: 2025/11/03
300-
- where:
301-
parameter-name: IdentityType|IdentityUserAssignedIdentity
302-
set:
303-
breaking-change:
304-
change-description: The cmdlet 'New-AzNginxDeployment' no longer supports the parameter 'IdentityType' and IdentityUserAssignedIdentity.
305-
deprecated-by-version: 2.0.0
306-
deprecated-by-azversion: 15.0.0
307-
change-effective-date: 2025/11/03
308103
```

src/Nginx/Nginx.Autorest/UX/Nginx.NginxPlus/nginxDeployments-configurations.json

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -48,49 +48,6 @@
4848
}
4949
]
5050
},
51-
{
52-
"name": "Invoke-AzNginxAnalysisConfiguration",
53-
"description": "Analyze an NGINX configuration without applying it to the NGINXaaS deployment",
54-
"path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Nginx.NginxPlus/nginxDeployments/{deploymentName}/configurations/{configurationName}/analyze",
55-
"help": {
56-
"learnMore": {
57-
"url": "https://learn.microsoft.com/powershell/module/az.nginx/invoke-aznginxanalysisconfiguration"
58-
},
59-
"parameterSets": [
60-
{
61-
"parameters": [
62-
"-ConfigurationName <String>",
63-
"-DeploymentName <String>",
64-
"-ResourceGroupName <String>",
65-
"[-SubscriptionId <String>]"
66-
]
67-
}
68-
]
69-
},
70-
"examples": [
71-
{
72-
"description": "Analyze an NGINX configuration without applying it to the NGINXaaS deployment",
73-
"parameters": [
74-
{
75-
"name": "-ConfigurationName",
76-
"value": "[Path.configurationName]"
77-
},
78-
{
79-
"name": "-DeploymentName",
80-
"value": "[Path.deploymentName]"
81-
},
82-
{
83-
"name": "-ResourceGroupName",
84-
"value": "[Path.resourceGroupName]"
85-
},
86-
{
87-
"name": "-SubscriptionId",
88-
"value": "[Path.subscriptionId]"
89-
}
90-
]
91-
}
92-
]
93-
},
9451
{
9552
"name": "Remove-AzNginxConfiguration",
9653
"description": "Reset the NGINX configuration of given NGINX deployment to default",

0 commit comments

Comments
 (0)