/// <summary> /// The List Metric Value operation lists the metric value sets for the /// resource metrics. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Monitoring.Metrics.IMetricValueOperations. /// </param> /// <param name='resourceId'> /// Required. The id of the resource. /// </param> /// <param name='metricNames'> /// Required. The names of the metrics. /// </param> /// <param name='metricNamespace'> /// Optional. The namespace of the metrics. /// </param> /// <param name='timeGrain'> /// Required. The time grain of the metrics. /// </param> /// <param name='startTime'> /// Required. The start time (in UTC) of the metrics. /// </param> /// <param name='endTime'> /// Required. The end time (in UTC) of the metrics. /// </param> /// <returns> /// The List Metric values operation response. /// </returns> public static MetricValueListResponse List(this IMetricValueOperations operations, string resourceId, IList <string> metricNames, string metricNamespace, TimeSpan timeGrain, DateTime startTime, DateTime endTime) { return(Task.Factory.StartNew((object s) => { return ((IMetricValueOperations)s).ListAsync(resourceId, metricNames, metricNamespace, timeGrain, startTime, endTime); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Initializes a new instance of the MetricsClient class. /// </summary> private MetricsClient() : base() { this._metricDefinitions = new MetricDefinitionOperations(this); this._metricSettings = new MetricSettingOperations(this); this._metricValues = new MetricValueOperations(this); this.HttpClient.Timeout = TimeSpan.FromSeconds(300); }
/// <summary> /// Initializes a new instance of the MetricsClient class. /// </summary> /// <param name='httpClient'> /// The Http client /// </param> private MetricsClient(HttpClient httpClient) : base(httpClient) { this._metricDefinitions = new MetricDefinitionOperations(this); this._metricSettings = new MetricSettingOperations(this); this._metricValues = new MetricValueOperations(this); this._apiVersion = "2013-10-01"; this._longRunningOperationInitialTimeout = -1; this._longRunningOperationRetryTimeout = -1; this.HttpClient.Timeout = TimeSpan.FromSeconds(300); }
/// <summary> /// The List Metric Value operation lists the metric value sets for the /// resource metrics. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Monitoring.Metrics.IMetricValueOperations. /// </param> /// <param name='resourceId'> /// The id of the resource. /// </param> /// <param name='metricNames'> /// The names of the metrics. /// </param> /// <param name='metricNamespace'> /// The namespace of the metrics. /// </param> /// <param name='timeGrain'> /// The time grain of the metrics. /// </param> /// <param name='startTime'> /// The start time (in UTC) of the metrics. /// </param> /// <param name='endTime'> /// The end time (in UTC) of the metrics. /// </param> /// <returns> /// The List Metric values operation response. /// </returns> public static MetricValueListResponse List(this IMetricValueOperations operations, string resourceId, IList <string> metricNames, string metricNamespace, TimeSpan timeGrain, DateTime startTime, DateTime endTime) { try { return(operations.ListAsync(resourceId, metricNames, metricNamespace, timeGrain, startTime, endTime).Result); } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 1) { throw; } else { throw ex.InnerException; } } }
/// <summary> /// The List Metric Value operation lists the metric value sets for the /// resource metrics. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Monitoring.Metrics.IMetricValueOperations. /// </param> /// <param name='resourceId'> /// The id of the resource. /// </param> /// <param name='metricNames'> /// The names of the metrics. /// </param> /// <param name='metricNamespace'> /// The namespace of the metrics. /// </param> /// <param name='timeGrain'> /// The time grain of the metrics. /// </param> /// <param name='startTime'> /// The start time (in UTC) of the metrics. /// </param> /// <param name='endTime'> /// The end time (in UTC) of the metrics. /// </param> /// <returns> /// The List Metric values operation response. /// </returns> public static Task <MetricValueListResponse> ListAsync(this IMetricValueOperations operations, string resourceId, IList <string> metricNames, string metricNamespace, TimeSpan timeGrain, DateTime startTime, DateTime endTime) { return(operations.ListAsync(resourceId, metricNames, metricNamespace, timeGrain, startTime, endTime, CancellationToken.None)); }