Skip to content

Commit 0668233

Browse files
Refresh autorest-selected modules from wyunchi/generation/pipeline-refresh-autorest to main (#24682)
1 parent 7cd6342 commit 0668233

File tree

870 files changed

+22978
-4689
lines changed

Some content is hidden

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

870 files changed

+22978
-4689
lines changed

src/ConnectedKubernetes/ConnectedKubernetes.Autorest/Az.ConnectedKubernetes.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.ConnectedKubernetes.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/ConnectedKubernetes/ConnectedKubernetes.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 ConnectedKubernetes service.
44

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

src/ConnectedKubernetes/ConnectedKubernetes.Autorest/exports/Get-AzConnectedKubernetes.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,13 @@ begin {
162162
List1 = 'Az.ConnectedKubernetes.private\Get-AzConnectedKubernetes_List1';
163163
}
164164
if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
165-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
165+
$testPlayback = $false
166+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
167+
if ($testPlayback) {
168+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
169+
} else {
170+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
171+
}
166172
}
167173
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
168174
[Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/ConnectedKubernetes/ConnectedKubernetes.Autorest/exports/Get-AzConnectedKubernetesUserCredential.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,13 @@ begin {
163163
ListExpanded = 'Az.ConnectedKubernetes.private\Get-AzConnectedKubernetesUserCredential_ListExpanded';
164164
}
165165
if (('List', 'ListExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
166-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
166+
$testPlayback = $false
167+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
168+
if ($testPlayback) {
169+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
170+
} else {
171+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
172+
}
167173
}
168174
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
169175
[Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/ConnectedKubernetes/ConnectedKubernetes.Autorest/exports/New-AzConnectedKubernetes.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,13 @@ begin {
281281
CreateExpanded = 'Az.ConnectedKubernetes.custom\New-AzConnectedKubernetes';
282282
}
283283
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
284-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
284+
$testPlayback = $false
285+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
286+
if ($testPlayback) {
287+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
288+
} else {
289+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
290+
}
285291
}
286292
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
287293
[Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/ConnectedKubernetes/ConnectedKubernetes.Autorest/exports/ProxyCmdletDefinitions.ps1

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,13 @@ begin {
163163
ListExpanded = 'Az.ConnectedKubernetes.private\Get-AzConnectedKubernetesUserCredential_ListExpanded';
164164
}
165165
if (('List', 'ListExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
166-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
166+
$testPlayback = $false
167+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
168+
if ($testPlayback) {
169+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
170+
} else {
171+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
172+
}
167173
}
168174
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
169175
[Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -363,7 +369,13 @@ begin {
363369
List1 = 'Az.ConnectedKubernetes.private\Get-AzConnectedKubernetes_List1';
364370
}
365371
if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
366-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
372+
$testPlayback = $false
373+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
374+
if ($testPlayback) {
375+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
376+
} else {
377+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
378+
}
367379
}
368380
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
369381
[Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -682,7 +694,13 @@ begin {
682694
CreateExpanded = 'Az.ConnectedKubernetes.custom\New-AzConnectedKubernetes';
683695
}
684696
if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
685-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
697+
$testPlayback = $false
698+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
699+
if ($testPlayback) {
700+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
701+
} else {
702+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
703+
}
686704
}
687705
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
688706
[Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -901,7 +919,13 @@ begin {
901919
DeleteViaIdentity = 'Az.ConnectedKubernetes.custom\Remove-AzConnectedKubernetes';
902920
}
903921
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
904-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
922+
$testPlayback = $false
923+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
924+
if ($testPlayback) {
925+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
926+
} else {
927+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
928+
}
905929
}
906930
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
907931
[Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -1126,7 +1150,13 @@ begin {
11261150
UpdateViaIdentityExpanded = 'Az.ConnectedKubernetes.custom\Update-AzConnectedKubernetes';
11271151
}
11281152
if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
1129-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
1153+
$testPlayback = $false
1154+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
1155+
if ($testPlayback) {
1156+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
1157+
} else {
1158+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
1159+
}
11301160
}
11311161
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
11321162
[Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/ConnectedKubernetes/ConnectedKubernetes.Autorest/exports/Remove-AzConnectedKubernetes.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,13 @@ begin {
181181
DeleteViaIdentity = 'Az.ConnectedKubernetes.custom\Remove-AzConnectedKubernetes';
182182
}
183183
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
184-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
184+
$testPlayback = $false
185+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.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+
}
185191
}
186192
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
187193
[Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/ConnectedKubernetes/ConnectedKubernetes.Autorest/exports/Update-AzConnectedKubernetes.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,13 @@ begin {
187187
UpdateViaIdentityExpanded = 'Az.ConnectedKubernetes.custom\Update-AzConnectedKubernetes';
188188
}
189189
if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
190-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
190+
$testPlayback = $false
191+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
192+
if ($testPlayback) {
193+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
194+
} else {
195+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
196+
}
191197
}
192198
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
193199
[Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/ConnectedKubernetes/ConnectedKubernetes.Autorest/generated/Module.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes
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
@@ -51,6 +53,9 @@ public partial class Module
5153
/// <summary>The delegate to get the telemetry Id.</summary>
5254
public GetTelemetryIdDelegate GetTelemetryId { get; set; }
5355

56+
/// <summary>The delegate to get the telemetry info.</summary>
57+
public GetTelemetryInfoDelegate GetTelemetryInfo { get; set; }
58+
5459
/// <summary>Backing field for <see cref="Instance" /> property.</summary>
5560
private static Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Module _instance;
5661

@@ -72,6 +77,9 @@ public partial class Module
7277
/// <summary>The ResourceID for this module (azure arm).</summary>
7378
public string ResourceId => @"Az.ConnectedKubernetes";
7479

80+
/// <summary>The delegate to call in WriteObject to sanitize the output object.</summary>
81+
public SanitizerDelegate SanitizeOutput { get; set; }
82+
7583
/// <summary>The delegate for creating a telemetry.</summary>
7684
public TelemetryDelegate Telemetry { get; set; }
7785

src/ConnectedKubernetes/ConnectedKubernetes.Autorest/generated/cmdlets/GetAzConnectedKubernetesOperation_Get.cs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,24 @@ protected override void BeginProcessing()
148148
/// <summary>Performs clean-up after the command execution</summary>
149149
protected override void EndProcessing()
150150
{
151-
151+
var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId);
152+
if (telemetryInfo != null)
153+
{
154+
telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning);
155+
telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties);
156+
telemetryInfo.TryGetValue("InvocationName", out var invocationName);
157+
if (showSecretsWarning == "true")
158+
{
159+
if (string.IsNullOrEmpty(sanitizedProperties))
160+
{
161+
WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844");
162+
}
163+
else
164+
{
165+
WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing the following secrets: {sanitizedProperties}. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844");
166+
}
167+
}
168+
}
152169
}
153170

154171
/// <summary>
@@ -294,6 +311,21 @@ protected override void StopProcessing()
294311
base.StopProcessing();
295312
}
296313

314+
/// <param name="sendToPipeline"></param>
315+
new protected void WriteObject(object sendToPipeline)
316+
{
317+
Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId);
318+
base.WriteObject(sendToPipeline);
319+
}
320+
321+
/// <param name="sendToPipeline"></param>
322+
/// <param name="enumerateCollection"></param>
323+
new protected void WriteObject(object sendToPipeline, bool enumerateCollection)
324+
{
325+
Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId);
326+
base.WriteObject(sendToPipeline, enumerateCollection);
327+
}
328+
297329
/// <summary>
298330
/// a delegate that is called when the remote service returns default (any response code not handled elsewhere).
299331
/// </summary>

0 commit comments

Comments
 (0)