Skip to content

Commit 2af89d8

Browse files
Migrate Alb from generation to vidai/secrets-detection-autorest (#24455)
* Move Alb to vidai/secrets-detection-autorest * Update ChangeLog.md --------- Co-authored-by: Vincent Dai <[email protected]>
1 parent eac3393 commit 2af89d8

File tree

73 files changed

+1099
-284
lines changed

Some content is hidden

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

73 files changed

+1099
-284
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: 0 additions & 1 deletion
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()]

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

Lines changed: 0 additions & 2 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()]

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

Lines changed: 0 additions & 2 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()]

src/Alb/Alb.Autorest/exports/ProxyCmdletDefinitions.ps1

Lines changed: 0 additions & 15 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()]
@@ -307,14 +305,12 @@ param(
307305
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
308306
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
309307
# Identity Parameter
310-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
311308
${InputObject},
312309

313310
[Parameter(ParameterSetName='GetViaIdentityTrafficController', Mandatory, ValueFromPipeline)]
314311
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
315312
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
316313
# Identity Parameter
317-
# To construct, see NOTES section for TRAFFICCONTROLLERINPUTOBJECT properties and create a hash table.
318314
${TrafficControllerInputObject},
319315

320316
[Parameter()]
@@ -512,7 +508,6 @@ param(
512508
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
513509
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
514510
# Identity Parameter
515-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
516511
${InputObject},
517512

518513
[Parameter()]
@@ -1312,14 +1307,12 @@ param(
13121307
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
13131308
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
13141309
# Identity Parameter
1315-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
13161310
${InputObject},
13171311

13181312
[Parameter(ParameterSetName='DeleteViaIdentityTrafficController', Mandatory, ValueFromPipeline)]
13191313
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
13201314
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
13211315
# Identity Parameter
1322-
# To construct, see NOTES section for TRAFFICCONTROLLERINPUTOBJECT properties and create a hash table.
13231316
${TrafficControllerInputObject},
13241317

13251318
[Parameter()]
@@ -1542,14 +1535,12 @@ param(
15421535
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
15431536
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
15441537
# Identity Parameter
1545-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
15461538
${InputObject},
15471539

15481540
[Parameter(ParameterSetName='DeleteViaIdentityTrafficController', Mandatory, ValueFromPipeline)]
15491541
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
15501542
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
15511543
# Identity Parameter
1552-
# To construct, see NOTES section for TRAFFICCONTROLLERINPUTOBJECT properties and create a hash table.
15531544
${TrafficControllerInputObject},
15541545

15551546
[Parameter()]
@@ -1757,7 +1748,6 @@ param(
17571748
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
17581749
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
17591750
# Identity Parameter
1760-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
17611751
${InputObject},
17621752

17631753
[Parameter()]
@@ -1979,14 +1969,12 @@ param(
19791969
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
19801970
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
19811971
# Identity Parameter
1982-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
19831972
${InputObject},
19841973

19851974
[Parameter(ParameterSetName='UpdateViaIdentityTrafficControllerExpanded', Mandatory, ValueFromPipeline)]
19861975
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
19871976
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
19881977
# Identity Parameter
1989-
# To construct, see NOTES section for TRAFFICCONTROLLERINPUTOBJECT properties and create a hash table.
19901978
${TrafficControllerInputObject},
19911979

19921980
[Parameter()]
@@ -2211,14 +2199,12 @@ param(
22112199
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
22122200
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
22132201
# Identity Parameter
2214-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
22152202
${InputObject},
22162203

22172204
[Parameter(ParameterSetName='UpdateViaIdentityTrafficControllerExpanded', Mandatory, ValueFromPipeline)]
22182205
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
22192206
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
22202207
# Identity Parameter
2221-
# To construct, see NOTES section for TRAFFICCONTROLLERINPUTOBJECT properties and create a hash table.
22222208
${TrafficControllerInputObject},
22232209

22242210
[Parameter()]
@@ -2415,7 +2401,6 @@ param(
24152401
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
24162402
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
24172403
# Identity Parameter
2418-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
24192404
${InputObject},
24202405

24212406
[Parameter()]

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ param(
6969
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
7070
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
7171
# Identity Parameter
72-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
7372
${InputObject},
7473

7574
[Parameter()]

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,12 @@ param(
8484
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
8585
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
8686
# Identity Parameter
87-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
8887
${InputObject},
8988

9089
[Parameter(ParameterSetName='DeleteViaIdentityTrafficController', Mandatory, ValueFromPipeline)]
9190
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
9291
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
9392
# Identity Parameter
94-
# To construct, see NOTES section for TRAFFICCONTROLLERINPUTOBJECT properties and create a hash table.
9593
${TrafficControllerInputObject},
9694

9795
[Parameter()]

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,12 @@ param(
8484
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
8585
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
8686
# Identity Parameter
87-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
8887
${InputObject},
8988

9089
[Parameter(ParameterSetName='DeleteViaIdentityTrafficController', Mandatory, ValueFromPipeline)]
9190
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
9291
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
9392
# Identity Parameter
94-
# To construct, see NOTES section for TRAFFICCONTROLLERINPUTOBJECT properties and create a hash table.
9593
${TrafficControllerInputObject},
9694

9795
[Parameter()]

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ param(
6969
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
7070
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
7171
# Identity Parameter
72-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
7372
${InputObject},
7473

7574
[Parameter()]

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,12 @@ param(
8484
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
8585
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
8686
# Identity Parameter
87-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
8887
${InputObject},
8988

9089
[Parameter(ParameterSetName='UpdateViaIdentityTrafficControllerExpanded', Mandatory, ValueFromPipeline)]
9190
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
9291
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
9392
# Identity Parameter
94-
# To construct, see NOTES section for TRAFFICCONTROLLERINPUTOBJECT properties and create a hash table.
9593
${TrafficControllerInputObject},
9694

9795
[Parameter()]

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,12 @@ param(
8484
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
8585
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
8686
# Identity Parameter
87-
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
8887
${InputObject},
8988

9089
[Parameter(ParameterSetName='UpdateViaIdentityTrafficControllerExpanded', Mandatory, ValueFromPipeline)]
9190
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Category('Path')]
9291
[Microsoft.Azure.PowerShell.Cmdlets.Alb.Models.IAlbIdentity]
9392
# Identity Parameter
94-
# To construct, see NOTES section for TRAFFICCONTROLLERINPUTOBJECT properties and create a hash table.
9593
${TrafficControllerInputObject},
9694

9795
[Parameter()]

src/Alb/Alb.Autorest/generated/Module.cs

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.Alb
1717
using SignalDelegate = global::System.Func<string, global::System.Threading.CancellationToken, global::System.Func<global::System.EventArgs>, global::System.Threading.Tasks.Task>;
1818
using EventListenerDelegate = global::System.Func<string, global::System.Threading.CancellationToken, global::System.Func<global::System.EventArgs>, global::System.Func<string, global::System.Threading.CancellationToken, global::System.Func<global::System.EventArgs>, global::System.Threading.Tasks.Task>, global::System.Management.Automation.InvocationInfo, string, string, string, global::System.Exception, global::System.Threading.Tasks.Task>;
1919
using NextDelegate = global::System.Func<global::System.Net.Http.HttpRequestMessage, global::System.Threading.CancellationToken, global::System.Action, global::System.Func<string, global::System.Threading.CancellationToken, global::System.Func<global::System.EventArgs>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task<global::System.Net.Http.HttpResponseMessage>>;
20+
using SanitizerDelegate = global::System.Action<object, string>;
21+
using GetTelemetryInfoDelegate = global::System.Func<string, global::System.Collections.Generic.Dictionary<global::System.String,global::System.String>>;
2022

2123
/// <summary>A class that contains the module-common code and data.</summary>
2224
public partial class Module
@@ -26,12 +28,20 @@ public partial class Module
2628

2729
public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler();
2830

31+
private static bool _init = false;
32+
33+
private static readonly global::System.Object _initLock = new global::System.Object();
34+
35+
private static Microsoft.Azure.PowerShell.Cmdlets.Alb.Module _instance;
36+
2937
/// <summary>the ISendAsync pipeline instance</summary>
3038
private Microsoft.Azure.PowerShell.Cmdlets.Alb.Runtime.HttpPipeline _pipeline;
3139

3240
/// <summary>the ISendAsync pipeline instance (when proxy is enabled)</summary>
3341
private Microsoft.Azure.PowerShell.Cmdlets.Alb.Runtime.HttpPipeline _pipelineWithProxy;
3442

43+
private static readonly global::System.Object _singletonLock = new global::System.Object();
44+
3545
public bool _useProxy = false;
3646

3747
public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy();
@@ -51,11 +61,11 @@ public partial class Module
5161
/// <summary>The delegate to get the telemetry Id.</summary>
5262
public GetTelemetryIdDelegate GetTelemetryId { get; set; }
5363

54-
/// <summary>Backing field for <see cref="Instance" /> property.</summary>
55-
private static Microsoft.Azure.PowerShell.Cmdlets.Alb.Module _instance;
64+
/// <summary>The delegate to get the telemetry info.</summary>
65+
public GetTelemetryInfoDelegate GetTelemetryInfo { get; set; }
5666

5767
/// <summary>the singleton of this module class</summary>
58-
public static Microsoft.Azure.PowerShell.Cmdlets.Alb.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.Alb.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.Alb.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.Alb.Module());
68+
public static Microsoft.Azure.PowerShell.Cmdlets.Alb.Module Instance { get { if (_instance == null) { lock (_singletonLock) { if (_instance == null) { _instance = new Module(); }}} return _instance; } }
5969

6070
/// <summary>The Name of this module</summary>
6171
public string Name => @"Az.Alb";
@@ -72,6 +82,9 @@ public partial class Module
7282
/// <summary>The ResourceID for this module (azure arm).</summary>
7383
public string ResourceId => @"Az.Alb";
7484

85+
/// <summary>The delegate to call in WriteObject to sanitize the output object.</summary>
86+
public SanitizerDelegate SanitizeOutput { get; set; }
87+
7588
/// <summary>The delegate for creating a telemetry.</summary>
7689
public TelemetryDelegate Telemetry { get; set; }
7790

@@ -117,9 +130,17 @@ public Microsoft.Azure.PowerShell.Cmdlets.Alb.Runtime.HttpPipeline CreatePipelin
117130
/// <summary>Initialization steps performed after the module is loaded.</summary>
118131
public void Init()
119132
{
120-
OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } );
121-
OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } );
122-
CustomInit();
133+
if (_init == false)
134+
{
135+
lock (_initLock) {
136+
if (_init == false) {
137+
OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } );
138+
OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } );
139+
CustomInit();
140+
_init = true;
141+
}
142+
}
143+
}
123144
}
124145

125146
/// <summary>Creates the module instance.</summary>

0 commit comments

Comments
 (0)