/// <param name='operations'>
 /// Reference to the BillingWebJob.ICspSummary.
 /// </param>
 public static IList <UsageBasedLineItem> GetCurrentMonthData(this ICspSummary operations)
 {
     return(Task.Factory.StartNew((object s) => { return ((ICspSummary)s).GetCurrentMonthDataAsync(); }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default)
            .Unwrap()
            .GetAwaiter()
            .GetResult());
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the AzureAnalyticsApi class.
 /// </summary>
 /// <param name='handlers'>
 /// Optional. The set of delegating handlers to insert in the http
 /// client pipeline.
 /// </param>
 public AzureAnalyticsApi(params DelegatingHandler[] handlers)
     : base(handlers)
 {
     this._cspBilling  = new CspBilling(this);
     this._cspSummary  = new CspSummary(this);
     this._cspUsage    = new CspUsage(this);
     this._eaBilling   = new EaBilling(this);
     this._userBilling = new UserBilling(this);
     this._baseUri     = new Uri(ConfigurationManager.AppSettings["WebApiUrl"]);
 }
 /// <param name='operations'>
 /// Reference to the BillingWebJob.ICspSummary.
 /// </param>
 /// <param name='startMMYYYY'>
 /// Required.
 /// </param>
 /// <param name='endMMYYYY'>
 /// Required.
 /// </param>
 public static IList <UsageBasedLineItem> GetDataForMonthRange(this ICspSummary operations, string startMMYYYY,
                                                               string endMMYYYY)
 {
     return
         (Task.Factory.StartNew(
              (object s) => { return ((ICspSummary)s).GetDataForMonthRangeAsync(startMMYYYY, endMMYYYY); }
              , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default)
          .Unwrap()
          .GetAwaiter()
          .GetResult());
 }
 /// <summary>
 /// Api which returns CSP summarized invoice line items for the given month
 /// input.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='monthYear'>
 /// Provide month and year in "mm-yyyy" format. Example: "02-2016".
 /// </param>
 public static IList <UsageBasedLineItem> GetSingleMonthData(this ICspSummary operations, string monthYear)
 {
     return(Task.Factory.StartNew(s => ((ICspSummary)s).GetSingleMonthDataAsync(monthYear), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <summary>
 /// Api which returns CSP summarized invoice line items for the current month
 /// only.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <UsageBasedLineItem> > GetCurrentMonthDataAsync(this ICspSummary operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetCurrentMonthDataWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Api which returns CSP summarized invoice line items for the given month
 /// range input.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='startMonthYear'>
 /// Provide range start month and year in "mm-yyyy" format. Example: "02-2016".
 /// </param>
 /// <param name='endMonthYear'>
 /// Provide range end month and year in "mm-yyyy" format. Example: "02-2016".
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <UsageBasedLineItem> > GetDataForMonthRangeAsync(this ICspSummary operations, string startMonthYear, string endMonthYear, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetDataForMonthRangeWithHttpMessagesAsync(startMonthYear, endMonthYear, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
        /// <param name='operations'>
        /// Reference to the BillingWebJob.ICspSummary.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <IList <UsageBasedLineItem> > GetCurrentMonthDataAsync(this ICspSummary operations,
                                                                                        CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse
            <System.Collections.Generic.IList <BillingWebJob.Models.UsageBasedLineItem> > result =
                await
                operations.GetCurrentMonthDataWithOperationResponseAsync(cancellationToken)
                .ConfigureAwait(false);

            return(result.Body);
        }