Skip to content

Commit e5e5c06

Browse files
Refresh autorest-selected modules from wyunchi/generation/pipeline-refresh-autorest to main (#24685)
1 parent 0f82f68 commit e5e5c06

File tree

1,212 files changed

+41605
-6661
lines changed

Some content is hidden

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

1,212 files changed

+41605
-6661
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
This directory contains the PowerShell module for the Dns service.
44

55
---
6-
76
## Info
87
- Modifiable: yes
98
- Generated: all
@@ -28,7 +27,7 @@ For information on how to develop for `Az.Dns`, see [how-to.md](how-to.md).
2827
> see https://aka.ms/autorest
2928
3029
``` yaml
31-
branch: a3126a361b75f952ece050b2cf67c11d4e542ef8
30+
commit: a3126a361b75f952ece050b2cf67c11d4e542ef8
3231
require:
3332
- $(this-folder)/../../readme.azure.noprofile.md
3433
input-file:
@@ -46,6 +45,10 @@ subject-prefix: $(service-name)
4645
resourcegroup-append: true
4746
nested-object-to-string: true
4847

48+
# For new modules, please avoid setting 3.x using the use-extension method and instead, use 4.x as the default option
49+
use-extension:
50+
"@autorest/powershell": "3.x"
51+
4952
directive:
5053
# Following is two common directive which are normally required in all the RPs
5154
# 1. Remove the unexpanded parameter set

src/Dns/Dns.Autorest/exports/Get-AzDnsDnssecConfig.ps1

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

src/Dns/Dns.Autorest/exports/New-AzDnsDnssecConfig.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,13 @@ begin {
178178
CreateViaIdentity = 'Az.Dns.private\New-AzDnsDnssecConfig_CreateViaIdentity';
179179
}
180180
if (('Create') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
181-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
181+
$testPlayback = $false
182+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Dns.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+
}
182188
}
183189
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
184190
[Microsoft.Azure.PowerShell.Cmdlets.Dns.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Dns/Dns.Autorest/exports/ProxyCmdletDefinitions.ps1

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,13 @@ begin {
155155
List = 'Az.Dns.private\Get-AzDnsDnssecConfig_List';
156156
}
157157
if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
158-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
158+
$testPlayback = $false
159+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Dns.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
160+
if ($testPlayback) {
161+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
162+
} else {
163+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
164+
}
159165
}
160166
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
161167
[Microsoft.Azure.PowerShell.Cmdlets.Dns.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -371,7 +377,13 @@ begin {
371377
CreateViaIdentity = 'Az.Dns.private\New-AzDnsDnssecConfig_CreateViaIdentity';
372378
}
373379
if (('Create') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
374-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
380+
$testPlayback = $false
381+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Dns.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
382+
if ($testPlayback) {
383+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
384+
} else {
385+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
386+
}
375387
}
376388
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
377389
[Microsoft.Azure.PowerShell.Cmdlets.Dns.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)
@@ -588,7 +600,13 @@ begin {
588600
DeleteViaIdentity = 'Az.Dns.private\Remove-AzDnsDnssecConfig_DeleteViaIdentity';
589601
}
590602
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
591-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
603+
$testPlayback = $false
604+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Dns.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
605+
if ($testPlayback) {
606+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
607+
} else {
608+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
609+
}
592610
}
593611
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
594612
[Microsoft.Azure.PowerShell.Cmdlets.Dns.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Dns/Dns.Autorest/exports/Remove-AzDnsDnssecConfig.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,13 @@ begin {
179179
DeleteViaIdentity = 'Az.Dns.private\Remove-AzDnsDnssecConfig_DeleteViaIdentity';
180180
}
181181
if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) {
182-
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
182+
$testPlayback = $false
183+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Dns.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
184+
if ($testPlayback) {
185+
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
186+
} else {
187+
$PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id
188+
}
183189
}
184190
$cmdInfo = Get-Command -Name $mapping[$parameterSet]
185191
[Microsoft.Azure.PowerShell.Cmdlets.Dns.Runtime.MessageAttributeHelper]::ProcessCustomAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)

src/Dns/Dns.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.Dns
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.Dns.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.Dns";
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/Dns/Dns.Autorest/generated/cmdlets/GetAzDnsDnssecConfig_Get.cs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,24 @@ protected override void BeginProcessing()
188188
/// <summary>Performs clean-up after the command execution</summary>
189189
protected override void EndProcessing()
190190
{
191-
191+
var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Dns.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId);
192+
if (telemetryInfo != null)
193+
{
194+
telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning);
195+
telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties);
196+
telemetryInfo.TryGetValue("InvocationName", out var invocationName);
197+
if (showSecretsWarning == "true")
198+
{
199+
if (string.IsNullOrEmpty(sanitizedProperties))
200+
{
201+
WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844");
202+
}
203+
else
204+
{
205+
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");
206+
}
207+
}
208+
}
192209
}
193210

194211
/// <summary>
@@ -337,6 +354,21 @@ protected override void StopProcessing()
337354
base.StopProcessing();
338355
}
339356

357+
/// <param name="sendToPipeline"></param>
358+
new protected void WriteObject(object sendToPipeline)
359+
{
360+
Microsoft.Azure.PowerShell.Cmdlets.Dns.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId);
361+
base.WriteObject(sendToPipeline);
362+
}
363+
364+
/// <param name="sendToPipeline"></param>
365+
/// <param name="enumerateCollection"></param>
366+
new protected void WriteObject(object sendToPipeline, bool enumerateCollection)
367+
{
368+
Microsoft.Azure.PowerShell.Cmdlets.Dns.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId);
369+
base.WriteObject(sendToPipeline, enumerateCollection);
370+
}
371+
340372
/// <summary>
341373
/// a delegate that is called when the remote service returns default (any response code not handled elsewhere).
342374
/// </summary>

src/Dns/Dns.Autorest/generated/cmdlets/GetAzDnsDnssecConfig_GetViaIdentity.cs

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

156173
/// <summary>
@@ -316,6 +333,21 @@ protected override void StopProcessing()
316333
base.StopProcessing();
317334
}
318335

336+
/// <param name="sendToPipeline"></param>
337+
new protected void WriteObject(object sendToPipeline)
338+
{
339+
Microsoft.Azure.PowerShell.Cmdlets.Dns.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId);
340+
base.WriteObject(sendToPipeline);
341+
}
342+
343+
/// <param name="sendToPipeline"></param>
344+
/// <param name="enumerateCollection"></param>
345+
new protected void WriteObject(object sendToPipeline, bool enumerateCollection)
346+
{
347+
Microsoft.Azure.PowerShell.Cmdlets.Dns.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId);
348+
base.WriteObject(sendToPipeline, enumerateCollection);
349+
}
350+
319351
/// <summary>
320352
/// a delegate that is called when the remote service returns default (any response code not handled elsewhere).
321353
/// </summary>

src/Dns/Dns.Autorest/generated/cmdlets/GetAzDnsDnssecConfig_List.cs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,24 @@ protected override void BeginProcessing()
194194
/// <summary>Performs clean-up after the command execution</summary>
195195
protected override void EndProcessing()
196196
{
197-
197+
var telemetryInfo = Microsoft.Azure.PowerShell.Cmdlets.Dns.Module.Instance.GetTelemetryInfo?.Invoke(__correlationId);
198+
if (telemetryInfo != null)
199+
{
200+
telemetryInfo.TryGetValue("ShowSecretsWarning", out var showSecretsWarning);
201+
telemetryInfo.TryGetValue("SanitizedProperties", out var sanitizedProperties);
202+
telemetryInfo.TryGetValue("InvocationName", out var invocationName);
203+
if (showSecretsWarning == "true")
204+
{
205+
if (string.IsNullOrEmpty(sanitizedProperties))
206+
{
207+
WriteWarning($"The output of cmdlet {invocationName} may compromise security by showing secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844");
208+
}
209+
else
210+
{
211+
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");
212+
}
213+
}
214+
}
198215
}
199216

200217
/// <summary>
@@ -343,6 +360,21 @@ protected override void StopProcessing()
343360
base.StopProcessing();
344361
}
345362

363+
/// <param name="sendToPipeline"></param>
364+
new protected void WriteObject(object sendToPipeline)
365+
{
366+
Microsoft.Azure.PowerShell.Cmdlets.Dns.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId);
367+
base.WriteObject(sendToPipeline);
368+
}
369+
370+
/// <param name="sendToPipeline"></param>
371+
/// <param name="enumerateCollection"></param>
372+
new protected void WriteObject(object sendToPipeline, bool enumerateCollection)
373+
{
374+
Microsoft.Azure.PowerShell.Cmdlets.Dns.Module.Instance.SanitizeOutput?.Invoke(sendToPipeline, __correlationId);
375+
base.WriteObject(sendToPipeline, enumerateCollection);
376+
}
377+
346378
/// <summary>
347379
/// a delegate that is called when the remote service returns default (any response code not handled elsewhere).
348380
/// </summary>

0 commit comments

Comments
 (0)