Example #1
0
 /// <summary>
 /// Api which returns CSP Usage line items for all months and years since the
 /// CSP account has
 /// been active.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <CspUsageLineItem> > GetAllDataAsync(this ICspBilling operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetAllDataWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Example #2
0
 /// <param name='operations'>
 /// Reference to the BillingWebJob.ICspBilling.
 /// </param>
 public static IList <CspUsageLineItem> GetCurrentMonthData(this ICspBilling operations)
 {
     return(Task.Factory.StartNew((object s) => { return ((ICspBilling)s).GetCurrentMonthDataAsync(); }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default)
            .Unwrap()
            .GetAwaiter()
            .GetResult());
 }
Example #3
0
        /// <param name='operations'>
        /// Reference to the BillingWebJob.ICspBilling.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <IList <CspUsageLineItem> > GetAllDataAsync(this ICspBilling operations,
                                                                             CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse
            <System.Collections.Generic.IList <BillingWebJob.Models.CspUsageLineItem> > result =
                await operations.GetAllDataWithOperationResponseAsync(cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Example #4
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"]);
 }
Example #5
0
 /// <param name='operations'>
 /// Reference to the BillingWebJob.ICspBilling.
 /// </param>
 /// <param name='startMMYYYY'>
 /// Required.
 /// </param>
 /// <param name='endMMYYYY'>
 /// Required.
 /// </param>
 public static IList <CspUsageLineItem> GetDataForMonthRange(this ICspBilling operations, string startMMYYYY,
                                                             string endMMYYYY)
 {
     return
         (Task.Factory.StartNew(
              (object s) => { return ((ICspBilling)s).GetDataForMonthRangeAsync(startMMYYYY, endMMYYYY); }
              , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default)
          .Unwrap()
          .GetAwaiter()
          .GetResult());
 }
Example #6
0
 /// <summary>
 /// Api which returns CSP Usage 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 <CspUsageLineItem> GetSingleMonthData(this ICspBilling operations, string monthYear)
 {
     return(Task.Factory.StartNew(s => ((ICspBilling)s).GetSingleMonthDataAsync(monthYear), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Example #7
0
 /// <summary>
 /// Api which returns CSP Usage 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.
 /// </param>
 /// <param name='endMonthYear'>
 /// Provide range end month and year in "mm-yyyy" format.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <CspUsageLineItem> > GetDataForMonthRangeAsync(this ICspBilling operations, string startMonthYear, string endMonthYear, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetDataForMonthRangeWithHttpMessagesAsync(startMonthYear, endMonthYear, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }