Azure / autorest.powershell

AutoRest PowerShell Generator
MIT License
112 stars 81 forks source link

Monitor Metric Get-AzMetricsBatch encode name parameter twice #1296

Closed JoyerJin closed 8 months ago

JoyerJin commented 8 months ago

[Metric] Set multiple metric names to "Name" parameter, each has more than one word or not trimmed, the second or the not trimmed one can't be recognized. https://msazure.visualstudio.com/One/_workitems/edit/26420679

image image

test cmdlet: $endpoint = 'https://eastus.metrics.monitor.azure.com' $end = "2024-01-15T21:30:00.000Z" $start = "2024-01-15T21:00:00.000Z" Get-AzMetricsBatch -Endpoint $endpoint -Name 'browsertimings/totalDuration','requests/duration','browsertimings/processingDuration' -Namespace microsoft.insights/components -StartTime $start -EndTime $end -ResourceId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/metric-joyer/providers/microsoft.insights/components/insight-test-joyer-01

README: https://github.com/Azure/azure-powershell/blob/generation/src/Monitor/MetricsData.Autorest/README.md

source file: src/Monitor/MetricsData.Autorest/generated/api/Metric.cs

actually: (null != metricnames && metricnames.Count > 0 ? "metricnames=" + global::System.Uri.EscapeDataString(global::System.Linq.Enumerable.Aggregate(metricnames, (current, each) => current + "," + ( global::System.Uri.EscapeDataString(null == each ? global::System.String.Empty : each.ToString()) ))) : global::System.String.Empty)

expected: (null != metricnames && metricnames.Count > 0 ? "metricnames=" + global::System.Uri.EscapeDataString(global::System.Linq.Enumerable.Aggregate(metricnames, (current, each) => current + "," + ( null == each ? global::System.String.Empty : each.ToString() ))) : global::System.String.Empty)

dolauli commented 8 months ago

Fixed