diff --git a/lib/services/consumptionManagement/README.md b/lib/services/consumptionManagement/README.md index c1457c7e45..07b41f3f8c 100644 --- a/lib/services/consumptionManagement/README.md +++ b/lib/services/consumptionManagement/README.md @@ -18,7 +18,7 @@ npm install azure-arm-consumption ## How to use -### Authentication, client creation and list forecasts as an example. +### Authentication, client creation and get priceSheet as an example. ```javascript const msRestAzure = require("ms-rest-azure"); @@ -26,8 +26,10 @@ const ConsumptionManagementClient = require("azure-arm-consumption"); msRestAzure.interactiveLogin().then((creds) => { const subscriptionId = ""; const client = new ConsumptionManagementClient(creds, subscriptionId); - const filter = "testfilter"; - return client.forecasts.list(filter).then((result) => { + const expand = "testexpand"; + const skiptoken = "testskiptoken"; + const top = 1; + return client.priceSheet.get(expand, skiptoken, top).then((result) => { console.log("The result is:"); console.log(result); }); diff --git a/lib/services/consumptionManagement/lib/consumptionManagementClient.d.ts b/lib/services/consumptionManagement/lib/consumptionManagementClient.d.ts index 41286db70f..bbbcb3e035 100644 --- a/lib/services/consumptionManagement/lib/consumptionManagementClient.d.ts +++ b/lib/services/consumptionManagement/lib/consumptionManagementClient.d.ts @@ -56,6 +56,8 @@ export default class ConsumptionManagementClient extends AzureServiceClient { generateClientRequestId: boolean; // Operation groups + priceSheet: operations.PriceSheet; + usageDetails: operations.UsageDetails; forecasts: operations.Forecasts; operations: operations.Operations; } diff --git a/lib/services/consumptionManagement/lib/consumptionManagementClient.js b/lib/services/consumptionManagement/lib/consumptionManagementClient.js index 31bb8c5667..10be56690e 100644 --- a/lib/services/consumptionManagement/lib/consumptionManagementClient.js +++ b/lib/services/consumptionManagement/lib/consumptionManagementClient.js @@ -72,6 +72,8 @@ class ConsumptionManagementClient extends ServiceClient { if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { this.generateClientRequestId = options.generateClientRequestId; } + this.priceSheet = new operations.PriceSheet(this); + this.usageDetails = new operations.UsageDetails(this); this.forecasts = new operations.Forecasts(this); this.operations = new operations.Operations(this); this.models = models; diff --git a/lib/services/consumptionManagement/lib/models/index.d.ts b/lib/services/consumptionManagement/lib/models/index.d.ts index ea10d9f528..4030a06ba8 100644 --- a/lib/services/consumptionManagement/lib/models/index.d.ts +++ b/lib/services/consumptionManagement/lib/models/index.d.ts @@ -101,6 +101,93 @@ export interface Resource extends BaseResource { readonly tags?: { [propertyName: string]: string }; } +/** + * @class + * Initializes a new instance of the MeterDetails class. + * @constructor + * The properties of the meter detail. + * + * @member {string} [meterName] The name of the meter, within the given meter + * category + * @member {string} [meterCategory] The category of the meter, for example, + * 'Cloud services', 'Networking', etc.. + * @member {string} [meterSubCategory] The subcategory of the meter, for + * example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. + * @member {string} [unit] The unit in which the meter consumption is charged, + * for example, 'Hours', 'GB', etc. + * @member {string} [meterLocation] The location in which the Azure service is + * available. + * @member {number} [totalIncludedQuantity] The total included quantity + * associated with the offer. + * @member {number} [pretaxStandardRate] The pretax listing price. + */ +export interface MeterDetails { + readonly meterName?: string; + readonly meterCategory?: string; + readonly meterSubCategory?: string; + readonly unit?: string; + readonly meterLocation?: string; + readonly totalIncludedQuantity?: number; + readonly pretaxStandardRate?: number; +} + +/** + * @class + * Initializes a new instance of the PriceSheetProperties class. + * @constructor + * The properties of the price sheet. + * + * @member {string} [billingPeriodId] The id of the billing period resource + * that the usage belongs to. + * @member {uuid} [meterId] The meter id (GUID) + * @member {object} [meterDetails] The details about the meter. By default this + * is not populated, unless it's specified in $expand. + * @member {string} [meterDetails.meterName] The name of the meter, within the + * given meter category + * @member {string} [meterDetails.meterCategory] The category of the meter, for + * example, 'Cloud services', 'Networking', etc.. + * @member {string} [meterDetails.meterSubCategory] The subcategory of the + * meter, for example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. + * @member {string} [meterDetails.unit] The unit in which the meter consumption + * is charged, for example, 'Hours', 'GB', etc. + * @member {string} [meterDetails.meterLocation] The location in which the + * Azure service is available. + * @member {number} [meterDetails.totalIncludedQuantity] The total included + * quantity associated with the offer. + * @member {number} [meterDetails.pretaxStandardRate] The pretax listing price. + * @member {string} [unitOfMeasure] Unit of measure + * @member {number} [includedQuantity] Included quality for an offer + * @member {string} [partNumber] Part Number + * @member {number} [unitPrice] Unit Price + * @member {string} [currencyCode] Currency Code + * @member {string} [offerId] Offer Id + */ +export interface PriceSheetProperties { + readonly billingPeriodId?: string; + readonly meterId?: string; + readonly meterDetails?: MeterDetails; + readonly unitOfMeasure?: string; + readonly includedQuantity?: number; + readonly partNumber?: string; + readonly unitPrice?: number; + readonly currencyCode?: string; + readonly offerId?: string; +} + +/** + * @class + * Initializes a new instance of the PriceSheetResult class. + * @constructor + * An pricesheet resource. + * + * @member {array} [pricesheets] Price sheet + * @member {string} [nextLink] The link (url) to the next page of results. + */ +export interface PriceSheetResult extends Resource { + readonly pricesheets?: PriceSheetProperties[]; + readonly nextLink?: string; +} + /** * @class * Initializes a new instance of the ForecastPropertiesConfidenceLevelsItem class. @@ -142,6 +229,118 @@ export interface Forecast extends Resource { readonly confidenceLevels?: ForecastPropertiesConfidenceLevelsItem[]; } +/** + * @class + * Initializes a new instance of the UsageDetail class. + * @constructor + * An usage detail resource. + * + * @member {string} [billingPeriodId] The id of the billing period resource + * that the usage belongs to. + * @member {string} [invoiceId] The id of the invoice resource that the usage + * belongs to. + * @member {date} [usageStart] The start of the date time range covered by the + * usage detail. + * @member {date} [usageEnd] The end of the date time range covered by the + * usage detail. + * @member {string} [instanceName] The name of the resource instance that the + * usage is about. + * @member {string} [instanceId] The uri of the resource instance that the + * usage is about. + * @member {string} [instanceLocation] The location of the resource instance + * that the usage is about. + * @member {string} [currency] The ISO currency in which the meter is charged, + * for example, USD. + * @member {number} [usageQuantity] The quantity of usage. + * @member {number} [billableQuantity] The billable usage quantity. + * @member {number} [pretaxCost] The amount of cost before tax. + * @member {boolean} [isEstimated] The estimated usage is subject to change. + * @member {uuid} [meterId] The meter id (GUID). + * @member {object} [meterDetails] The details about the meter. By default this + * is not populated, unless it's specified in $expand. + * @member {string} [meterDetails.meterName] The name of the meter, within the + * given meter category + * @member {string} [meterDetails.meterCategory] The category of the meter, for + * example, 'Cloud services', 'Networking', etc.. + * @member {string} [meterDetails.meterSubCategory] The subcategory of the + * meter, for example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. + * @member {string} [meterDetails.unit] The unit in which the meter consumption + * is charged, for example, 'Hours', 'GB', etc. + * @member {string} [meterDetails.meterLocation] The location in which the + * Azure service is available. + * @member {number} [meterDetails.totalIncludedQuantity] The total included + * quantity associated with the offer. + * @member {number} [meterDetails.pretaxStandardRate] The pretax listing price. + * @member {uuid} [subscriptionGuid] Subscription guid. + * @member {string} [subscriptionName] Subscription name. + * @member {string} [accountName] Account name. + * @member {string} [departmentName] Department name. + * @member {string} [product] Product name. + * @member {string} [consumedService] Consumed service name. + * @member {string} [costCenter] The cost center of this department if it is a + * department and a costcenter exists + * @member {string} [partNumber] Part Number + * @member {string} [resourceGuid] Resource Guid + * @member {string} [offerId] Offer Id + * @member {boolean} [chargesBilledSeparately] Charges billed separately + * @member {string} [additionalProperties] Additional details of this usage + * item. By default this is not populated, unless it's specified in $expand. + */ +export interface UsageDetail extends Resource { + readonly billingPeriodId?: string; + readonly invoiceId?: string; + readonly usageStart?: Date; + readonly usageEnd?: Date; + readonly instanceName?: string; + readonly instanceId?: string; + readonly instanceLocation?: string; + readonly currency?: string; + readonly usageQuantity?: number; + readonly billableQuantity?: number; + readonly pretaxCost?: number; + readonly isEstimated?: boolean; + readonly meterId?: string; + readonly meterDetails?: MeterDetails; + readonly subscriptionGuid?: string; + readonly subscriptionName?: string; + readonly accountName?: string; + readonly departmentName?: string; + readonly product?: string; + readonly consumedService?: string; + readonly costCenter?: string; + readonly partNumber?: string; + readonly resourceGuid?: string; + readonly offerId?: string; + readonly chargesBilledSeparately?: boolean; + readonly additionalProperties?: string; +} + +/** + * @class + * Initializes a new instance of the QueryOptions class. + * @constructor + * Additional parameters for a set of operations. + * + * @member {string} [apply] OData apply expression to aggregate usageDetails by + * tags or (tags and properties/usageStart) + */ +export interface QueryOptions { + apply?: string; +} + + +/** + * @class + * Initializes a new instance of the UsageDetailsListResult class. + * @constructor + * Result of listing usage details. It contains a list of available usage + * details in reverse chronological order by billing period. + * + * @member {string} [nextLink] The link (url) to the next page of results. + */ +export interface UsageDetailsListResult extends Array { + readonly nextLink?: string; +} /** * @class diff --git a/lib/services/consumptionManagement/lib/models/index.js b/lib/services/consumptionManagement/lib/models/index.js index 5d0e4ce9fd..72a500dca9 100644 --- a/lib/services/consumptionManagement/lib/models/index.js +++ b/lib/services/consumptionManagement/lib/models/index.js @@ -23,7 +23,13 @@ exports.ErrorResponse = require('./errorResponse'); exports.OperationDisplay = require('./operationDisplay'); exports.Operation = require('./operation'); exports.Resource = require('./resource'); +exports.MeterDetails = require('./meterDetails'); +exports.PriceSheetProperties = require('./priceSheetProperties'); +exports.PriceSheetResult = require('./priceSheetResult'); exports.ForecastPropertiesConfidenceLevelsItem = require('./forecastPropertiesConfidenceLevelsItem'); exports.Forecast = require('./forecast'); +exports.UsageDetail = require('./usageDetail'); +exports.QueryOptions = require('./queryOptions'); +exports.UsageDetailsListResult = require('./usageDetailsListResult'); exports.ForecastsListResult = require('./forecastsListResult'); exports.OperationListResult = require('./operationListResult'); diff --git a/lib/services/consumptionManagement/lib/models/priceSheetProperties.js b/lib/services/consumptionManagement/lib/models/priceSheetProperties.js index b40d0a6a23..42cec9de79 100644 --- a/lib/services/consumptionManagement/lib/models/priceSheetProperties.js +++ b/lib/services/consumptionManagement/lib/models/priceSheetProperties.js @@ -43,6 +43,7 @@ class PriceSheetProperties { * @member {string} [partNumber] Part Number * @member {number} [unitPrice] Unit Price * @member {string} [currencyCode] Currency Code + * @member {string} [offerId] Offer Id */ constructor() { } @@ -125,6 +126,14 @@ class PriceSheetProperties { type: { name: 'String' } + }, + offerId: { + required: false, + readOnly: true, + serializedName: 'offerId', + type: { + name: 'String' + } } } } diff --git a/lib/services/consumptionManagement/lib/models/usageDetail.js b/lib/services/consumptionManagement/lib/models/usageDetail.js index 787e10d164..5fbbcdaa37 100644 --- a/lib/services/consumptionManagement/lib/models/usageDetail.js +++ b/lib/services/consumptionManagement/lib/models/usageDetail.js @@ -65,6 +65,10 @@ class UsageDetail extends models['Resource'] { * @member {string} [consumedService] Consumed service name. * @member {string} [costCenter] The cost center of this department if it is * a department and a costcenter exists + * @member {string} [partNumber] Part Number + * @member {string} [resourceGuid] Resource Guid + * @member {string} [offerId] Offer Id + * @member {boolean} [chargesBilledSeparately] Charges billed separately * @member {string} [additionalProperties] Additional details of this usage * item. By default this is not populated, unless it's specified in $expand. */ @@ -294,6 +298,38 @@ class UsageDetail extends models['Resource'] { name: 'String' } }, + partNumber: { + required: false, + readOnly: true, + serializedName: 'properties.partNumber', + type: { + name: 'String' + } + }, + resourceGuid: { + required: false, + readOnly: true, + serializedName: 'properties.resourceGuid', + type: { + name: 'String' + } + }, + offerId: { + required: false, + readOnly: true, + serializedName: 'properties.offerId', + type: { + name: 'String' + } + }, + chargesBilledSeparately: { + required: false, + readOnly: true, + serializedName: 'properties.chargesBilledSeparately', + type: { + name: 'Boolean' + } + }, additionalProperties: { required: false, readOnly: true, diff --git a/lib/services/consumptionManagement/lib/operations/index.d.ts b/lib/services/consumptionManagement/lib/operations/index.d.ts index 937b2962e7..c56b27cd21 100644 --- a/lib/services/consumptionManagement/lib/operations/index.d.ts +++ b/lib/services/consumptionManagement/lib/operations/index.d.ts @@ -12,6 +12,1570 @@ import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationRes import * as models from '../models'; +/** + * @class + * PriceSheet + * __NOTE__: An instance of this class is automatically created for an + * instance of the ConsumptionManagementClient. + */ +export interface PriceSheet { + + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available + * via this API only for May 1, 2014 or later. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/meterDetails within a price sheet. By default, these fields are + * not included when returning price sheet. + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the top N results. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(options?: { expand? : string, skiptoken? : string, top? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available + * via this API only for May 1, 2014 or later. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/meterDetails within a price sheet. By default, these fields are + * not included when returning price sheet. + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the top N results. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {PriceSheetResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {PriceSheetResult} [result] - The deserialized result object if an error did not occur. + * See {@link PriceSheetResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(options?: { expand? : string, skiptoken? : string, top? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + get(callback: ServiceCallback): void; + get(options: { expand? : string, skiptoken? : string, top? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price + * sheet is available via this API only for May 1, 2014 or later. + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/meterDetails within a price sheet. By default, these fields are + * not included when returning price sheet. + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the top N results. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getByBillingPeriodWithHttpOperationResponse(billingPeriodName: string, options?: { expand? : string, skiptoken? : string, top? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price + * sheet is available via this API only for May 1, 2014 or later. + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/meterDetails within a price sheet. By default, these fields are + * not included when returning price sheet. + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the top N results. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {PriceSheetResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {PriceSheetResult} [result] - The deserialized result object if an error did not occur. + * See {@link PriceSheetResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getByBillingPeriod(billingPeriodName: string, options?: { expand? : string, skiptoken? : string, top? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + getByBillingPeriod(billingPeriodName: string, callback: ServiceCallback): void; + getByBillingPeriod(billingPeriodName: string, options: { expand? : string, skiptoken? : string, top? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * UsageDetails + * __NOTE__: An instance of this class is automatically created for an + * instance of the ConsumptionManagementClient. + */ +export interface UsageDetails { + + + /** + * Lists the usage details for a scope by current billing period. Usage details + * are available via this API only for May 1, 2014 or later. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details for a scope by current billing period. Usage details + * are available via this API only for May 1, 2014 or later. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the usage details for a scope by billing period. Usage details are + * available via this API only for May 1, 2014 or later. + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByBillingPeriodWithHttpOperationResponse(billingPeriodName: string, options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details for a scope by billing period. Usage details are + * available via this API only for May 1, 2014 or later. + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByBillingPeriod(billingPeriodName: string, options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise; + listByBillingPeriod(billingPeriodName: string, callback: ServiceCallback): void; + listByBillingPeriod(billingPeriodName: string, options: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the usage details by billingAccountId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} billingAccountId BillingAccount ID + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByBillingAccountWithHttpOperationResponse(billingAccountId: string, options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details by billingAccountId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} billingAccountId BillingAccount ID + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByBillingAccount(billingAccountId: string, options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise; + listByBillingAccount(billingAccountId: string, callback: ServiceCallback): void; + listByBillingAccount(billingAccountId: string, options: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the usage details based on billingAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} billingAccountId BillingAccount ID + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listForBillingPeriodByBillingAccountWithHttpOperationResponse(billingAccountId: string, billingPeriodName: string, options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details based on billingAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} billingAccountId BillingAccount ID + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listForBillingPeriodByBillingAccount(billingAccountId: string, billingPeriodName: string, options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise; + listForBillingPeriodByBillingAccount(billingAccountId: string, billingPeriodName: string, callback: ServiceCallback): void; + listForBillingPeriodByBillingAccount(billingAccountId: string, billingPeriodName: string, options: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the usage details by departmentId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} departmentId Department ID + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByDepartmentWithHttpOperationResponse(departmentId: string, options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details by departmentId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} departmentId Department ID + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByDepartment(departmentId: string, options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise; + listByDepartment(departmentId: string, callback: ServiceCallback): void; + listByDepartment(departmentId: string, options: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the usage details based on departmentId for a scope by billing period. + * Usage details are available via this API only for May 1, 2014 or later. + * + * @param {string} departmentId Department ID + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listForBillingPeriodByDepartmentWithHttpOperationResponse(departmentId: string, billingPeriodName: string, options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details based on departmentId for a scope by billing period. + * Usage details are available via this API only for May 1, 2014 or later. + * + * @param {string} departmentId Department ID + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listForBillingPeriodByDepartment(departmentId: string, billingPeriodName: string, options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise; + listForBillingPeriodByDepartment(departmentId: string, billingPeriodName: string, callback: ServiceCallback): void; + listForBillingPeriodByDepartment(departmentId: string, billingPeriodName: string, options: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the usage details by enrollmentAccountId for a scope by current + * billing period. Usage details are available via this API only for May 1, + * 2014 or later. + * + * @param {string} enrollmentAccountId EnrollmentAccount ID + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByEnrollmentAccountWithHttpOperationResponse(enrollmentAccountId: string, options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details by enrollmentAccountId for a scope by current + * billing period. Usage details are available via this API only for May 1, + * 2014 or later. + * + * @param {string} enrollmentAccountId EnrollmentAccount ID + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByEnrollmentAccount(enrollmentAccountId: string, options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise; + listByEnrollmentAccount(enrollmentAccountId: string, callback: ServiceCallback): void; + listByEnrollmentAccount(enrollmentAccountId: string, options: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} enrollmentAccountId EnrollmentAccount ID + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listForBillingPeriodByEnrollmentAccountWithHttpOperationResponse(enrollmentAccountId: string, billingPeriodName: string, options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} enrollmentAccountId EnrollmentAccount ID + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listForBillingPeriodByEnrollmentAccount(enrollmentAccountId: string, billingPeriodName: string, options?: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }): Promise; + listForBillingPeriodByEnrollmentAccount(enrollmentAccountId: string, billingPeriodName: string, callback: ServiceCallback): void; + listForBillingPeriodByEnrollmentAccount(enrollmentAccountId: string, billingPeriodName: string, options: { expand? : string, filter? : string, skiptoken? : string, top? : number, queryOptions? : models.QueryOptions, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the usage details for a scope by current billing period. Usage details + * are available via this API only for May 1, 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details for a scope by current billing period. Usage details + * are available via this API only for May 1, 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the usage details for a scope by billing period. Usage details are + * available via this API only for May 1, 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByBillingPeriodNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details for a scope by billing period. Usage details are + * available via this API only for May 1, 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByBillingPeriodNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByBillingPeriodNext(nextPageLink: string, callback: ServiceCallback): void; + listByBillingPeriodNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the usage details by billingAccountId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByBillingAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details by billingAccountId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByBillingAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByBillingAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByBillingAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the usage details based on billingAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listForBillingPeriodByBillingAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details based on billingAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listForBillingPeriodByBillingAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listForBillingPeriodByBillingAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listForBillingPeriodByBillingAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the usage details by departmentId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByDepartmentNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details by departmentId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByDepartmentNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDepartmentNext(nextPageLink: string, callback: ServiceCallback): void; + listByDepartmentNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the usage details based on departmentId for a scope by billing period. + * Usage details are available via this API only for May 1, 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listForBillingPeriodByDepartmentNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details based on departmentId for a scope by billing period. + * Usage details are available via this API only for May 1, 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listForBillingPeriodByDepartmentNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listForBillingPeriodByDepartmentNext(nextPageLink: string, callback: ServiceCallback): void; + listForBillingPeriodByDepartmentNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the usage details by enrollmentAccountId for a scope by current + * billing period. Usage details are available via this API only for May 1, + * 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByEnrollmentAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details by enrollmentAccountId for a scope by current + * billing period. Usage details are available via this API only for May 1, + * 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByEnrollmentAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByEnrollmentAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByEnrollmentAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listForBillingPeriodByEnrollmentAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {UsageDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listForBillingPeriodByEnrollmentAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listForBillingPeriodByEnrollmentAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listForBillingPeriodByEnrollmentAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + /** * @class * Forecasts diff --git a/lib/services/consumptionManagement/lib/operations/index.js b/lib/services/consumptionManagement/lib/operations/index.js index eb32309a35..483623b162 100644 --- a/lib/services/consumptionManagement/lib/operations/index.js +++ b/lib/services/consumptionManagement/lib/operations/index.js @@ -14,5 +14,7 @@ 'use strict'; +exports.PriceSheet = require('./priceSheet'); +exports.UsageDetails = require('./usageDetails'); exports.Forecasts = require('./forecasts'); exports.Operations = require('./operations'); diff --git a/lib/services/consumptionManagement/lib/operations/usageDetails.js b/lib/services/consumptionManagement/lib/operations/usageDetails.js index d77448f597..ee8056bbad 100644 --- a/lib/services/consumptionManagement/lib/operations/usageDetails.js +++ b/lib/services/consumptionManagement/lib/operations/usageDetails.js @@ -453,14 +453,40 @@ function _listByBillingPeriod(billingPeriodName, options, callback) { } /** - * Lists the usage details for a scope by current billing period. Usage details - * are available via this API only for May 1, 2014 or later. + * Lists the usage details by billingAccountId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} billingAccountId BillingAccount ID * * @param {object} [options] Optional Parameters. * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -478,7 +504,7 @@ function _listByBillingPeriod(billingPeriodName, options, callback) { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _listNext(nextPageLink, options, callback) { +function _listByBillingAccount(billingAccountId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -488,10 +514,40 @@ function _listNext(nextPageLink, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let skiptoken = (options && options.skiptoken !== undefined) ? options.skiptoken : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let queryOptions = (options && options.queryOptions !== undefined) ? options.queryOptions : undefined; // Validate try { - if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { - throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + if (billingAccountId === null || billingAccountId === undefined || typeof billingAccountId.valueOf() !== 'string') { + throw new Error('billingAccountId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (skiptoken !== null && skiptoken !== undefined && typeof skiptoken.valueOf() !== 'string') { + throw new Error('skiptoken must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (top !== null && top !== undefined) { + if (top > 1000) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMaximum": 1000'); + } + if (top < 1) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); @@ -499,10 +555,43 @@ function _listNext(nextPageLink, options, callback) { } catch (error) { return callback(error); } + let apply; + try { + if (queryOptions !== null && queryOptions !== undefined) + { + apply = queryOptions.apply; + if (apply !== null && apply !== undefined && typeof apply.valueOf() !== 'string') { + throw new Error('apply must be of type string.'); + } + } + } catch (error) { + return callback(error); + } // Construct URL - let requestUrl = '{nextLink}'; - requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/usageDetails'; + requestUrl = requestUrl.replace('{billingAccountId}', encodeURIComponent(billingAccountId)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (skiptoken !== null && skiptoken !== undefined) { + queryParameters.push('$skiptoken=' + encodeURIComponent(skiptoken)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (apply !== null && apply !== undefined) { + queryParameters.push('$apply=' + encodeURIComponent(apply)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } // Create HTTP transport objects let httpRequest = new WebResource(); @@ -583,14 +672,42 @@ function _listNext(nextPageLink, options, callback) { } /** - * Lists the usage details for a scope by billing period. Usage details are - * available via this API only for May 1, 2014 or later. + * Lists the usage details based on billingAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} billingAccountId BillingAccount ID + * + * @param {string} billingPeriodName Billing Period Name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -608,7 +725,7 @@ function _listNext(nextPageLink, options, callback) { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _listByBillingPeriodNext(nextPageLink, options, callback) { +function _listForBillingPeriodByBillingAccount(billingAccountId, billingPeriodName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -618,10 +735,43 @@ function _listByBillingPeriodNext(nextPageLink, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let skiptoken = (options && options.skiptoken !== undefined) ? options.skiptoken : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let queryOptions = (options && options.queryOptions !== undefined) ? options.queryOptions : undefined; // Validate try { - if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { - throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + if (billingAccountId === null || billingAccountId === undefined || typeof billingAccountId.valueOf() !== 'string') { + throw new Error('billingAccountId cannot be null or undefined and it must be of type string.'); + } + if (billingPeriodName === null || billingPeriodName === undefined || typeof billingPeriodName.valueOf() !== 'string') { + throw new Error('billingPeriodName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (skiptoken !== null && skiptoken !== undefined && typeof skiptoken.valueOf() !== 'string') { + throw new Error('skiptoken must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (top !== null && top !== undefined) { + if (top > 1000) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMaximum": 1000'); + } + if (top < 1) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); @@ -629,10 +779,44 @@ function _listByBillingPeriodNext(nextPageLink, options, callback) { } catch (error) { return callback(error); } + let apply; + try { + if (queryOptions !== null && queryOptions !== undefined) + { + apply = queryOptions.apply; + if (apply !== null && apply !== undefined && typeof apply.valueOf() !== 'string') { + throw new Error('apply must be of type string.'); + } + } + } catch (error) { + return callback(error); + } // Construct URL - let requestUrl = '{nextLink}'; - requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails'; + requestUrl = requestUrl.replace('{billingAccountId}', encodeURIComponent(billingAccountId)); + requestUrl = requestUrl.replace('{billingPeriodName}', encodeURIComponent(billingPeriodName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (skiptoken !== null && skiptoken !== undefined) { + queryParameters.push('$skiptoken=' + encodeURIComponent(skiptoken)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (apply !== null && apply !== undefined) { + queryParameters.push('$apply=' + encodeURIComponent(apply)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } // Create HTTP transport objects let httpRequest = new WebResource(); @@ -712,51 +896,3350 @@ function _listByBillingPeriodNext(nextPageLink, options, callback) { }); } -/** Class representing a UsageDetails. */ -class UsageDetails { - /** - * Create a UsageDetails. - * @param {ConsumptionManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._list = _list; - this._listByBillingPeriod = _listByBillingPeriod; - this._listNext = _listNext; - this._listByBillingPeriodNext = _listByBillingPeriodNext; +/** + * Lists the usage details by departmentId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} departmentId Department ID + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByDepartment(departmentId, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let skiptoken = (options && options.skiptoken !== undefined) ? options.skiptoken : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let queryOptions = (options && options.queryOptions !== undefined) ? options.queryOptions : undefined; + // Validate + try { + if (departmentId === null || departmentId === undefined || typeof departmentId.valueOf() !== 'string') { + throw new Error('departmentId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (skiptoken !== null && skiptoken !== undefined && typeof skiptoken.valueOf() !== 'string') { + throw new Error('skiptoken must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (top !== null && top !== undefined) { + if (top > 1000) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMaximum": 1000'); + } + if (top < 1) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let apply; + try { + if (queryOptions !== null && queryOptions !== undefined) + { + apply = queryOptions.apply; + if (apply !== null && apply !== undefined && typeof apply.valueOf() !== 'string') { + throw new Error('apply must be of type string.'); + } + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Consumption/usageDetails'; + requestUrl = requestUrl.replace('{departmentId}', encodeURIComponent(departmentId)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (skiptoken !== null && skiptoken !== undefined) { + queryParameters.push('$skiptoken=' + encodeURIComponent(skiptoken)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (apply !== null && apply !== undefined) { + queryParameters.push('$apply=' + encodeURIComponent(apply)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsageDetailsListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the usage details based on departmentId for a scope by billing period. + * Usage details are available via this API only for May 1, 2014 or later. + * + * @param {string} departmentId Department ID + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listForBillingPeriodByDepartment(departmentId, billingPeriodName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let skiptoken = (options && options.skiptoken !== undefined) ? options.skiptoken : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let queryOptions = (options && options.queryOptions !== undefined) ? options.queryOptions : undefined; + // Validate + try { + if (departmentId === null || departmentId === undefined || typeof departmentId.valueOf() !== 'string') { + throw new Error('departmentId cannot be null or undefined and it must be of type string.'); + } + if (billingPeriodName === null || billingPeriodName === undefined || typeof billingPeriodName.valueOf() !== 'string') { + throw new Error('billingPeriodName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (skiptoken !== null && skiptoken !== undefined && typeof skiptoken.valueOf() !== 'string') { + throw new Error('skiptoken must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (top !== null && top !== undefined) { + if (top > 1000) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMaximum": 1000'); + } + if (top < 1) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let apply; + try { + if (queryOptions !== null && queryOptions !== undefined) + { + apply = queryOptions.apply; + if (apply !== null && apply !== undefined && typeof apply.valueOf() !== 'string') { + throw new Error('apply must be of type string.'); + } + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails'; + requestUrl = requestUrl.replace('{departmentId}', encodeURIComponent(departmentId)); + requestUrl = requestUrl.replace('{billingPeriodName}', encodeURIComponent(billingPeriodName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (skiptoken !== null && skiptoken !== undefined) { + queryParameters.push('$skiptoken=' + encodeURIComponent(skiptoken)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (apply !== null && apply !== undefined) { + queryParameters.push('$apply=' + encodeURIComponent(apply)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsageDetailsListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the usage details by enrollmentAccountId for a scope by current + * billing period. Usage details are available via this API only for May 1, + * 2014 or later. + * + * @param {string} enrollmentAccountId EnrollmentAccount ID + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByEnrollmentAccount(enrollmentAccountId, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let skiptoken = (options && options.skiptoken !== undefined) ? options.skiptoken : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let queryOptions = (options && options.queryOptions !== undefined) ? options.queryOptions : undefined; + // Validate + try { + if (enrollmentAccountId === null || enrollmentAccountId === undefined || typeof enrollmentAccountId.valueOf() !== 'string') { + throw new Error('enrollmentAccountId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (skiptoken !== null && skiptoken !== undefined && typeof skiptoken.valueOf() !== 'string') { + throw new Error('skiptoken must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (top !== null && top !== undefined) { + if (top > 1000) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMaximum": 1000'); + } + if (top < 1) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let apply; + try { + if (queryOptions !== null && queryOptions !== undefined) + { + apply = queryOptions.apply; + if (apply !== null && apply !== undefined && typeof apply.valueOf() !== 'string') { + throw new Error('apply must be of type string.'); + } + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Consumption/usageDetails'; + requestUrl = requestUrl.replace('{enrollmentAccountId}', encodeURIComponent(enrollmentAccountId)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (skiptoken !== null && skiptoken !== undefined) { + queryParameters.push('$skiptoken=' + encodeURIComponent(skiptoken)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (apply !== null && apply !== undefined) { + queryParameters.push('$apply=' + encodeURIComponent(apply)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsageDetailsListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the usage details based on enrollmentAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} enrollmentAccountId EnrollmentAccount ID + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listForBillingPeriodByEnrollmentAccount(enrollmentAccountId, billingPeriodName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expand = (options && options.expand !== undefined) ? options.expand : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let skiptoken = (options && options.skiptoken !== undefined) ? options.skiptoken : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let queryOptions = (options && options.queryOptions !== undefined) ? options.queryOptions : undefined; + // Validate + try { + if (enrollmentAccountId === null || enrollmentAccountId === undefined || typeof enrollmentAccountId.valueOf() !== 'string') { + throw new Error('enrollmentAccountId cannot be null or undefined and it must be of type string.'); + } + if (billingPeriodName === null || billingPeriodName === undefined || typeof billingPeriodName.valueOf() !== 'string') { + throw new Error('billingPeriodName cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (skiptoken !== null && skiptoken !== undefined && typeof skiptoken.valueOf() !== 'string') { + throw new Error('skiptoken must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (top !== null && top !== undefined) { + if (top > 1000) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMaximum": 1000'); + } + if (top < 1) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + let apply; + try { + if (queryOptions !== null && queryOptions !== undefined) + { + apply = queryOptions.apply; + if (apply !== null && apply !== undefined && typeof apply.valueOf() !== 'string') { + throw new Error('apply must be of type string.'); + } + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails'; + requestUrl = requestUrl.replace('{enrollmentAccountId}', encodeURIComponent(enrollmentAccountId)); + requestUrl = requestUrl.replace('{billingPeriodName}', encodeURIComponent(billingPeriodName)); + let queryParameters = []; + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (skiptoken !== null && skiptoken !== undefined) { + queryParameters.push('$skiptoken=' + encodeURIComponent(skiptoken)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (apply !== null && apply !== undefined) { + queryParameters.push('$apply=' + encodeURIComponent(apply)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsageDetailsListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the usage details for a scope by current billing period. Usage details + * are available via this API only for May 1, 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsageDetailsListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the usage details for a scope by billing period. Usage details are + * available via this API only for May 1, 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByBillingPeriodNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsageDetailsListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the usage details by billingAccountId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByBillingAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsageDetailsListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the usage details based on billingAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listForBillingPeriodByBillingAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsageDetailsListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the usage details by departmentId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByDepartmentNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsageDetailsListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the usage details based on departmentId for a scope by billing period. + * Usage details are available via this API only for May 1, 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listForBillingPeriodByDepartmentNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsageDetailsListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the usage details by enrollmentAccountId for a scope by current + * billing period. Usage details are available via this API only for May 1, + * 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByEnrollmentAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsageDetailsListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the usage details based on enrollmentAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listForBillingPeriodByEnrollmentAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsageDetailsListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a UsageDetails. */ +class UsageDetails { + /** + * Create a UsageDetails. + * @param {ConsumptionManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listByBillingPeriod = _listByBillingPeriod; + this._listByBillingAccount = _listByBillingAccount; + this._listForBillingPeriodByBillingAccount = _listForBillingPeriodByBillingAccount; + this._listByDepartment = _listByDepartment; + this._listForBillingPeriodByDepartment = _listForBillingPeriodByDepartment; + this._listByEnrollmentAccount = _listByEnrollmentAccount; + this._listForBillingPeriodByEnrollmentAccount = _listForBillingPeriodByEnrollmentAccount; + this._listNext = _listNext; + this._listByBillingPeriodNext = _listByBillingPeriodNext; + this._listByBillingAccountNext = _listByBillingAccountNext; + this._listForBillingPeriodByBillingAccountNext = _listForBillingPeriodByBillingAccountNext; + this._listByDepartmentNext = _listByDepartmentNext; + this._listForBillingPeriodByDepartmentNext = _listForBillingPeriodByDepartmentNext; + this._listByEnrollmentAccountNext = _listByEnrollmentAccountNext; + this._listForBillingPeriodByEnrollmentAccountNext = _listForBillingPeriodByEnrollmentAccountNext; + } + + /** + * Lists the usage details for a scope by current billing period. Usage details + * are available via this API only for May 1, 2014 or later. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the usage details for a scope by current billing period. Usage details + * are available via this API only for May 1, 2014 or later. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Lists the usage details for a scope by billing period. Usage details are + * available via this API only for May 1, 2014 or later. + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByBillingPeriodWithHttpOperationResponse(billingPeriodName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByBillingPeriod(billingPeriodName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are + * available via this API only for May 1, 2014 or later. + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByBillingPeriod(billingPeriodName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByBillingPeriod(billingPeriodName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByBillingPeriod(billingPeriodName, options, optionalCallback); + } + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} billingAccountId BillingAccount ID + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByBillingAccountWithHttpOperationResponse(billingAccountId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByBillingAccount(billingAccountId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} billingAccountId BillingAccount ID + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByBillingAccount(billingAccountId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByBillingAccount(billingAccountId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByBillingAccount(billingAccountId, options, optionalCallback); + } + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} billingAccountId BillingAccount ID + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listForBillingPeriodByBillingAccountWithHttpOperationResponse(billingAccountId, billingPeriodName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listForBillingPeriodByBillingAccount(billingAccountId, billingPeriodName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} billingAccountId BillingAccount ID + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listForBillingPeriodByBillingAccount(billingAccountId, billingPeriodName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listForBillingPeriodByBillingAccount(billingAccountId, billingPeriodName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listForBillingPeriodByBillingAccount(billingAccountId, billingPeriodName, options, optionalCallback); + } + } + + /** + * Lists the usage details by departmentId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} departmentId Department ID + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByDepartmentWithHttpOperationResponse(departmentId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDepartment(departmentId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the usage details by departmentId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} departmentId Department ID + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByDepartment(departmentId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByDepartment(departmentId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDepartment(departmentId, options, optionalCallback); + } + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. + * Usage details are available via this API only for May 1, 2014 or later. + * + * @param {string} departmentId Department ID + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listForBillingPeriodByDepartmentWithHttpOperationResponse(departmentId, billingPeriodName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listForBillingPeriodByDepartment(departmentId, billingPeriodName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. + * Usage details are available via this API only for May 1, 2014 or later. + * + * @param {string} departmentId Department ID + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listForBillingPeriodByDepartment(departmentId, billingPeriodName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listForBillingPeriodByDepartment(departmentId, billingPeriodName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listForBillingPeriodByDepartment(departmentId, billingPeriodName, options, optionalCallback); + } + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current + * billing period. Usage details are available via this API only for May 1, + * 2014 or later. + * + * @param {string} enrollmentAccountId EnrollmentAccount ID + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByEnrollmentAccountWithHttpOperationResponse(enrollmentAccountId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByEnrollmentAccount(enrollmentAccountId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current + * billing period. Usage details are available via this API only for May 1, + * 2014 or later. + * + * @param {string} enrollmentAccountId EnrollmentAccount ID + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName, properties/instanceId or + * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does + * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByEnrollmentAccount(enrollmentAccountId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByEnrollmentAccount(enrollmentAccountId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByEnrollmentAccount(enrollmentAccountId, options, optionalCallback); + } + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} enrollmentAccountId EnrollmentAccount ID + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listForBillingPeriodByEnrollmentAccountWithHttpOperationResponse(enrollmentAccountId, billingPeriodName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listForBillingPeriodByEnrollmentAccount(enrollmentAccountId, billingPeriodName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} enrollmentAccountId EnrollmentAccount ID + * + * @param {string} billingPeriodName Billing Period Name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] May be used to expand the + * properties/additionalProperties or properties/meterDetails within a list of + * usage details. By default, these fields are not included when listing usage + * details. + * + * @param {string} [options.filter] May be used to filter usageDetails by + * properties/usageEnd (Utc time), properties/usageStart (Utc time), + * properties/resourceGroup, properties/instanceName or properties/instanceId. + * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not + * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair + * string where key and value is separated by a colon (:). + * + * @param {string} [options.skiptoken] Skiptoken is only used if a previous + * operation returned a partial result. If a previous response contains a + * nextLink element, the value of the nextLink element will include a skiptoken + * parameter that specifies a starting point to use for subsequent calls. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N usageDetails. + * + * @param {object} [options.queryOptions] Additional parameters for the + * operation + * + * @param {string} [options.queryOptions.apply] OData apply expression to + * aggregate usageDetails by tags or (tags and properties/usageStart) + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listForBillingPeriodByEnrollmentAccount(enrollmentAccountId, billingPeriodName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listForBillingPeriodByEnrollmentAccount(enrollmentAccountId, billingPeriodName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listForBillingPeriodByEnrollmentAccount(enrollmentAccountId, billingPeriodName, options, optionalCallback); + } + } + + /** + * Lists the usage details for a scope by current billing period. Usage details + * are available via this API only for May 1, 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the usage details for a scope by current billing period. Usage details + * are available via this API only for May 1, 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Lists the usage details for a scope by billing period. Usage details are + * available via this API only for May 1, 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByBillingPeriodNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByBillingPeriodNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are + * available via this API only for May 1, 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {UsageDetailsListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByBillingPeriodNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByBillingPeriodNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByBillingPeriodNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByBillingAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByBillingAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); } /** - * Lists the usage details for a scope by current billing period. Usage details - * are available via this API only for May 1, 2014 or later. + * Lists the usage details by billingAccountId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.expand] May be used to expand the - * properties/additionalProperties or properties/meterDetails within a list of - * usage details. By default, these fields are not included when listing usage - * details. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [options.filter] May be used to filter usageDetails by - * properties/usageEnd (Utc time), properties/usageStart (Utc time), - * properties/resourceGroup, properties/instanceName, properties/instanceId or - * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does - * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair - * string where key and value is separated by a colon (:). + * @param {function} [optionalCallback] - The optional callback. * - * @param {string} [options.skiptoken] Skiptoken is only used if a previous - * operation returned a partial result. If a previous response contains a - * nextLink element, the value of the nextLink element will include a skiptoken - * parameter that specifies a starting point to use for subsequent calls. + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. * - * @param {number} [options.top] May be used to limit the number of results to - * the most recent N usageDetails. + * {Promise} A promise is returned * - * @param {object} [options.queryOptions] Additional parameters for the - * operation + * @resolve {UsageDetailsListResult} - The deserialized result object. * - * @param {string} [options.queryOptions.apply] OData apply expression to - * aggregate usageDetails by tags or (tags and properties/usageStart) + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByBillingAccountNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByBillingAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByBillingAccountNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -767,11 +4250,11 @@ class UsageDetails { * * @reject {Error} - The error object. */ - listWithHttpOperationResponse(options) { + listForBillingPeriodByBillingAccountNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { + self._listForBillingPeriodByBillingAccountNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -782,36 +4265,14 @@ class UsageDetails { } /** - * Lists the usage details for a scope by current billing period. Usage details - * are available via this API only for May 1, 2014 or later. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.expand] May be used to expand the - * properties/additionalProperties or properties/meterDetails within a list of - * usage details. By default, these fields are not included when listing usage - * details. + * Lists the usage details based on billingAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. * - * @param {string} [options.filter] May be used to filter usageDetails by - * properties/usageEnd (Utc time), properties/usageStart (Utc time), - * properties/resourceGroup, properties/instanceName, properties/instanceId or - * tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does - * not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair - * string where key and value is separated by a colon (:). - * - * @param {string} [options.skiptoken] Skiptoken is only used if a previous - * operation returned a partial result. If a previous response contains a - * nextLink element, the value of the nextLink element will include a skiptoken - * parameter that specifies a starting point to use for subsequent calls. - * - * @param {number} [options.top] May be used to limit the number of results to - * the most recent N usageDetails. - * - * @param {object} [options.queryOptions] Additional parameters for the - * operation + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * - * @param {string} [options.queryOptions.apply] OData apply expression to - * aggregate usageDetails by tags or (tags and properties/usageStart) + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -839,7 +4300,7 @@ class UsageDetails { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - list(options, optionalCallback) { + listForBillingPeriodByBillingAccountNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -848,51 +4309,27 @@ class UsageDetails { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { + self._listForBillingPeriodByBillingAccountNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._list(options, optionalCallback); + return self._listForBillingPeriodByBillingAccountNext(nextPageLink, options, optionalCallback); } } /** - * Lists the usage details for a scope by billing period. Usage details are - * available via this API only for May 1, 2014 or later. + * Lists the usage details by departmentId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. * - * @param {string} billingPeriodName Billing Period Name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.expand] May be used to expand the - * properties/additionalProperties or properties/meterDetails within a list of - * usage details. By default, these fields are not included when listing usage - * details. - * - * @param {string} [options.filter] May be used to filter usageDetails by - * properties/usageEnd (Utc time), properties/usageStart (Utc time), - * properties/resourceGroup, properties/instanceName or properties/instanceId. - * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not - * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair - * string where key and value is separated by a colon (:). - * - * @param {string} [options.skiptoken] Skiptoken is only used if a previous - * operation returned a partial result. If a previous response contains a - * nextLink element, the value of the nextLink element will include a skiptoken - * parameter that specifies a starting point to use for subsequent calls. - * - * @param {number} [options.top] May be used to limit the number of results to - * the most recent N usageDetails. - * - * @param {object} [options.queryOptions] Additional parameters for the - * operation - * - * @param {string} [options.queryOptions.apply] OData apply expression to - * aggregate usageDetails by tags or (tags and properties/usageStart) - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -902,11 +4339,11 @@ class UsageDetails { * * @reject {Error} - The error object. */ - listByBillingPeriodWithHttpOperationResponse(billingPeriodName, options) { + listByDepartmentNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listByBillingPeriod(billingPeriodName, options, (err, result, request, response) => { + self._listByDepartmentNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -917,38 +4354,101 @@ class UsageDetails { } /** - * Lists the usage details for a scope by billing period. Usage details are - * available via this API only for May 1, 2014 or later. + * Lists the usage details by departmentId for a scope by current billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. * - * @param {string} billingPeriodName Billing Period Name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.expand] May be used to expand the - * properties/additionalProperties or properties/meterDetails within a list of - * usage details. By default, these fields are not included when listing usage - * details. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [options.filter] May be used to filter usageDetails by - * properties/usageEnd (Utc time), properties/usageStart (Utc time), - * properties/resourceGroup, properties/instanceName or properties/instanceId. - * The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not - * currently support 'ne', 'or', or 'not'. Tag filter is a key value pair - * string where key and value is separated by a colon (:). + * @param {function} [optionalCallback] - The optional callback. * - * @param {string} [options.skiptoken] Skiptoken is only used if a previous - * operation returned a partial result. If a previous response contains a - * nextLink element, the value of the nextLink element will include a skiptoken - * parameter that specifies a starting point to use for subsequent calls. + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. * - * @param {number} [options.top] May be used to limit the number of results to - * the most recent N usageDetails. + * {Promise} A promise is returned * - * @param {object} [options.queryOptions] Additional parameters for the - * operation + * @resolve {UsageDetailsListResult} - The deserialized result object. * - * @param {string} [options.queryOptions.apply] OData apply expression to - * aggregate usageDetails by tags or (tags and properties/usageStart) + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsageDetailsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByDepartmentNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByDepartmentNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDepartmentNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. + * Usage details are available via this API only for May 1, 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listForBillingPeriodByDepartmentNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listForBillingPeriodByDepartmentNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. + * Usage details are available via this API only for May 1, 2014 or later. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -976,7 +4476,7 @@ class UsageDetails { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listByBillingPeriod(billingPeriodName, options, optionalCallback) { + listForBillingPeriodByDepartmentNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -985,20 +4485,21 @@ class UsageDetails { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listByBillingPeriod(billingPeriodName, options, (err, result, request, response) => { + self._listForBillingPeriodByDepartmentNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listByBillingPeriod(billingPeriodName, options, optionalCallback); + return self._listForBillingPeriodByDepartmentNext(nextPageLink, options, optionalCallback); } } /** - * Lists the usage details for a scope by current billing period. Usage details - * are available via this API only for May 1, 2014 or later. + * Lists the usage details by enrollmentAccountId for a scope by current + * billing period. Usage details are available via this API only for May 1, + * 2014 or later. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1014,11 +4515,11 @@ class UsageDetails { * * @reject {Error} - The error object. */ - listNextWithHttpOperationResponse(nextPageLink, options) { + listByEnrollmentAccountNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listNext(nextPageLink, options, (err, result, request, response) => { + self._listByEnrollmentAccountNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1029,8 +4530,9 @@ class UsageDetails { } /** - * Lists the usage details for a scope by current billing period. Usage details - * are available via this API only for May 1, 2014 or later. + * Lists the usage details by enrollmentAccountId for a scope by current + * billing period. Usage details are available via this API only for May 1, + * 2014 or later. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1063,7 +4565,7 @@ class UsageDetails { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listNext(nextPageLink, options, optionalCallback) { + listByEnrollmentAccountNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1072,20 +4574,21 @@ class UsageDetails { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listNext(nextPageLink, options, (err, result, request, response) => { + self._listByEnrollmentAccountNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listNext(nextPageLink, options, optionalCallback); + return self._listByEnrollmentAccountNext(nextPageLink, options, optionalCallback); } } /** - * Lists the usage details for a scope by billing period. Usage details are - * available via this API only for May 1, 2014 or later. + * Lists the usage details based on enrollmentAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1101,11 +4604,11 @@ class UsageDetails { * * @reject {Error} - The error object. */ - listByBillingPeriodNextWithHttpOperationResponse(nextPageLink, options) { + listForBillingPeriodByEnrollmentAccountNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listByBillingPeriodNext(nextPageLink, options, (err, result, request, response) => { + self._listForBillingPeriodByEnrollmentAccountNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1116,8 +4619,9 @@ class UsageDetails { } /** - * Lists the usage details for a scope by billing period. Usage details are - * available via this API only for May 1, 2014 or later. + * Lists the usage details based on enrollmentAccountId for a scope by billing + * period. Usage details are available via this API only for May 1, 2014 or + * later. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1150,7 +4654,7 @@ class UsageDetails { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listByBillingPeriodNext(nextPageLink, options, optionalCallback) { + listForBillingPeriodByEnrollmentAccountNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1159,14 +4663,14 @@ class UsageDetails { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listByBillingPeriodNext(nextPageLink, options, (err, result, request, response) => { + self._listForBillingPeriodByEnrollmentAccountNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listByBillingPeriodNext(nextPageLink, options, optionalCallback); + return self._listForBillingPeriodByEnrollmentAccountNext(nextPageLink, options, optionalCallback); } }