@@ -25,14 +25,18 @@ namespace Microsoft.Azure.Commands.Insights.UsageMetrics
25
25
/// <summary>
26
26
/// Get the list of usage metrics for a resource.
27
27
/// </summary>
28
- [ Cmdlet ( VerbsCommon . Get , "UsageMetrics" ) , OutputType ( typeof ( UsageMetric [ ] ) ) ]
28
+ [ Cmdlet ( VerbsCommon . Get , "UsageMetrics" ) , OutputType ( typeof ( PSUsageMetric [ ] ) ) ]
29
29
public class GetUsageMetricsCommand : InsightsClientCmdletBase
30
30
{
31
31
/// <summary>
32
32
/// Default value of the timerange to search for usage metrics
33
33
/// </summary>
34
34
public static readonly TimeSpan DefaultTimeRange = TimeSpan . FromHours ( 1 ) ;
35
35
36
+ /// <summary>
37
+ /// Default API version string for the underlying RP.
38
+ /// The Insights backend gets the data from the RPs, and the RPs don not necessarily use the same API version.
39
+ /// </summary>
36
40
public static readonly string DefaultApiVersion = "2014-04-01" ;
37
41
38
42
/// <summary>
@@ -77,7 +81,9 @@ protected string ProcessParameters()
77
81
var buffer = new StringBuilder ( ) ;
78
82
if ( this . MetricNames != null )
79
83
{
80
- var metrics = this . MetricNames . Select ( n => string . Concat ( "name.value eq '" , n , "'" ) ) . Aggregate ( ( a , b ) => string . Concat ( a , " or " , b ) ) ;
84
+ var metrics = this . MetricNames
85
+ . Select ( n => string . Concat ( "name.value eq '" , n , "'" ) )
86
+ . Aggregate ( ( a , b ) => string . Concat ( a , " or " , b ) ) ;
81
87
82
88
buffer . Append ( "(" ) ;
83
89
buffer . Append ( metrics ) ;
@@ -120,8 +126,12 @@ protected override void ExecuteCmdletInternal()
120
126
121
127
// Call the proper API methods to return a list of raw records.
122
128
// If fullDetails is present full details of the records displayed, otherwise only a summary of the values is displayed
123
- UsageMetricListResponse response = this . InsightsClient . UsageMetricOperations . ListAsync ( resourceUri : this . ResourceId , filterString : queryFilter , apiVersion : apiVersion , cancellationToken : CancellationToken . None ) . Result ;
124
- var records = response . UsageMetricCollection . Value . Select ( e => new PSUsageMetric ( e ) ) . ToArray ( ) ;
129
+ UsageMetricListResponse response = this . InsightsClient . UsageMetricOperations
130
+ . ListAsync ( resourceUri : this . ResourceId , filterString : queryFilter , apiVersion : apiVersion , cancellationToken : CancellationToken . None )
131
+ . Result ;
132
+ var records = response . UsageMetricCollection . Value
133
+ . Select ( e => new PSUsageMetric ( e ) )
134
+ . ToArray ( ) ;
125
135
126
136
WriteObject ( sendToPipeline : records ) ;
127
137
}
0 commit comments