Skip to content

Commit 568a04b

Browse files
authored
[PS] SpringCloud module migrate to autorest v4 (#27531)
1 parent 5968bcb commit 568a04b

File tree

193 files changed

+9945
-2962
lines changed

Some content is hidden

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

193 files changed

+9945
-2962
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0 (the ""License"");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
// http://www.apache.org/licenses/LICENSE-2.0
6+
// Unless required by applicable law or agreed to in writing, software
7+
// distributed under the License is distributed on an ""AS IS"" BASIS,
8+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
// See the License for the specific language governing permissions and
10+
// limitations under the License.
11+
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
12+
// is regenerated.
13+
14+
using System;
15+
using System.Reflection;
16+
using System.Runtime.CompilerServices;
17+
using System.Runtime.InteropServices;
18+
19+
[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
20+
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
21+
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
22+
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - SpringCloud")]
23+
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.3.2")]
24+
[assembly: System.Reflection.AssemblyVersionAttribute("0.3.2")]
25+
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
26+
[assembly: System.CLSCompliantAttribute(false)]

src/SpringCloud/SpringCloud.Autorest/README.md

Lines changed: 66 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
This directory contains the PowerShell module for the SpringCloud service.
44

55
---
6-
76
## Info
87
- Modifiable: yes
98
- Generated: all
@@ -53,15 +52,22 @@ input-file:
5352

5453
title: SpringCloud
5554
module-version: 0.1.0
56-
resourcegroup-append: true
57-
nested-object-to-string: true
58-
identity-correction-for-post: true
5955

60-
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
61-
use-extension:
62-
"@autorest/powershell": "3.x"
56+
disable-transform-identity-type-for-operation:
57+
- Apps_Update
58+
ps-pipeline-input-disable-getByIteself-and-enable-listByParent: false
6359

6460
directive:
61+
# TODO: retire on March 31, 2028
62+
- where:
63+
verb: (.*)
64+
set:
65+
breaking-change:
66+
deprecated-by-version: 0.3.2
67+
deprecated-by-azversion: 19.3.0
68+
change-effective-date: 2028/03/31
69+
change-description: Azure Spring Apps, including the Standard consumption and dedicated (currently in Public Preview only), Basic, Standard, and Enterprise plans, will be retired, please see details on https://aka.ms/asaretirement.
70+
6571
- where:
6672
verb: Set
6773
subject: BuildServiceAgentPoolPut
@@ -82,12 +88,12 @@ directive:
8288
# First rename parameter of the Get-AzSpringCloudService, then rename cmdlet to Get-AzSpringCloud.
8389
- where:
8490
subject: ^Service$
85-
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$
91+
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
8692
remove: true
8793

8894
- where:
8995
subject: ^Service$
90-
variant: ^Update$|^UpdateViaIdentity$
96+
variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$
9197
remove: true
9298

9399
- where:
@@ -113,7 +119,7 @@ directive:
113119
parameter-name: NetworkProfileServiceRuntimeSubnetId
114120
set:
115121
parameter-name: NetworkProfileServiceSubnetId
116-
# Customization for add default locatio value when not pass location parameter
122+
# Customization for add default location value when not pass location parameter
117123
- where:
118124
verb: New
119125
subject: ^Service$
@@ -185,70 +191,58 @@ directive:
185191
subject: AppDeploymentThreadDump
186192
remove: true
187193
# remove variant
188-
# |Certificate|ConfigurationService
189194
- where:
190-
subject: ^App$|^AppBinding$|^AppDeployment$|^AppCustomDomain$|^|BuildpackBinding$|^BuildServiceBuild$|^BuildServiceBuilder$
191-
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$
195+
subject: ^App$|^AppBinding$|^AppDeployment$|^AppCustomDomain$|^BuildpackBinding$|^BuildServiceBuild$|^BuildServiceBuilder$|^TestKey$|^ConfigServer$|^MonitoringSetting$|^BuildServiceAgentPool$|Certificate|ConfigurationService
196+
variant: ^(Create|Update|Generate)(?!.*?(Expanded|JsonFilePath|JsonString))
192197
remove: true
193198
- where:
194-
subject: ^AppDeploymentHeapDump$|^AppDeploymentThreadDump$|^TestKey$
195-
variant: ^Generate$|^GenerateViaIdentity$|^GenerateViaIdentityExpanded$
196-
remove: true
197-
198-
- where:
199-
verb: Get
200-
subject: BuildServiceBuildResultLog
201-
variant: GetViaIdentity
199+
subject: ^App$|^AppBinding$|^AppDeployment$|^AppCustomDomain$|^BuildpackBinding$|^BuildServiceBuild$|^BuildServiceBuilder$|^TestKey$|Certificate|ConfigurationService
200+
variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$
202201
remove: true
203202

204203
- where:
205204
verb: Get
206205
subject: ^Registry$|^BuildService$|^BuildServiceAgentPool$|^ConfigurationService$
207206
variant: List
208207
remove: true
209-
210208

211209
- where:
212210
subject: ^TestKey$
213-
variant: ^Regenerate$|^RegenerateViaIdentity$|^RegenerateViaIdentityExpanded$
211+
variant: ^Regenerate(?!.*?(Expanded|JsonFilePath|JsonString))
214212
remove: true
215213

216214
- where:
217215
subject: ^AppActiveDeployment$
218-
variant: ^SetViaIdentity$|^Set$
219-
remove: true
220-
221-
- where:
222-
subject: ^DeploymentJfr$
223-
variant: ^Start$|^StartViaIdentity$
224-
remove: true
225-
226-
- where:
227-
verb: Test
228-
subject: ^AppCustomDomain$
229-
variant: ^Validate$|^ValidateViaIdentity$
216+
variant: ^(Set)(?!.*?(Expanded|JsonFilePath|JsonString))
230217
remove: true
231218

232219
- where:
233220
verb: Test
234-
subject: ^ConfigServer$|^ConfigurationService$
235-
variant: ^Validate$|^ValidateViaIdentity$
221+
subject: ^AppCustomDomain$|^ConfigServer$|^ConfigurationService$
222+
variant: ^(Validate)(?!.*?(Expanded|JsonFilePath|JsonString))|^ValidateViaIdentity$
236223
remove: true
237224

238225
- where:
239226
verb: Test
240227
subject: ^NameAvailability$
241-
variant: ^Check$|^CheckViaIdentity$|^CheckViaIdentityExpanded$
228+
variant: ^(Check)(?!.*?Expanded)|^CheckViaIdentityExpanded$|^CheckViaIdentity$
242229
remove: true
243230

244231
- where:
245232
subject: ^AppDeploymentJfr$
246-
variant: ^Start$|^StartViaIdentity$
233+
variant: ^(Start)(?!.*?Expanded)$
247234
remove: true
248235

249-
- where:
250-
subject: ^App$|^AppBinding$|^AppDeployment$|^AppCustomDomain$|^ConfigServer$|^MonitoringSetting$|^BuildServiceAgentPool$
251-
variant: ^Update$|^UpdateViaIdentity$
236+
# Disable parent resource variant of default child name
237+
- where:
238+
verb: Get
239+
subject: ^BuildServiceAgentPool$|^ConfigurationService$|^Registry$
240+
variant: ^GetViaIdentitySpring$|^DeleteViaIdentitySpring$
241+
remove: true
242+
- where:
243+
verb: Get
244+
subject: ^BuildServiceAgentPool$|^BuildService$|^BuildServiceBuilder$|^BuildServiceSupportedBuildpack$|^BuildServiceSupportedStack$|^BuildpackBinding$
245+
variant: ^GetViaIdentityBuildService$|^DeleteViaIdentityBuildService$
252246
remove: true
253247

254248
# rename parameter
@@ -423,6 +417,10 @@ directive:
423417
subject: ^BuildServiceResourceUploadUrl$
424418
hide: true
425419

420+
- where:
421+
verb: Update
422+
subject: ^BuildService$
423+
hide: true
426424
- where:
427425
subject: ^BuildServiceBuild$
428426
hide: true
@@ -433,7 +431,7 @@ directive:
433431
subject: ^BuildServiceBuildResultLog$
434432
hide: true
435433

436-
# Customization for add default locatio value when not pass location parameter
434+
# Customization for add default location value when not pass location parameter
437435
- where:
438436
verb: New
439437
subject: ^App$
@@ -539,22 +537,31 @@ directive:
539537
- UserSourceInfo
540538
- CertificateProperties
541539

542-
- model-cmdlet:
543-
# - BuildpacksGroupProperties
544-
# - BuildpackProperties
545-
- ConfigurationServiceGitRepository
546-
- GitPatternRepository
547-
# - KeyVaultCertificateProperties
548-
# - ContentCertificateProperties
549-
# - LoadedCertificate
550-
# --> rename New-AzSpringCloudLoadedCertificateObject New-AzSpringCloudAppLoadedCertificateObject
551-
# - JarUploadedUserSourceInfo
552-
# --> rename New-AzSpringCloudDeploymentJarUploadedObject --> New-AzSpringCloudAppDeploymentJarUploadedObject
553-
# - NetCoreZipUploadedUserSourceInfo
554-
# --> rename New-AzSpringCloudDeploymentNetCoreZipUploadedObject --> New-AzSpringCloudAppDeploymentNetCoreZipUploadedObject
555-
# - SourceUploadedUserSourceInfo
556-
# --> rename New-AzSpringCloudDeploymentSourceUploadedObject --> New-AzSpringCloudAppDeploymentSourceUploadedObject
557-
# - BuildResultUserSourceInfo --> New-AzSpringCloudAppDeploymentBuildResultObject
540+
# add retirement message
541+
# - model-cmdlet:
542+
# - model-name: BuildpacksGroupProperties
543+
# cmdlet-name: New-AzSpringCloudBuildpacksGroupObject
544+
# - model-name: BuildpackProperties
545+
# cmdlet-name: New-AzSpringCloudBuildpackObject
546+
# - model-name: ConfigurationServiceGitRepository
547+
# - model-name: GitPatternRepository
548+
# - model-name: ContentCertificateProperties
549+
# cmdlet-name: New-AzSpringCloudContentCertificateObject
550+
# - model-name: LoadedCertificate
551+
# cmdlet-name: New-AzSpringCloudAppLoadedCertificateObject
552+
# Customized parameter names
553+
# - model-name: KeyVaultCertificateProperties
554+
# cmdlet-name: New-AzSpringCloudKeyVaultCertificateObject
555+
# Customized RelativePath with '<default>' value
556+
# - model-name: JarUploadedUserSourceInfo
557+
# cmdlet-name: New-AzSpringCloudAppDeploymentJarUploadedObject
558+
# - model-name: NetCoreZipUploadedUserSourceInfo
559+
# cmdlet-name: New-AzSpringCloudAppDeploymentNetCoreZipUploadedObject
560+
# - model-name: SourceUploadedUserSourceInfo
561+
# cmdlet-name: New-AzSpringCloudAppDeploymentSourceUploadedObject
562+
# Customized BuildResultId with '<default>' value
563+
# - model-name: BuildResultUserSourceInfo
564+
# cmdlet-name: New-AzSpringCloudAppDeploymentBuildResultObject
558565

559566
- where:
560567
subject-prefix: SpringCloud

src/SpringCloud/SpringCloud.Autorest/custom/Deploy-AzSpringCloudApp.ps1

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ PS C:\> {{ Add code here }}
2828
{{ Add output here }}
2929
3030
.Outputs
31-
Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20220401.IAppResource
31+
Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.IAppResource
3232
.Link
3333
https://learn.microsoft.com/powershell/module/az.SpringCloud/deploy-azSpringCloudapp
3434
#>
3535
function Deploy-AzSpringCloudApp {
36-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20220401.IAppResource])]
37-
[CmdletBinding(DefaultParameterSetName='DeployAppForStandard', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
36+
[Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.CmdletBreakingChange("19.3.0", "0.3.2", "2028/03/31", ChangeDescription = "Azure Spring Apps, including the Standard consumption and dedicated (currently in Public Preview only), Basic, Standard, and Enterprise plans, will be retired, please see details on https://aka.ms/asaretirement.")]
37+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.IAppResource])]
38+
[CmdletBinding(DefaultParameterSetName='DeployAppForStandard', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
3839
param(
3940
[Parameter(Mandatory)]
4041
[Alias('AppName')]
@@ -240,19 +241,19 @@ function DeployStandardSpringCloudApp {
240241
$deployment = Get-AzSpringCloudAppDeployment -ResourceGroupName $ResourceGroupName -ServiceName $ServiceName -AppName $AppName -Name $DeploymentName @DeployPSBoundParameters
241242
if ($deployment.Source.Type -eq 'Jar')
242243
{
243-
$source = [Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20220401.JarUploadedUserSourceInfo]::New()
244+
$source = [Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.JarUploadedUserSourceInfo]::New()
244245
$source.RelativePath = $RelativePath
245246
$source.Type = $deployment.Source.Type
246247
}
247248
if ($deployment.Source.Type -eq 'NetCoreZip')
248249
{
249-
$source = [Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20220401.NetCoreZipUploadedUserSourceInfo]::New()
250+
$source = [Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.NetCoreZipUploadedUserSourceInfo]::New()
250251
$source.RelativePath = $RelativePath
251252
$source.Type = $deployment.Source.Type
252253
}
253254
if ($deployment.Source.Type -eq 'Source')
254255
{
255-
$source = [Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20220401.SourceUploadedUserSourceInfo]::New()
256+
$source = [Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.SourceUploadedUserSourceInfo]::New()
256257
$source.RelativePath = $RelativePath
257258
$source.Type = $deployment.Source.Type
258259
}
@@ -297,7 +298,7 @@ function DeployEnterpriseSpringCloudApp {
297298
throw "Service build failed, Log file url: $resultFailedLog"
298299
}
299300
} until ($result.ProvisioningState -eq 'Succeeded')
300-
$buildResult = [Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20220401.BuildResultUserSourceInfo]::New()
301+
$buildResult = [Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.BuildResultUserSourceInfo]::New()
301302
$buildResult.Type = "BuildResult"
302303
$buildResult.BuildResultId = $result.Id
303304
$null = Update-AzSpringCloudAppDeployment -ResourceGroupName $ResourceGroupName -ServiceName $ServiceName -AppName $AppName -Name $DeploymentName -Source $buildResult @DeployPSBoundParameters

src/SpringCloud/SpringCloud.Autorest/custom/New-AzSpringCloud.ps1

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,21 @@
1616

1717
<#
1818
.Synopsis
19-
Create a new Service or update an exiting Service.
19+
create a new Service or update an exiting Service.
2020
.Description
21-
Create a new Service or update an exiting Service.
21+
create a new Service or update an exiting Service.
2222
.Example
2323
New-AzSpringCloud -ResourceGroupName spring-cloud-rp -name spring-cloud-service -Location eastus
2424
2525
.Outputs
26-
Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20220401.IServiceResource
26+
Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.IServiceResource
2727
.Link
2828
https://learn.microsoft.com/powershell/module/az.springcloud/new-azspringcloud
2929
#>
3030
function New-AzSpringCloud {
31-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20220401.IServiceResource])]
32-
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
31+
[Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.CmdletBreakingChange("19.3.0", "0.3.2", "2028/03/31", ChangeDescription = "Azure Spring Apps, including the Standard consumption and dedicated (currently in Public Preview only), Basic, Standard, and Enterprise plans, will be retired, please see details on https://aka.ms/asaretirement.")]
32+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.IServiceResource])]
33+
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
3334
param(
3435
[Parameter(Mandatory)]
3536
[Alias('ServiceName')]
@@ -109,7 +110,7 @@ param(
109110

110111
[Parameter()]
111112
[Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Category('Body')]
112-
[Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.Api20220401.ITrackedResourceTags]))]
113+
[Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Models.ITrackedResourceTags]))]
113114
[System.Collections.Hashtable]
114115
# Tags of the service which is a list of key value pairs that describe the resource.
115116
${Tag},
@@ -125,7 +126,8 @@ param(
125126
[ValidateNotNull()]
126127
[Microsoft.Azure.PowerShell.Cmdlets.SpringCloud.Category('Azure')]
127128
[System.Management.Automation.PSObject]
128-
# The credentials, account, tenant, and subscription used for communication with Azure.
129+
# The DefaultProfile parameter is not functional.
130+
# Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
129131
${DefaultProfile},
130132

131133
[Parameter()]
@@ -186,5 +188,5 @@ param(
186188
$PSBoundParameters.Add('Location', $ResourceGroup.Location)
187189
}
188190
Az.SpringCloud.internal\New-AzSpringCloud @PSBoundParameters
189-
}
191+
}
190192
}

0 commit comments

Comments
 (0)