Skip to content

Commit 8a51d45

Browse files
[skip ci] Archive c9aeca5 (#28139)
1 parent c9aeca5 commit 8a51d45

File tree

13 files changed

+108
-38
lines changed

13 files changed

+108
-38
lines changed

generated/Monitor/MetricData.Autorest/Az.MetricData.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<PsModuleName>Metricdata</PsModuleName>
44
<PsRootModuleName>Monitor</PsRootModuleName>
5-
<PsModuleFolder>MetricData.Autorest</PsModuleFolder>
5+
<PsModuleFolder>Metricdata.Autorest</PsModuleFolder>
66
</PropertyGroup>
77

88
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., build.proj))\src\Az.autorest.props" />
Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
1-
// ----------------------------------------------------------------------------------
2-
//
3-
// Copyright Microsoft Corporation
4-
// Licensed under the Apache License, Version 2.0 (the "License");
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0 (the ""License"");
53
// you may not use this file except in compliance with the License.
64
// You may obtain a copy of the License at
75
// http://www.apache.org/licenses/LICENSE-2.0
86
// Unless required by applicable law or agreed to in writing, software
9-
// distributed under the License is distributed on an "AS IS" BASIS,
7+
// distributed under the License is distributed on an ""AS IS"" BASIS,
108
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119
// See the License for the specific language governing permissions and
1210
// limitations under the License.
13-
// ----------------------------------------------------------------------------------
11+
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
12+
// is regenerated.
1413

1514
using System;
1615
using System.Reflection;
16+
using System.Runtime.CompilerServices;
1717
using System.Runtime.InteropServices;
1818

19-
[assembly: AssemblyTitle("Microsoft Azure Powershell - MetricData")]
20-
[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)]
21-
[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)]
22-
[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)]
23-
24-
[assembly: ComVisible(false)]
25-
[assembly: CLSCompliant(false)]
26-
[assembly: Guid("09b8ab42-5b8a-4444-8a41-b6fafe0355de")]
27-
[assembly: AssemblyVersion("6.0.1")]
28-
[assembly: AssemblyFileVersion("6.0.1")]
19+
[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")]
20+
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")]
21+
[assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")]
22+
[assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - Metricdata")]
23+
[assembly: System.Reflection.AssemblyFileVersionAttribute("6.0.2")]
24+
[assembly: System.Reflection.AssemblyVersionAttribute("6.0.2")]
25+
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
26+
[assembly: System.CLSCompliantAttribute(false)]

generated/Monitor/MetricData.Autorest/exports/Get-AzMetricsBatch.ps1

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Lists the metric values for multiple resources.
2323
$endpoint = 'https://eastus.metrics.monitor.azure.com'
2424
$start = "2023-12-06T07:00:00.000Z"
2525
$end = "2023-12-06T08:00:00.000Z"
26-
Get-AzMetricsBatch -Endpoint $endpoint -Name 'ingress','egress' -Namespace "Microsoft.Storage/storageAccounts" -EndTime $end -StartTime $start -ResourceId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-monitor/providers/Microsoft.Storage/storageAccounts/psmetric01
26+
Get-AzMetricsBatch -Endpoint $endpoint -Name 'ingress','egress' -Namespace "Microsoft.Storage/storageAccounts" -EndTime $end -StartTime $start -ResourceId '/subscriptions/{subid}/resourcegroups/{groupname}/providers/Microsoft.Storage/storageAccounts/{account}'
2727
2828
.Inputs
2929
Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IMetricdataIdentity
@@ -218,6 +218,15 @@ begin {
218218
$PSBoundParameters['OutBuffer'] = 1
219219
}
220220
$parameterSet = $PSCmdlet.ParameterSetName
221+
222+
$testPlayback = $false
223+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Metric.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
224+
225+
$context = Get-AzContext
226+
if (-not $context -and -not $testPlayback) {
227+
Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in."
228+
exit
229+
}
221230

222231
if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {
223232
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString()
@@ -241,8 +250,6 @@ begin {
241250
BatchViaIdentityExpanded = 'Az.Metricdata.private\Get-AzMetricsBatch_BatchViaIdentityExpanded';
242251
}
243252
if (('BatchExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
244-
$testPlayback = $false
245-
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Metric.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
246253
if ($testPlayback) {
247254
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
248255
} else {
@@ -256,6 +263,9 @@ begin {
256263
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name)
257264
}
258265
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
266+
if ($wrappedCmd -eq $null) {
267+
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function)
268+
}
259269
$scriptCmd = {& $wrappedCmd @PSBoundParameters}
260270
$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
261271
$steppablePipeline.Begin($PSCmdlet)

generated/Monitor/MetricData.Autorest/exports/ProxyCmdletDefinitions.ps1

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Lists the metric values for multiple resources.
2323
$endpoint = 'https://eastus.metrics.monitor.azure.com'
2424
$start = "2023-12-06T07:00:00.000Z"
2525
$end = "2023-12-06T08:00:00.000Z"
26-
Get-AzMetricsBatch -Endpoint $endpoint -Name 'ingress','egress' -Namespace "Microsoft.Storage/storageAccounts" -EndTime $end -StartTime $start -ResourceId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/joyer-monitor/providers/Microsoft.Storage/storageAccounts/psmetric01
26+
Get-AzMetricsBatch -Endpoint $endpoint -Name 'ingress','egress' -Namespace "Microsoft.Storage/storageAccounts" -EndTime $end -StartTime $start -ResourceId '/subscriptions/{subid}/resourcegroups/{groupname}/providers/Microsoft.Storage/storageAccounts/{account}'
2727
2828
.Inputs
2929
Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IMetricdataIdentity
@@ -218,6 +218,15 @@ begin {
218218
$PSBoundParameters['OutBuffer'] = 1
219219
}
220220
$parameterSet = $PSCmdlet.ParameterSetName
221+
222+
$testPlayback = $false
223+
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Metric.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
224+
225+
$context = Get-AzContext
226+
if (-not $context -and -not $testPlayback) {
227+
Write-Error "No Azure login detected. Please run 'Connect-AzAccount' to log in."
228+
exit
229+
}
221230

222231
if ($null -eq [Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion) {
223232
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PowerShellVersion = $PSVersionTable.PSVersion.ToString()
@@ -241,8 +250,6 @@ begin {
241250
BatchViaIdentityExpanded = 'Az.Metricdata.private\Get-AzMetricsBatch_BatchViaIdentityExpanded';
242251
}
243252
if (('BatchExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) {
244-
$testPlayback = $false
245-
$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Metric.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } }
246253
if ($testPlayback) {
247254
$PSBoundParameters['SubscriptionId'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')
248255
} else {
@@ -256,6 +263,9 @@ begin {
256263
[Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet]::PromptedPreviewMessageCmdlets.Enqueue($MyInvocation.MyCommand.Name)
257264
}
258265
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
266+
if ($wrappedCmd -eq $null) {
267+
$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function)
268+
}
259269
$scriptCmd = {& $wrappedCmd @PSBoundParameters}
260270
$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
261271
$steppablePipeline.Begin($PSCmdlet)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"generate_Id": "186cce94-5f4a-489c-afbc-9d8d6f5c2535"
2+
"generate_Id": "055b18a5-cd5a-44f8-9c2e-e72ffd0120c6"
33
}

generated/Monitor/MetricData.Autorest/generated/api/Models/ErrorResponse.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,22 @@ public partial class ErrorResponse :
4040
public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Message; }
4141

4242
/// <summary>Internal Acessors for AdditionalInfo</summary>
43-
System.Collections.Generic.List<Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorAdditionalInfo> Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).AdditionalInfo = value; }
43+
System.Collections.Generic.List<Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorAdditionalInfo> Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorResponseInternal.AdditionalInfo { get => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).AdditionalInfo; set => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).AdditionalInfo = value ?? null /* arrayOf */; }
4444

4545
/// <summary>Internal Acessors for Code</summary>
46-
string Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Code = value; }
46+
string Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorResponseInternal.Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Code = value ?? null; }
4747

4848
/// <summary>Internal Acessors for Detail</summary>
49-
System.Collections.Generic.List<Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetail> Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Detail = value; }
49+
System.Collections.Generic.List<Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetail> Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorResponseInternal.Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Detail = value ?? null /* arrayOf */; }
5050

5151
/// <summary>Internal Acessors for Error</summary>
5252
Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetail Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.ErrorDetail()); set { {_error = value;} } }
5353

5454
/// <summary>Internal Acessors for Message</summary>
55-
string Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Message = value; }
55+
string Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorResponseInternal.Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Message = value ?? null; }
5656

5757
/// <summary>Internal Acessors for Target</summary>
58-
string Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Target = value; }
58+
string Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorResponseInternal.Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.Metric.Models.IErrorDetailInternal)Error).Target = value ?? null; }
5959

6060
/// <summary>The error target.</summary>
6161
[Microsoft.Azure.PowerShell.Cmdlets.Metric.Origin(Microsoft.Azure.PowerShell.Cmdlets.Metric.PropertyOrigin.Inlined)]

generated/Monitor/MetricData.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,23 @@ internal class PsHelpInfo
3636
public object Role { get; }
3737
public string NonTerminatingErrors { get; }
3838

39+
public static string CapitalizeFirstLetter(string text)
40+
{
41+
if (string.IsNullOrEmpty(text))
42+
return text;
43+
44+
return char.ToUpper(text[0]) + text.Substring(1);
45+
}
46+
3947
public PsHelpInfo(PSObject helpObject = null)
4048
{
4149
helpObject = helpObject ?? new PSObject();
4250
CmdletName = helpObject.GetProperty<string>("Name").NullIfEmpty() ?? helpObject.GetNestedProperty<string>("details", "name");
4351
ModuleName = helpObject.GetProperty<string>("ModuleName");
44-
Synopsis = helpObject.GetProperty<string>("Synopsis");
52+
Synopsis = CapitalizeFirstLetter(helpObject.GetProperty<string>("Synopsis"));
4553
Description = helpObject.GetProperty<PSObject[]>("description").EmptyIfNull().ToDescriptionText().NullIfEmpty() ??
4654
helpObject.GetNestedProperty<PSObject[]>("details", "description").EmptyIfNull().ToDescriptionText();
55+
Description = CapitalizeFirstLetter(Description);
4756
AlertText = helpObject.GetNestedProperty<PSObject[]>("alertSet", "alert").EmptyIfNull().ToDescriptionText();
4857
Category = helpObject.GetProperty<string>("Category");
4958
HasCommonParameters = helpObject.GetProperty<string>("CommonParameters").ToNullableBool();

generated/Monitor/MetricData.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,21 @@ public string GetProcessCustomAttributesAtRuntime()
216216
{Indent}{Indent}[Microsoft.Azure.PowerShell.Cmdlets.Metric.Runtime.MessageAttributeHelper]::ProcessPreviewMessageAttributesAtRuntime($cmdInfo, $MyInvocation, $parameterSet, $PSCmdlet)";
217217
}
218218

219+
private string GetLoginVerification()
220+
{
221+
if (!VariantGroup.IsInternal && IsAzure && !VariantGroup.IsModelCmdlet)
222+
{
223+
return $@"
224+
{Indent}{Indent}$context = Get-AzContext
225+
{Indent}{Indent}if (-not $context -and -not $testPlayback) {{
226+
{Indent}{Indent}{Indent}Write-Error ""No Azure login detected. Please run 'Connect-AzAccount' to log in.""
227+
{Indent}{Indent}{Indent}exit
228+
{Indent}{Indent}}}
229+
";
230+
}
231+
return "";
232+
}
233+
219234
private string GetTelemetry()
220235
{
221236
if (!VariantGroup.IsInternal && IsAzure)
@@ -248,10 +263,16 @@ public override string ToString() => $@"begin {{
248263
{Indent}{Indent}{Indent}$PSBoundParameters['OutBuffer'] = 1
249264
{Indent}{Indent}}}
250265
{Indent}{Indent}$parameterSet = $PSCmdlet.ParameterSetName
251-
{GetTelemetry()}
266+
{Indent}{Indent}
267+
{Indent}{Indent}$testPlayback = $false
268+
{Indent}{Indent}$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object {{ if ($_) {{ $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Metric.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }} }}
269+
{GetLoginVerification()}{GetTelemetry()}
252270
{GetParameterSetToCmdletMapping()}{GetDefaultValuesStatements()}
253271
{GetProcessCustomAttributesAtRuntime()}
254272
{Indent}{Indent}$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet)
273+
{Indent}{Indent}if ($wrappedCmd -eq $null) {{
274+
{Indent}{Indent}{Indent}$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Function)
275+
{Indent}{Indent}}}
255276
{Indent}{Indent}$scriptCmd = {{& $wrappedCmd @PSBoundParameters}}
256277
{Indent}{Indent}$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin)
257278
{Indent}{Indent}$steppablePipeline.Begin($PSCmdlet)
@@ -295,8 +316,6 @@ private string GetDefaultValuesStatements()
295316
if ("SubscriptionId".Equals(parameterName))
296317
{
297318
sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}'){setCondition}) {{");
298-
sb.AppendLine($"{Indent}{Indent}{Indent}$testPlayback = $false");
299-
sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object {{ if ($_) {{ $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.Metric.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) }} }}");
300319
sb.AppendLine($"{Indent}{Indent}{Indent}if ($testPlayback) {{");
301320
sb.AppendLine($"{Indent}{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = . (Join-Path $PSScriptRoot '..' 'utils' 'Get-SubscriptionIdTestSafe.ps1')");
302321
sb.AppendLine($"{Indent}{Indent}{Indent}}} else {{");

0 commit comments

Comments
 (0)