Skip to content

Commit 6b9629c

Browse files
authored
[Az.DiskPool] Update generation tool version: autorest.powershell v3->v4 (Azure#27623)
1 parent 06030f7 commit 6b9629c

Some content is hidden

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

45 files changed

+894
-237
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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 - DiskPool")]
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)]
27+
28+

src/DiskPool/DiskPool.Autorest/README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,16 @@ input-file:
3737
module-version: 0.1.0
3838
title: DiskPool
3939
subject-prefix: $(service-name)
40-
identity-correction-for-post: true
41-
nested-object-to-string: true
42-
resourcegroup-append: true
43-
44-
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
45-
use-extension:
46-
"@autorest/powershell": "3.x"
4740

4841
directive:
4942
# Following is two common directive which are normally required in all the RPs
5043
# 1. Remove the unexpanded parameter set
5144
# 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
5245
- where:
53-
variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
46+
variant: ^(Create|Update)(?!.*?(Expanded|JsonFilePath|JsonString))
47+
remove: true
48+
- where:
49+
variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$
5450
remove: true
5551
# Remove the set-* cmdlet
5652
- where:
@@ -97,8 +93,10 @@ directive:
9793
subject: DiskPool
9894
hide: true
9995
- model-cmdlet:
100-
- Acl
101-
- IscsiLun
96+
- model-name: Acl
97+
cmdlet-name: New-AzDiskPoolAclObject
98+
- model-name: IscsiLun
99+
cmdlet-name: New-AzDiskPoolIscsiLunObject
102100
- where:
103101
model-name: DiskPoolZoneInfo
104102
set:

src/DiskPool/DiskPool.Autorest/custom/New-AzDiskPool.ps1

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Name Location Status ProvisioningState AvailabilityZone
3030
disk-pool-1 eastus2euap Running Succeeded {3}
3131
3232
.Outputs
33-
Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Api20210801.IDiskPool
33+
Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.IDiskPool
3434
.Notes
3535
COMPLEX PARAMETER PROPERTIES
3636
@@ -42,7 +42,7 @@ DISKID <string[]>: List of Azure Managed Disks to attach to a Disk Pool.
4242
https://learn.microsoft.com/powershell/module/az.diskpool/new-azdiskpool
4343
#>
4444
function New-AzDiskPool {
45-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Api20210801.IDiskPool])]
45+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.IDiskPool])]
4646
[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
4747
param(
4848
[Parameter(Mandatory)]
@@ -66,79 +66,92 @@ param(
6666
# The ID of the target subscription.
6767
${SubscriptionId},
6868

69-
[Parameter(Mandatory)]
69+
[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
7070
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
7171
[System.String]
7272
# The geo-location where the resource lives.
7373
${Location},
7474

75-
[Parameter(Mandatory)]
75+
[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
7676
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
7777
[System.String]
7878
# Sku name
7979
${SkuName},
8080

81-
[Parameter(Mandatory)]
81+
[Parameter(ParameterSetName='CreateExpanded', Mandatory)]
8282
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
8383
[System.String]
8484
# Azure Resource ID of a Subnet for the Disk Pool.
8585
${SubnetId},
8686

87-
[Parameter()]
87+
[Parameter(ParameterSetName='CreateExpanded')]
8888
[AllowEmptyCollection()]
8989
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
9090
[System.String[]]
9191
# List of additional capabilities for a Disk Pool.
9292
${AdditionalCapability},
9393

94-
[Parameter()]
94+
[Parameter(ParameterSetName='CreateExpanded')]
9595
[AllowEmptyCollection()]
9696
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
9797
[System.String[]]
9898
# Logical zone for Disk Pool resource; example: ["1"].
9999
${AvailabilityZone},
100100

101-
[Parameter()]
101+
[Parameter(ParameterSetName='CreateExpanded')]
102102
[AllowEmptyCollection()]
103103
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
104104
[System.String[]]
105105
# List of Azure Managed Disks to attach to a Disk Pool.
106106
# To construct, see NOTES section for DISK properties and create a hash table.
107107
${DiskId},
108108

109-
[Parameter()]
109+
[Parameter(ParameterSetName='CreateExpanded')]
110110
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
111111
[System.String]
112112
# Azure resource id.
113113
# Indicates if this resource is managed by another Azure resource.
114114
${ManagedBy},
115115

116-
[Parameter()]
116+
[Parameter(ParameterSetName='CreateExpanded')]
117117
[AllowEmptyCollection()]
118118
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
119119
[System.String[]]
120120
# List of Azure resource ids that manage this resource.
121121
${ManagedByExtended},
122122

123-
[Parameter()]
123+
[Parameter(ParameterSetName='CreateExpanded')]
124124
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
125125
[System.String]
126126
# Sku tier
127127
${SkuTier},
128128

129-
[Parameter()]
129+
[Parameter(ParameterSetName='CreateExpanded')]
130130
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
131-
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Api20210801.IDiskPoolCreateTags]))]
131+
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.IDiskPoolCreateTags]))]
132132
[System.Collections.Hashtable]
133133
# Resource tags.
134134
${Tag},
135135

136+
[Parameter(ParameterSetName='CreateViaJsonFilePath', Mandatory)]
137+
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
138+
[System.String]
139+
# Path of Json file supplied to the Create operation
140+
${JsonFilePath},
141+
142+
[Parameter(ParameterSetName='CreateViaJsonString', Mandatory)]
143+
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
144+
[System.String]
145+
# Json string supplied to the Create operation
146+
${JsonString},
147+
136148
[Parameter()]
137149
[Alias('AzureRMContext', 'AzureCredential')]
138150
[ValidateNotNull()]
139151
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Azure')]
140152
[System.Management.Automation.PSObject]
141-
# The credentials, account, tenant, and subscription used for communication with Azure.
153+
# The DefaultProfile parameter is not functional.
154+
# Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
142155
${DefaultProfile},
143156

144157
[Parameter()]
@@ -197,7 +210,7 @@ param(
197210
if ($PSBoundParameters.ContainsKey("DiskId")){
198211
$disk = @()
199212
for ($i = 0; $i -lt $DiskId.Count; $i++) {
200-
$diskObject = New-Object -TypeName Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Api20210801.Disk
213+
$diskObject = New-Object -TypeName Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Disk
201214
$diskObject.Id = $DiskId[$i]
202215
$disk += $diskObject
203216
}

src/DiskPool/DiskPool.Autorest/custom/Update-AzDiskPool.ps1

Lines changed: 51 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ disk-pool-1 eastus2euap Running Succeeded {3}
2727
.Inputs
2828
Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.IDiskPoolIdentity
2929
.Outputs
30-
Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Api20210801.IDiskPool
30+
Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.IDiskPool
3131
.Notes
3232
COMPLEX PARAMETER PROPERTIES
3333
@@ -47,24 +47,30 @@ INPUTOBJECT <IDiskPoolIdentity>: Identity Parameter
4747
https://learn.microsoft.com/powershell/module/az.diskpool/update-azdiskpool
4848
#>
4949
function Update-AzDiskPool {
50-
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Api20210801.IDiskPool])]
50+
[OutputType([Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.IDiskPool])]
5151
[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
5252
param(
5353
[Parameter(ParameterSetName='UpdateExpanded', Mandatory)]
54+
[Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)]
55+
[Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)]
5456
[Alias('DiskPoolName')]
5557
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Path')]
5658
[System.String]
5759
# The name of the Disk Pool.
5860
${Name},
5961

6062
[Parameter(ParameterSetName='UpdateExpanded', Mandatory)]
63+
[Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)]
64+
[Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)]
6165
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Path')]
6266
[System.String]
6367
# The name of the resource group.
6468
# The name is case insensitive.
6569
${ResourceGroupName},
6670

6771
[Parameter(ParameterSetName='UpdateExpanded')]
72+
[Parameter(ParameterSetName='UpdateViaJsonFilePath')]
73+
[Parameter(ParameterSetName='UpdateViaJsonString')]
6874
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Path')]
6975
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
7076
[System.String]
@@ -75,56 +81,74 @@ param(
7581
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Path')]
7682
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.IDiskPoolIdentity]
7783
# Identity Parameter
78-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
7984
${InputObject},
8085

81-
[Parameter()]
86+
[Parameter(ParameterSetName='UpdateExpanded')]
87+
[Parameter(ParameterSetName='UpdateViaIdentityExpanded')]
8288
[AllowEmptyCollection()]
8389
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
8490
[System.String[]]
8591
# List of Azure Managed Disks to attach to a Disk Pool.
8692
# To construct, see NOTES section for DISK properties and create a hash table.
8793
${DiskId},
8894

89-
[Parameter()]
95+
[Parameter(ParameterSetName='UpdateExpanded')]
96+
[Parameter(ParameterSetName='UpdateViaIdentityExpanded')]
9097
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
9198
[System.String]
9299
# Azure resource id.
93100
# Indicates if this resource is managed by another Azure resource.
94101
${ManagedBy},
95102

96-
[Parameter()]
103+
[Parameter(ParameterSetName='UpdateExpanded')]
104+
[Parameter(ParameterSetName='UpdateViaIdentityExpanded')]
97105
[AllowEmptyCollection()]
98106
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
99107
[System.String[]]
100108
# List of Azure resource ids that manage this resource.
101109
${ManagedByExtended},
102110

103-
[Parameter()]
111+
[Parameter(ParameterSetName='UpdateExpanded')]
112+
[Parameter(ParameterSetName='UpdateViaIdentityExpanded')]
104113
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
105114
[System.String]
106115
# Sku name
107116
${SkuName},
108117

109-
[Parameter()]
118+
[Parameter(ParameterSetName='UpdateExpanded')]
119+
[Parameter(ParameterSetName='UpdateViaIdentityExpanded')]
110120
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
111121
[System.String]
112122
# Sku tier
113123
${SkuTier},
114124

115-
[Parameter()]
125+
[Parameter(ParameterSetName='UpdateExpanded')]
126+
[Parameter(ParameterSetName='UpdateViaIdentityExpanded')]
116127
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
117-
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Api20210801.IDiskPoolUpdateTags]))]
128+
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.IDiskPoolUpdateTags]))]
118129
[System.Collections.Hashtable]
119130
# Resource tags.
120131
${Tag},
121132

133+
[Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)]
134+
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
135+
[System.String]
136+
# Path of Json file supplied to the Update operation
137+
${JsonFilePath},
138+
139+
[Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)]
140+
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Body')]
141+
[System.String]
142+
# Json string supplied to the Update operation
143+
${JsonString},
144+
122145
[Parameter()]
123146
[Alias('AzureRMContext', 'AzureCredential')]
124147
[ValidateNotNull()]
125148
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Category('Azure')]
126149
[System.Management.Automation.PSObject]
127-
# The credentials, account, tenant, and subscription used for communication with Azure.
150+
# The DefaultProfile parameter is not functional.
151+
# Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
128152
${DefaultProfile},
129153

130154
[Parameter()]
@@ -178,21 +202,21 @@ param(
178202
# Use the default credentials for the proxy
179203
${ProxyUseDefaultCredentials}
180204
)
181-
    process {
182-
        try {
183-
            if ($PSBoundParameters.ContainsKey("DiskId")){
184-
                $disk = @()
185-
                for ($i = 0; $i -lt $DiskId.Count; $i++) {
186-
                    $diskObject = New-Object -TypeName Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Api20210801.Disk
187-
                    $diskObject.Id = $DiskId[$i]
188-
                    $disk += $diskObject
189-
                }
190-
                $PSBoundParameters["Disk"] = $disk
191-
                $null = $PSBoundParameters.Remove("DiskId")
192-
            }
193-
            Az.DiskPool.internal\Update-AzDiskPool @PSBoundParameters
194-
        } catch {
195-
            throw
196-
        }
205+
process {
206+
try {
207+
if ($PSBoundParameters.ContainsKey("DiskId")){
208+
$disk = @()
209+
for ($i = 0; $i -lt $DiskId.Count; $i++) {
210+
$diskObject = New-Object -TypeName Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Disk
211+
$diskObject.Id = $DiskId[$i]
212+
$disk += $diskObject
213+
}
214+
$PSBoundParameters["Disk"] = $disk
215+
$null = $PSBoundParameters.Remove("DiskId")
216+
}
217+
Az.DiskPool.internal\Update-AzDiskPool @PSBoundParameters
218+
} catch {
219+
throw
220+
}
197221
}
198222
}

src/DiskPool/DiskPool.Autorest/custom/autogen-model-cmdlets/New-AzDiskPoolAclObject.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ Create an in-memory object for Acl.
2121
Create an in-memory object for Acl.
2222
2323
.Outputs
24-
Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Api20210801.Acl
24+
Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Acl
2525
.Link
26-
https://learn.microsoft.com/powershell/module/Az.DiskPool/new-AzDiskPoolAclObject
26+
https://learn.microsoft.com/powershell/module/Az.DiskPool/new-azdiskpoolaclobject
2727
#>
2828
function New-AzDiskPoolAclObject {
29-
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Api20210801.Acl')]
29+
[Microsoft.Azure.PowerShell.Cmdlets.DiskPool.ModelCmdletAttribute()]
30+
[OutputType('Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Acl')]
3031
[CmdletBinding(PositionalBinding=$false)]
3132
Param(
3233

@@ -39,7 +40,7 @@ function New-AzDiskPoolAclObject {
3940
)
4041

4142
process {
42-
$Object = [Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Api20210801.Acl]::New()
43+
$Object = [Microsoft.Azure.PowerShell.Cmdlets.DiskPool.Models.Acl]::New()
4344

4445
if ($PSBoundParameters.ContainsKey('InitiatorIqn')) {
4546
$Object.InitiatorIqn = $InitiatorIqn

0 commit comments

Comments
 (0)