/// <summary> /// Query aggregated Azure subscription consumption data for a date /// range. (see /// https://msdn.microsoft.com/library/azure/1ea5b323-54bb-423d-916f-190de96c6a3c /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Commerce.UsageAggregates.IUsageAggregationOperations. /// </param> /// <param name='reportedStartTime'> /// Required. The start of the time range to retrieve data for. /// </param> /// <param name='reportedEndTime'> /// Required. The end of the time range to retrieve data for. /// </param> /// <param name='aggregationGranularity'> /// Required. Value is either daily (default) or hourly to tell the API /// how to return the results grouped by day or hour. /// </param> /// <param name='showDetails'> /// Required. When set to true (default), the aggregates are broken /// down into the instance metadata which is more granular. /// </param> /// <param name='continuationToken'> /// Optional. Retrieved from previous calls, this is the bookmark used /// for progress when the responses are paged. /// </param> /// <returns> /// The Get UsageAggregates operation response. /// </returns> public static UsageAggregationGetResponse Get(this IUsageAggregationOperations operations, DateTime reportedStartTime, DateTime reportedEndTime, AggregationGranularity aggregationGranularity, bool showDetails, string continuationToken) { return(Task.Factory.StartNew((object s) => { return ((IUsageAggregationOperations)s).GetAsync(reportedStartTime, reportedEndTime, aggregationGranularity, showDetails, continuationToken); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Initializes a new instance of the UsageAggregationManagementClient /// class. /// </summary> /// <param name='httpClient'> /// The Http client /// </param> public UsageAggregationManagementClient(HttpClient httpClient) : base(httpClient) { this._usageAggregates = new UsageAggregationOperations(this); this._apiVersion = "2015-06-01-preview"; this._longRunningOperationInitialTimeout = -1; this._longRunningOperationRetryTimeout = -1; this.HttpClient.Timeout = TimeSpan.FromSeconds(300); }
/// <summary> /// Query aggregated Azure subscription consumption data for a date /// range. (see /// https://msdn.microsoft.com/library/azure/1ea5b323-54bb-423d-916f-190de96c6a3c /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Commerce.UsageAggregates.IUsageAggregationOperations. /// </param> /// <param name='reportedStartTime'> /// Required. The start of the time range to retrieve data for. /// </param> /// <param name='reportedEndTime'> /// Required. The end of the time range to retrieve data for. /// </param> /// <param name='aggregationGranularity'> /// Required. Value is either daily (default) or hourly to tell the API /// how to return the results grouped by day or hour. /// </param> /// <param name='showDetails'> /// Required. When set to true (default), the aggregates are broken /// down into the instance metadata which is more granular. /// </param> /// <param name='continuationToken'> /// Optional. Retrieved from previous calls, this is the bookmark used /// for progress when the responses are paged. /// </param> /// <returns> /// The Get UsageAggregates operation response. /// </returns> public static Task <UsageAggregationGetResponse> GetAsync(this IUsageAggregationOperations operations, DateTime reportedStartTime, DateTime reportedEndTime, AggregationGranularity aggregationGranularity, bool showDetails, string continuationToken) { return(operations.GetAsync(reportedStartTime, reportedEndTime, aggregationGranularity, showDetails, continuationToken, CancellationToken.None)); }