Skip to content

Commit b593564

Browse files
Migrate Fleet from generation to main (#24497)
* Move Fleet to main * Update ChangeLog.md --------- Co-authored-by: Vincent Dai <[email protected]>
1 parent edc2e0e commit b593564

File tree

154 files changed

+2796
-421
lines changed

Some content is hidden

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

154 files changed

+2796
-421
lines changed

src/Fleet/Fleet.Autorest/Az.Fleet.psm1

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,37 +47,41 @@
4747

4848
# Ask for the shared functionality table
4949
$VTable = Register-AzModule
50-
50+
5151
# Tweaks the pipeline on module load
5252
$instance.OnModuleLoad = $VTable.OnModuleLoad
5353

5454
# Following two delegates are added for telemetry
5555
$instance.GetTelemetryId = $VTable.GetTelemetryId
5656
$instance.Telemetry = $VTable.Telemetry
57-
57+
58+
# Delegate to sanitize the output object
59+
$instance.SanitizeOutput = $VTable.SanitizerHandler
60+
61+
# Delegate to get the telemetry info
62+
$instance.GetTelemetryInfo = $VTable.GetTelemetryInfo
5863

5964
# Tweaks the pipeline per call
6065
$instance.OnNewRequest = $VTable.OnNewRequest
61-
66+
6267
# Gets shared parameter values
6368
$instance.GetParameterValue = $VTable.GetParameterValue
64-
69+
6570
# Allows shared module to listen to events from this module
6671
$instance.EventListener = $VTable.EventListener
67-
72+
6873
# Gets shared argument completers
6974
$instance.ArgumentCompleter = $VTable.ArgumentCompleter
70-
75+
7176
# The name of the currently selected Azure profile
7277
$instance.ProfileName = $VTable.ProfileName
7378

74-
7579
# Load the custom module
7680
$customModulePath = Join-Path $PSScriptRoot './custom/Az.Fleet.custom.psm1'
7781
if(Test-Path $customModulePath) {
7882
$null = Import-Module -Name $customModulePath
7983
}
80-
84+
8185
# Export nothing to clear implicit exports
8286
Export-ModuleMember
8387

@@ -97,12 +101,12 @@
97101
# Load the last folder if no profile is selected
98102
$profileDirectory = $directories | Select-Object -Last 1
99103
}
100-
104+
101105
if($profileDirectory) {
102106
Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'"
103107
$exportsPath = $profileDirectory.FullName
104108
}
105-
109+
106110
if($exportsPath) {
107111
Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName }
108112
$cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath

src/Fleet/Fleet.Autorest/README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
This directory contains the PowerShell module for the Fleet service.
44

55
---
6-
76
## Info
87
- Modifiable: yes
98
- Generated: all
@@ -38,6 +37,8 @@ require:
3837
title: Fleet
3938
module-version: 0.1.0
4039
subject-prefix: $(service-name)
40+
disable-transform-identity-type: true
41+
flatten-userassignedidentity: false
4142

4243
directive:
4344
# # # Following is two common directive which are normally required in all the RPs
@@ -56,6 +57,23 @@ directive:
5657
- from: swagger-document
5758
where: $.definitions.UpdateRun
5859
transform: $['required'] = ['properties']
60+
- from: swagger-document
61+
where: $.definitions.FleetUpdateStrategy.properties.properties.x-ms-mutability
62+
transform: >-
63+
return [
64+
"read",
65+
"update",
66+
"create"
67+
]
68+
- from: swagger-document
69+
where: $.definitions.UpdateRun.properties.properties
70+
transform: $['x-ms-mutability'] = ["read", "update", "create"]
71+
- from: swagger-document
72+
where: $.definitions.ManagedClusterUpdate.properties.nodeImageSelection
73+
transform: $['x-ms-mutability'] = ["read", "update", "create"]
74+
- from: swagger-document
75+
where: $.definitions.NodeImageSelection.properties.type
76+
transform: $['x-ms-mutability'] = ["read", "update", "create"]
5977
# Hide set cmdlet
6078
- where:
6179
verb: Set

src/Fleet/Fleet.Autorest/exports/Get-AzFleet.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ param(
7676
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Category('Path')]
7777
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Models.IFleetIdentity]
7878
# Identity Parameter
79-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
8079
${InputObject},
8180

8281
[Parameter()]
@@ -160,7 +159,13 @@ begin {
160159
List1 = 'Az.Fleet.private\Get-AzFleet_List1';
161160
}
162161
if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
163-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
162+
$testPlayback = $false
163+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
164+
if ($testPlayback) {
165+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
166+
} else {
167+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
168+
}
164169
}
165170
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
166171
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Fleet/Fleet.Autorest/exports/Get-AzFleetCredentials.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,13 @@ begin {
129129
List = 'Az.Fleet.private\Get-AzFleetCredentials_List';
130130
}
131131
if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
132-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
132+
$testPlayback = $false
133+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
134+
if ($testPlayback) {
135+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
136+
} else {
137+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
138+
}
133139
}
134140
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
135141
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Fleet/Fleet.Autorest/exports/Get-AzFleetMember.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,12 @@ param(
9292
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Category('Path')]
9393
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Models.IFleetIdentity]
9494
# Identity Parameter
95-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
9695
${InputObject},
9796

9897
[Parameter(ParameterSetName='GetViaIdentityFleet', Mandatory, ValueFromPipeline)]
9998
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Category('Path')]
10099
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Models.IFleetIdentity]
101100
# Identity Parameter
102-
# To construct, see NOTES section for FLEETINPUTOBJECT properties and create a hash table.
103101
${FleetInputObject},
104102

105103
[Parameter()]
@@ -183,7 +181,13 @@ begin {
183181
List = 'Az.Fleet.private\Get-AzFleetMember_List';
184182
}
185183
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
186-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
184+
$testPlayback = $false
185+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
186+
if ($testPlayback) {
187+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
188+
} else {
189+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
190+
}
187191
}
188192
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
189193
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Fleet/Fleet.Autorest/exports/Get-AzFleetUpdateRun.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,12 @@ param(
9292
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Category('Path')]
9393
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Models.IFleetIdentity]
9494
# Identity Parameter
95-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
9695
${InputObject},
9796

9897
[Parameter(ParameterSetName='GetViaIdentityFleet', Mandatory, ValueFromPipeline)]
9998
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Category('Path')]
10099
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Models.IFleetIdentity]
101100
# Identity Parameter
102-
# To construct, see NOTES section for FLEETINPUTOBJECT properties and create a hash table.
103101
${FleetInputObject},
104102

105103
[Parameter()]
@@ -183,7 +181,13 @@ begin {
183181
List = 'Az.Fleet.private\Get-AzFleetUpdateRun_List';
184182
}
185183
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
186-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
184+
$testPlayback = $false
185+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
186+
if ($testPlayback) {
187+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
188+
} else {
189+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
190+
}
187191
}
188192
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
189193
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Fleet/Fleet.Autorest/exports/Get-AzFleetUpdateStrategy.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,12 @@ param(
9191
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Category('Path')]
9292
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Models.IFleetIdentity]
9393
# Identity Parameter
94-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
9594
${InputObject},
9695

9796
[Parameter(ParameterSetName='GetViaIdentityFleet', Mandatory, ValueFromPipeline)]
9897
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Category('Path')]
9998
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Models.IFleetIdentity]
10099
# Identity Parameter
101-
# To construct, see NOTES section for FLEETINPUTOBJECT properties and create a hash table.
102100
${FleetInputObject},
103101

104102
[Parameter()]
@@ -182,7 +180,13 @@ begin {
182180
List = 'Az.Fleet.private\Get-AzFleetUpdateStrategy_List';
183181
}
184182
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
185-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
183+
$testPlayback = $false
184+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
185+
if ($testPlayback) {
186+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
187+
} else {
188+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
189+
}
186190
}
187191
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
188192
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Fleet/Fleet.Autorest/exports/New-AzFleet.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ param(
7777
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Category('Path')]
7878
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Models.IFleetIdentity]
7979
# Identity Parameter
80-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
8180
${InputObject},
8281

8382
[Parameter()]
@@ -230,7 +229,13 @@ begin {
230229
CreateViaJsonString = 'Az.Fleet.private\New-AzFleet_CreateViaJsonString';
231230
}
232231
if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
233-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
232+
$testPlayback = $false
233+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
234+
if ($testPlayback) {
235+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
236+
} else {
237+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
238+
}
234239
}
235240
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
236241
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Fleet/Fleet.Autorest/exports/New-AzFleetMember.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,12 @@ param(
9595
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Category('Path')]
9696
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Models.IFleetIdentity]
9797
# Identity Parameter
98-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
9998
${InputObject},
10099

101100
[Parameter(ParameterSetName='CreateViaIdentityFleetExpanded', Mandatory, ValueFromPipeline)]
102101
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Category('Path')]
103102
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Models.IFleetIdentity]
104103
# Identity Parameter
105-
# To construct, see NOTES section for FLEETINPUTOBJECT properties and create a hash table.
106104
${FleetInputObject},
107105

108106
[Parameter()]
@@ -241,7 +239,13 @@ begin {
241239
CreateViaJsonString = 'Az.Fleet.private\New-AzFleetMember_CreateViaJsonString';
242240
}
243241
if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
244-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
242+
$testPlayback = $false
243+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
244+
if ($testPlayback) {
245+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
246+
} else {
247+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
248+
}
245249
}
246250
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
247251
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Fleet/Fleet.Autorest/exports/New-AzFleetUpdateRun.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,12 @@ param(
101101
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Category('Path')]
102102
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Models.IFleetIdentity]
103103
# Identity Parameter
104-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
105104
${InputObject},
106105

107106
[Parameter(ParameterSetName='CreateViaIdentityFleetExpanded', Mandatory, ValueFromPipeline)]
108107
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Category('Path')]
109108
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Models.IFleetIdentity]
110109
# Identity Parameter
111-
# To construct, see NOTES section for FLEETINPUTOBJECT properties and create a hash table.
112110
${FleetInputObject},
113111

114112
[Parameter()]
@@ -149,7 +147,6 @@ param(
149147
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Models.IUpdateStage[]]
150148
# The list of stages that compose this update run.
151149
# Min size: 1.
152-
# To construct, see NOTES section for STRATEGYSTAGE properties and create a hash table.
153150
${StrategyStage},
154151

155152
[Parameter(ParameterSetName='CreateExpanded')]
@@ -281,7 +278,13 @@ begin {
281278
CreateViaJsonString = 'Az.Fleet.private\New-AzFleetUpdateRun_CreateViaJsonString';
282279
}
283280
if (('CreateExpanded', 'CreateViaJsonFilePath', 'CreateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
284-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
281+
$testPlayback = $false
282+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
283+
if ($testPlayback) {
284+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
285+
} else {
286+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
287+
}
285288
}
286289
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
287290
[Microsoft.Azure.PowerShell.Cmdlets.Fleet.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

0 commit comments

Comments
 (0)