Skip to content

Commit d8254d7

Browse files
Migrate Alb from generation to main (#24485)
* Move Alb to main * Update ChangeLog.md --------- Co-authored-by: Vincent Dai <[email protected]>
1 parent 4ac734c commit d8254d7

File tree

80 files changed

+1407
-395
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

+1407
-395
lines changed

src/Alb/Alb.Autorest/Az.Alb.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.Alb.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/Alb/Alb.Autorest/README.md

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

55
---
6-
76
## Info
87
- Modifiable: yes
98
- Generated: all

src/Alb/Alb.Autorest/exports/Get-AzAlb.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.Alb.Category('Path')]
7777
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
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.Alb.private\Get-AzAlb_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.Alb.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.Alb.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Alb/Alb.Autorest/exports/Get-AzAlbAssociation.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,12 @@ param(
8989
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
9090
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
9191
# Identity Parameter
92-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
9392
${InputObject},
9493

9594
[Parameter(ParameterSetName='GetViaIdentityTrafficController', Mandatory, ValueFromPipeline)]
9695
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
9796
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
9897
# Identity Parameter
99-
# To construct, see NOTES section for TRAFFICCONTROLLERINPUTOBJECT properties and create a hash table.
10098
${TrafficControllerInputObject},
10199

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

src/Alb/Alb.Autorest/exports/Get-AzAlbFrontend.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,12 @@ param(
8989
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
9090
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
9191
# Identity Parameter
92-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
9392
${InputObject},
9493

9594
[Parameter(ParameterSetName='GetViaIdentityTrafficController', Mandatory, ValueFromPipeline)]
9695
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
9796
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
9897
# Identity Parameter
99-
# To construct, see NOTES section for TRAFFICCONTROLLERINPUTOBJECT properties and create a hash table.
10098
${TrafficControllerInputObject},
10199

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

src/Alb/Alb.Autorest/exports/New-AzAlb.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,13 @@ begin {
154154
CreateExpanded = 'Az.Alb.private\New-AzAlb_CreateExpanded';
155155
}
156156
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
157-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
157+
$testPlayback = $false
158+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Alb.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
159+
if ($testPlayback) {
160+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
161+
} else {
162+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
163+
}
158164
}
159165
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
160166
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Alb/Alb.Autorest/exports/New-AzAlbAssociation.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,13 @@ begin {
166166
CreateExpanded = 'Az.Alb.private\New-AzAlbAssociation_CreateExpanded';
167167
}
168168
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
169-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
169+
$testPlayback = $false
170+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Alb.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
171+
if ($testPlayback) {
172+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
173+
} else {
174+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
175+
}
170176
}
171177
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
172178
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Alb/Alb.Autorest/exports/New-AzAlbFrontend.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,13 @@ begin {
160160
CreateExpanded = 'Az.Alb.private\New-AzAlbFrontend_CreateExpanded';
161161
}
162162
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
163-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
163+
$testPlayback = $false
164+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Alb.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }
165+
if ($testPlayback) {
166+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
167+
} else {
168+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
169+
}
164170
}
165171
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
166172
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

0 commit comments

Comments
 (0)