Skip to content

Commit 8538617

Browse files
authored
[PS] migrate ServiceLinker module to autorest v4 (#27768)
1 parent 1eb7acb commit 8538617

File tree

80 files changed

+699
-441
lines changed

Some content is hidden

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

80 files changed

+699
-441
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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 - ServiceLinker")]
23+
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.2.3")]
24+
[assembly: System.Reflection.AssemblyVersionAttribute("0.2.3")]
25+
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
26+
[assembly: System.CLSCompliantAttribute(false)]
27+
28+
29+

src/ServiceLinker/ServiceLinker.Autorest/README.md

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,12 @@ module-version: 0.1.1
4343
title: ServiceLinker
4444
# subject-prefix: "ServiceLinker"
4545

46-
# If there are post APIs for some kinds of actions in the RP, you may need to
47-
# uncomment following line to support viaIdentity for these post APIs
48-
# identity-correction-for-post: true
49-
50-
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
51-
use-extension:
52-
"@autorest/powershell": "3.x"
53-
5446
directive:
5547
# Following is two common directive which are normally required in all the RPs
5648
# 1. Remove the unexpanded parameter set
5749
# 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
5850
- where:
59-
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
51+
variant: ^(Create|Update)(?!.*?Expanded)
6052
remove: true
6153
# Remove the set-* cmdlet
6254
- where:
@@ -85,17 +77,17 @@ directive:
8577
- SecretInfoBase
8678
- AzureResourcePropertiesBase
8779
# - model-cmdlet:
88-
# - AzureResource
89-
# - AzureKeyVaultProperties
90-
# - ConfluentBootstrapServer
91-
# - ConfluentSchemaRegistry
92-
# - SecretAuthInfo
93-
# - UserAssignedIdentityAuthInfo
94-
# - SystemAssignedIdentityAuthInfo
95-
# - ServicePrincipalSecretAuthInfo
96-
# - ValueSecretInfo
97-
# - KeyVaultSecretReferenceSecretInfo
98-
# - KeyVaultSecretUriSecretInfo
80+
# - model-name: AzureResource
81+
# - model-name: AzureKeyVaultProperties
82+
# - model-name: ConfluentBootstrapServer
83+
# - model-name: ConfluentSchemaRegistry
84+
# - model-name: SecretAuthInfo
85+
# - model-name: UserAssignedIdentityAuthInfo
86+
# - model-name: SystemAssignedIdentityAuthInfo
87+
# - model-name: ServicePrincipalSecretAuthInfo
88+
# - model-name: ValueSecretInfo
89+
# - model-name: KeyVaultSecretReferenceSecretInfo
90+
# - model-name: KeyVaultSecretUriSecretInfo
9991
- where:
10092
verb: New
10193
parameter-name: Name

src/ServiceLinker/ServiceLinker.Autorest/custom/Get-AzServiceLinkerConfigurationForContainerApp.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ list source configurations for a linker in container app.
2424
https://learn.microsoft.com/powershell/module/az.servicelinker/get-azservicelinkerconfigurationforcontainerapp
2525
#>
2626
function Get-AzServiceLinkerConfigurationForContainerApp {
27-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.Api20221101Preview.ISourceConfiguration])]
27+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.ISourceConfiguration])]
2828
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
2929
param(
3030
[Parameter(Mandatory)]

src/ServiceLinker/ServiceLinker.Autorest/custom/Get-AzServiceLinkerConfigurationForSpringCloud.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ list source configurations for a linker in spring cloud.
2323
https://learn.microsoft.com/powershell/module/az.servicelinker/get-azservicelinkerconfigurationforspringcloud
2424
#>
2525
function Get-AzServiceLinkerConfigurationForSpringCloud {
26-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.Api20221101Preview.ISourceConfiguration])]
26+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.ISourceConfiguration])]
2727
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
2828
param(
2929
[Parameter(Mandatory)]

src/ServiceLinker/ServiceLinker.Autorest/custom/Get-AzServiceLinkerConfigurationForWebApp.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ list source configurations for a linker in webapp.
2323
https://learn.microsoft.com/powershell/module/az.servicelinker/get-azservicelinkerconfigurationforwebapp
2424
#>
2525
function Get-AzServiceLinkerConfigurationForWebApp {
26-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.Api20221101Preview.ISourceConfiguration])]
26+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.ISourceConfiguration])]
2727
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
2828
param(
2929
[Parameter(Mandatory)]

src/ServiceLinker/ServiceLinker.Autorest/custom/Get-AzServiceLinkerForContainerApp.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ INPUTOBJECT <IServiceLinkerIdentity>: Identity Parameter
3434
https://learn.microsoft.com/powershell/module/az.servicelinker/get-azservicelinkerforcontainerapp
3535
#>
3636
function Get-AzServiceLinkerForContainerApp {
37-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.Api20221101Preview.ILinkerResource])]
37+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.ILinkerResource])]
3838
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
3939
param(
4040
[Parameter(ParameterSetName='Get', Mandatory)]

src/ServiceLinker/ServiceLinker.Autorest/custom/Get-AzServiceLinkerForSpringCloud.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ INPUTOBJECT <IServiceLinkerIdentity>: Identity Parameter
3535
https://learn.microsoft.com/powershell/module/az.servicelinker/get-azservicelinkerforspringcloud
3636
#>
3737
function Get-AzServiceLinkerForSpringCloud {
38-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.Api20221101Preview.ILinkerResource])]
38+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.ILinkerResource])]
3939
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
4040
param(
4141
[Parameter(ParameterSetName='Get', Mandatory)]

src/ServiceLinker/ServiceLinker.Autorest/custom/Get-AzServiceLinkerForWebApp.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ INPUTOBJECT <IServiceLinkerIdentity>: Identity Parameter
3535
https://learn.microsoft.com/powershell/module/az.servicelinker/get-azservicelinkerforwebapp
3636
#>
3737
function Get-AzServiceLinkerForWebApp {
38-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.Api20221101Preview.ILinkerResource])]
38+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.ILinkerResource])]
3939
[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)]
4040
param(
4141
[Parameter(ParameterSetName='Get', Mandatory)]

src/ServiceLinker/ServiceLinker.Autorest/custom/New-AzServiceLinkerAzureResourceObject.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,33 @@ Create an in-memory object for AzureResource.
2121
Create an in-memory object for AzureResource.
2222
2323
.Outputs
24-
Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.Api20221101Preview.AzureResource
24+
Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.AzureResource
2525
.Link
2626
https://learn.microsoft.com/powershell/module/az.ServiceLinker/new-azservicelinkerazureresourceobject
2727
#>
2828
function New-AzServiceLinkerAzureResourceObject {
29-
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.Api20221101Preview.AzureResource')]
29+
[Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.ModelCmdletAttribute()]
30+
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.AzureResource')]
3031
[CmdletBinding(PositionalBinding=$false)]
3132
Param(
3233

3334
[Parameter(Mandatory, HelpMessage="The Id of azure resource.")]
3435
[string]
3536
$Id,
3637
# [Parameter(HelpMessage="The azure resource connection related properties.")]
37-
# [Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.Api20221101Preview.IAzureResourcePropertiesBase]
38+
# [Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.IAzureResourcePropertiesBase]
3839
# $ResourceProperty,
3940
[Parameter(HelpMessage="True if connect via Kubernetes CSI Driver. Source must be AKS and target must be KeyVault.")]
4041
[bool]
4142
$ConnectAsKubernetesCsiDriver,
4243
[Parameter(DontShow, HelpMessage="The target service type.")]
4344
[Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Runtime.DefaultInfo(Script='"AzureResource"')]
44-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Support.TargetServiceType])]
45-
[Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Support.TargetServiceType]
45+
[string]
4646
$Type
4747
)
4848

4949
process {
50-
$Object = [Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.Api20221101Preview.AzureResource]::New()
50+
$Object = [Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.AzureResource]::New()
5151

5252
if ($PSBoundParameters.ContainsKey('Id')) {
5353
$Pattern = "/subscriptions/(?<subscriptionId>[^/]+)/resourceGroups/(?<resourceGroupName>[^/]+)/providers/(?<resourceProvider>[^/]+)(/(?<resourceType>[^/]+)/(?<resourceName>[^/]+))+"
@@ -57,7 +57,7 @@ function New-AzServiceLinkerAzureResourceObject {
5757
$Object.Id = $Id
5858
}
5959
if ($PSBoundParameters.ContainsKey('ConnectAsKubernetesCsiDriver')) {
60-
$ResourceProperty = [Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.Api20221101Preview.AzureKeyVaultProperties]::New()
60+
$ResourceProperty = [Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.AzureKeyVaultProperties]::New()
6161
$ResourceProperty.ConnectAsKubernetesCsiDriver = $ConnectAsKubernetesCsiDriver
6262
$Object.ResourceProperty = $ResourceProperty
6363
}

src/ServiceLinker/ServiceLinker.Autorest/custom/New-AzServiceLinkerConfluentBootstrapServerObject.ps1

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,23 @@ Create an in-memory object for ConfluentBootstrapServer.
2121
Create an in-memory object for ConfluentBootstrapServer.
2222
2323
.Outputs
24-
Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.Api20221101Preview.ConfluentBootstrapServer
24+
Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.ConfluentBootstrapServer
2525
.Link
2626
https://learn.microsoft.com/powershell/module/az.ServiceLinker/new-azservicelinkerconfluentbootstrapserverobject
2727
#>
2828
function New-AzServiceLinkerConfluentBootstrapServerObject {
29-
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.Api20221101Preview.ConfluentBootstrapServer')]
29+
[Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.ModelCmdletAttribute()]
30+
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.ConfluentBootstrapServer')]
3031
[CmdletBinding(PositionalBinding=$false)]
3132
Param(
3233

3334
[Parameter(Mandatory, HelpMessage="The endpoint of service.")]
3435
[string]
35-
$Endpoint,
36-
[Parameter(DontShow, HelpMessage="The target service type.")]
37-
[Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Runtime.DefaultInfo(Script='"ConfluentBootstrapServer"')]
38-
[ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Support.TargetServiceType])]
39-
[Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Support.TargetServiceType]
40-
$Type
36+
$Endpoint
4137
)
4238

4339
process {
44-
$Object = [Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.Api20221101Preview.ConfluentBootstrapServer]::New()
40+
$Object = [Microsoft.Azure.PowerShell.Cmdlets.ServiceLinker.Models.ConfluentBootstrapServer]::New()
4541

4642
if ($PSBoundParameters.ContainsKey('Endpoint')) {
4743
if($Endpoint -notmatch ".*confluent.cloud:[0-9]*") {
@@ -50,9 +46,6 @@ function New-AzServiceLinkerConfluentBootstrapServerObject {
5046

5147
$Object.Endpoint = $Endpoint
5248
}
53-
if ($PSBoundParameters.ContainsKey('Type')) {
54-
$Object.Type = $Type
55-
}
5649
return $Object
5750
}
5851
}

0 commit comments

Comments
 (0)