/// <summary> /// Api which returns usage records for an azure subscription for the given /// month. /// </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> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <UsageInfoModel> > GetSingleMonthDataAsync(this IUserBilling operations, string monthYear, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetSingleMonthDataWithHttpMessagesAsync(monthYear, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <param name='operations'> /// Reference to the BillingWebJob.IUserBilling. /// </param> /// <param name='mMYYYY'> /// Required. /// </param> public static IList <UsageInfoModel> GetSingleMonthData(this IUserBilling operations, string mMYYYY) { return(Task.Factory.StartNew((object s) => { return ((IUserBilling)s).GetSingleMonthDataAsync(mMYYYY); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default) .Unwrap() .GetAwaiter() .GetResult()); }
/// <summary> /// Initializes a new instance of the BillingDataApi class. /// </summary> /// <param name='rootHandler'> /// Optional. The http client handler used to handle http transport. /// </param> /// <param name='handlers'> /// Optional. The delegating handlers to add to the http client pipeline. /// </param> protected BillingDataApi(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, 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"]); }
public BillingDataApi(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"]); }
/// <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"]); }
/// <summary> /// Initializes a new instance of the BillingDataApi class. /// </summary> /// <param name='handlers'> /// Optional. The delegating handlers to add to the http client pipeline. /// </param> /// public BillingDataApi() : base() { 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.IUserBilling. /// </param> /// <param name='startDateValue'> /// Required. /// </param> /// <param name='endDateValue'> /// Required. /// </param> public static IList <UsageInfoModel> GetDataForMonthRange(this IUserBilling operations, string startDateValue, string endDateValue) { return (Task.Factory.StartNew( (object s) => { return ((IUserBilling)s).GetDataForMonthRangeAsync(startDateValue, endDateValue); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default) .Unwrap() .GetAwaiter() .GetResult()); }
/// <param name='operations'> /// Reference to the BillingWebJob.IUserBilling. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> public static async Task <IList <UsageInfoModel> > GetCurrentMonthDataAsync(this IUserBilling operations, CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { Microsoft.Rest.HttpOperationResponse <System.Collections.Generic.IList <BillingWebJob.Models.UsageInfoModel> > result = await operations.GetCurrentMonthDataWithOperationResponseAsync(cancellationToken) .ConfigureAwait(false); return(result.Body); }
/// <param name='operations'> /// Reference to the BillingWebJob.IUserBilling. /// </param> /// <param name='startDateValue'> /// Required. /// </param> /// <param name='endDateValue'> /// Required. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> public static async Task <IList <UsageInfoModel> > GetDataForMonthRangeAsync(this IUserBilling operations, string startDateValue, string endDateValue, CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { Microsoft.Rest.HttpOperationResponse <System.Collections.Generic.IList <BillingWebJob.Models.UsageInfoModel> > result = await operations.GetDataForMonthRangeWithOperationResponseAsync(startDateValue, endDateValue, cancellationToken).ConfigureAwait(false); return(result.Body); }
/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { this.CspBilling = new CspBilling(this); this.CspSummary = new CspSummary(this); this.CspUsage = new CspUsage(this); this.CspUtilization = new CspUtilization(this); this.EaBilling = new EaBilling(this); this.UserBilling = new UserBilling(this); this.BaseUri = new Uri("http://localhost:18175"); SerializationSettings = new JsonSerializerSettings { Formatting = Formatting.Indented, DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = DateTimeZoneHandling.Utc, NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; CustomInitialize(); }
/// <summary> /// Api which returns usage records for an azure subscription for the current /// month. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> public static IList <UsageInfoModel> GetCurrentMonthData(this IUserBilling operations) { return(Task.Factory.StartNew(s => ((IUserBilling)s).GetCurrentMonthDataAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }