/// <summary>
 /// **Lists the metric values for a resource**.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceUri'>
 /// The identifier of the resource.
 /// </param>
 /// <param name='odataQuery'>
 /// OData parameters to apply to the operation.
 /// </param>
 /// <param name='timespan'>
 /// The timespan of the query. It is a string with the following format
 /// 'startDateTime_ISO/endDateTime_ISO'.
 /// </param>
 /// <param name='interval'>
 /// The interval (i.e. timegrain) of the query.
 /// </param>
 /// <param name='metricnames'>
 /// The names of the metrics (comma separated) to retrieve.
 /// </param>
 /// <param name='aggregation'>
 /// The list of aggregation types (comma separated) to retrieve.
 /// </param>
 /// <param name='top'>
 /// The maximum number of records to retrieve.
 /// Valid only if $filter is specified.
 /// Defaults to 10.
 /// </param>
 /// <param name='orderby'>
 /// The aggregation to use for sorting results and the direction of the sort.
 /// Only one order can be specified.
 /// Examples: sum asc.
 /// </param>
 /// <param name='resultType'>
 /// Reduces the set of data collected. The syntax allowed depends on the
 /// operation. See the operation's description for details. Possible values
 /// include: 'Data', 'Metadata'
 /// </param>
 /// <param name='metricnamespace'>
 /// Metric namespace to query metric definitions for.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <Response> ListAsync(this IMetricsOperations operations, string resourceUri, ODataQuery <MetadataValue> odataQuery = default(ODataQuery <MetadataValue>), string timespan = default(string), System.TimeSpan?interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int?top = default(int?), string orderby = default(string), ResultType?resultType = default(ResultType?), string metricnamespace = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, odataQuery, timespan, interval, metricnames, aggregation, top, orderby, resultType, metricnamespace, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Lists the metric values for a resource.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceUri'>
 /// The identifier of the resource.
 /// </param>
 /// <param name='odataQuery'>
 /// OData parameters to apply to the operation.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IEnumerable <MetricInner> > ListAsync(this IMetricsOperations operations, string resourceUri, ODataQuery <MetricInner> odataQuery = default(ODataQuery <MetricInner>), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, odataQuery, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// **Lists the metric values for a resource**.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceUri'>
 /// The identifier of the resource.
 /// </param>
 /// <param name='timespan'>
 /// The timespan of the query. It is a string with the following format
 /// 'startDateTime_ISO/endDateTime_ISO'.
 /// </param>
 /// <param name='interval'>
 /// The interval (i.e. timegrain) of the query.
 /// </param>
 /// <param name='metric'>
 /// The name of the metric to retrieve.
 /// </param>
 /// <param name='aggregation'>
 /// The list of aggregation types (comma separated) to retrieve.
 /// </param>
 /// <param name='top'>
 /// The maximum number of records to retrieve.
 /// Valid only if $filter is specified.
 /// Defaults to 10.
 /// </param>
 /// <param name='orderby'>
 /// The aggregation to use for sorting results and the direction of the sort.
 /// Only one order can be specified.
 /// Examples: sum asc.
 /// </param>
 /// <param name='filter'>
 /// The **$filter** is used to reduce the set of metric data
 /// returned.&lt;br&gt;Example:&lt;br&gt;Metric contains metadata A, B and
 /// C.&lt;br&gt;- Return all time series of C where A = a1 and B = b1 or
 /// b2&lt;br&gt;**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq
 /// ‘*’**&lt;br&gt;- Invalid variant:&lt;br&gt;**$filter=A eq ‘a1’ and B eq
 /// ‘b1’ and C eq ‘*’ or B = ‘b2’**&lt;br&gt;This is invalid because the
 /// logical or operator cannot separate two different metadata
 /// names.&lt;br&gt;- Return all time series where A = a1, B = b1 and C =
 /// c1:&lt;br&gt;**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**&lt;br&gt;-
 /// Return all time series where A = a1&lt;br&gt;**$filter=A eq ‘a1’ and B eq
 /// ‘*’ and C eq ‘*’**.
 /// </param>
 /// <param name='resultType'>
 /// Reduces the set of data collected. The syntax allowed depends on the
 /// operation. See the operation's description for details. Possible values
 /// include: 'Data', 'Metadata'
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ResponseInner> ListAsync(this IMetricsOperations operations, string resourceUri, string timespan = default(string), System.TimeSpan?interval = default(System.TimeSpan?), string metric = default(string), string aggregation = default(string), int?top = default(int?), string orderby = default(string), string filter = default(string), ResultType?resultType = default(ResultType?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, timespan, interval, metric, aggregation, top, orderby, filter, resultType, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     UsageMetrics       = new UsageMetricsOperations(this);
     EventCategories    = new EventCategoriesOperations(this);
     ActivityLogs       = new ActivityLogsOperations(this);
     TenantActivityLogs = new TenantActivityLogsOperations(this);
     MetricDefinitions  = new MetricDefinitionsOperations(this);
     Metrics            = new MetricsOperations(this);
     BaseUri            = new System.Uri("https://management.azure.com");
     AcceptLanguage     = "en-US";
     LongRunningOperationRetryTimeout = 30;
     GenerateClientRequestId          = true;
     SerializationSettings            = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
     DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
 }
 /// <summary>
 /// **Lists the metric values for a resource**.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceUri'>
 /// The identifier of the resource.
 /// </param>
 /// <param name='odataQuery'>
 /// OData parameters to apply to the operation.
 /// </param>
 /// <param name='timespan'>
 /// The timespan of the query. It is a string with the following format
 /// 'startDateTime_ISO/endDateTime_ISO'.
 /// </param>
 /// <param name='interval'>
 /// The interval (i.e. timegrain) of the query.
 /// </param>
 /// <param name='metricnames'>
 /// The names of the metrics (comma separated) to retrieve.
 /// </param>
 /// <param name='aggregation'>
 /// The list of aggregation types (comma separated) to retrieve.
 /// </param>
 /// <param name='top'>
 /// The maximum number of records to retrieve.
 /// Valid only if $filter is specified.
 /// Defaults to 10.
 /// </param>
 /// <param name='orderby'>
 /// The aggregation to use for sorting results and the direction of the sort.
 /// Only one order can be specified.
 /// Examples: sum asc.
 /// </param>
 /// <param name='resultType'>
 /// Reduces the set of data collected. The syntax allowed depends on the
 /// operation. See the operation's description for details. Possible values
 /// include: 'Data', 'Metadata'
 /// </param>
 /// <param name='metricnamespace'>
 /// Metric namespace to query metric definitions for.
 /// </param>
 public static Response List(this IMetricsOperations operations, string resourceUri, ODataQuery <MetadataValue> odataQuery = default(ODataQuery <MetadataValue>), string timespan = default(string), System.TimeSpan?interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int?top = default(int?), string orderby = default(string), ResultType?resultType = default(ResultType?), string metricnamespace = default(string))
 {
     return(operations.ListAsync(resourceUri, odataQuery, timespan, interval, metricnames, aggregation, top, orderby, resultType, metricnamespace).GetAwaiter().GetResult());
 }
 /// <summary>
 /// Lists the metric values for a resource. The $filter is used to reduce the
 /// set of metric data returned. Some common properties for this expression
 /// will be: name.value, aggregationType, startTime, endTime, timeGrain. The
 /// filter expression uses these properties with comparison operators (eg. eq,
 /// gt, lt) and multiple expressions can be combined with parentheses and
 /// 'and/or' operators. Some example filter expressions are: -
 /// $filter=(name.value eq 'RunsSucceeded') and aggregationType eq 'Total' and
 /// startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq
 /// duration'PT1M', - $filter=(name.value eq 'RunsSucceeded') and
 /// (aggregationType eq 'Total' or aggregationType eq 'Average') and startTime
 /// eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq duration'PT1H', -
 /// $filter=(name.value eq 'ActionsCompleted' or name.value eq 'RunsSucceeded')
 /// and (aggregationType eq 'Total' or aggregationType eq 'Average') and
 /// startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq
 /// duration'PT1M'.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceUri'>
 /// The identifier of the resource.
 /// </param>
 /// <param name='odataQuery'>
 /// OData parameters to apply to the operation.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <System.Collections.Generic.IEnumerable <Metric> > ListAsync(this IMetricsOperations operations, string resourceUri, Microsoft.Rest.Azure.OData.ODataQuery <Metric> odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery <Metric>), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, odataQuery, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Lists the metric values for a resource. The $filter is used to reduce the
 /// set of metric data returned. Some common properties for this expression
 /// will be: name.value, aggregationType, startTime, endTime, timeGrain. The
 /// filter expression uses these properties with comparison operators (eg. eq,
 /// gt, lt) and multiple expressions can be combined with parentheses and
 /// 'and/or' operators. Some example filter expressions are: -
 /// $filter=(name.value eq 'RunsSucceeded') and aggregationType eq 'Total' and
 /// startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq
 /// duration'PT1M', - $filter=(name.value eq 'RunsSucceeded') and
 /// (aggregationType eq 'Total' or aggregationType eq 'Average') and startTime
 /// eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq duration'PT1H', -
 /// $filter=(name.value eq 'ActionsCompleted' or name.value eq 'RunsSucceeded')
 /// and (aggregationType eq 'Total' or aggregationType eq 'Average') and
 /// startTime eq 2016-02-20 and endTime eq 2016-02-21 and timeGrain eq
 /// duration'PT1M'.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceUri'>
 /// The identifier of the resource.
 /// </param>
 /// <param name='odataQuery'>
 /// OData parameters to apply to the operation.
 /// </param>
 public static System.Collections.Generic.IEnumerable <Metric> List(this IMetricsOperations operations, string resourceUri, Microsoft.Rest.Azure.OData.ODataQuery <Metric> odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery <Metric>))
 {
     return(System.Threading.Tasks.Task.Factory.StartNew(s => ((IMetricsOperations)s).ListAsync(resourceUri, odataQuery), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }