From 62f11c4dd1f44f724261d7b13c75740d8076c312 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 12 Jul 2018 14:00:20 -0700 Subject: [PATCH] [AutoPR consumption/resource-manager] Adding new properties to Consumption Usage Details (#3120) * Generated from 4394e3bd84d0e9012dd1acac36ce2a82fd02edd6 Merge branch 'master' of https://github.com/Azure/azure-rest-api-specs * Generated from 8d551a2fd9eb30b4c6b9f38b30924f06fed0b02c Merge branch 'master' of https://github.com/Azure/azure-rest-api-specs * Generated from bac7ebe031f40801bd2aca9a368dd9eeaeaa7509 Merge branch 'master' of https://github.com/Azure/azure-rest-api-specs * Generated from 891beecde5b53a8b2fc5a700670df861cc80b1f0 Modified the Operation Id to follow the best practices. * Generated from b9b62fdf3ee427a1f2c1b71293cc422eedbdbd63 Fixed model namings for - ReservationSummaries (now: ReservationSummary), ReservationDetails (now: ReservationDetail) and ReservationRecommendations (now: ReservationRecommendation) * Generated from 5d36df6e4f6b3ddde06f975bfa42fa095a5ad29e Fixed the naming for model CostTags. * Generated from c5a8c67ddd9601adc30c1a968a85629fbe79ccdf Fixing the SDKViolation error on - model Tags. * Generated from b28e418996a4b847984d198b4c0ccbd003466d0a Changed the CostTagResult to CostTag as per review comments. Also changed operations - Marketplaces_ListByEnrollmentAccount and Marketplaces_ListForBillingPeriodByEnrollmentAccount. --- lib/services/consumptionManagement/README.md | 6 +- .../lib/consumptionManagementClient.d.ts | 10 +- .../lib/consumptionManagementClient.js | 12 +- .../lib/models/costTag.js | 53 +- .../lib/models/costTagProperties.js | 52 + .../lib/models/costTagsResult.js | 95 + .../lib/models/index.d.ts | 846 ++++- .../consumptionManagement/lib/models/index.js | 35 +- .../lib/models/meterDetails.js | 18 + .../lib/models/priceSheetProperties.js | 2 + .../lib/models/reservationDetail.js | 171 + .../models/reservationDetailsListResult.js | 4 +- .../lib/models/reservationRecommendation.js | 191 + .../reservationRecommendationsListResult.js | 4 +- .../models/reservationSummariesListResult.js | 4 +- .../lib/models/reservationSummary.js | 186 + .../lib/models/tagsResult.js | 95 + .../lib/models/usageDetail.js | 11 + .../lib/operations/balances.js | 483 +++ .../lib/operations/costTags.js | 537 +++ .../lib/operations/index.d.ts | 3283 +++++++++++++++- .../lib/operations/index.js | 10 +- .../lib/operations/marketplaces.js | 3368 ++++++++++++++++- .../operations/reservationRecommendations.js | 478 +++ .../lib/operations/tags.js | 248 ++ 25 files changed, 9748 insertions(+), 454 deletions(-) create mode 100644 lib/services/consumptionManagement/lib/models/costTagProperties.js create mode 100644 lib/services/consumptionManagement/lib/models/costTagsResult.js create mode 100644 lib/services/consumptionManagement/lib/models/reservationDetail.js create mode 100644 lib/services/consumptionManagement/lib/models/reservationRecommendation.js create mode 100644 lib/services/consumptionManagement/lib/models/reservationSummary.js create mode 100644 lib/services/consumptionManagement/lib/models/tagsResult.js create mode 100644 lib/services/consumptionManagement/lib/operations/balances.js create mode 100644 lib/services/consumptionManagement/lib/operations/costTags.js create mode 100644 lib/services/consumptionManagement/lib/operations/reservationRecommendations.js create mode 100644 lib/services/consumptionManagement/lib/operations/tags.js diff --git a/lib/services/consumptionManagement/README.md b/lib/services/consumptionManagement/README.md index 07b41f3f8c..fa6d0fd678 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 get priceSheet as an example. +### Authentication, client creation and list usageDetails as an example. ```javascript const msRestAzure = require("ms-rest-azure"); @@ -27,9 +27,11 @@ msRestAzure.interactiveLogin().then((creds) => { const subscriptionId = ""; const client = new ConsumptionManagementClient(creds, subscriptionId); const expand = "testexpand"; + const filter = "testfilter"; const skiptoken = "testskiptoken"; const top = 1; - return client.priceSheet.get(expand, skiptoken, top).then((result) => { + const apply = "testapply"; + return client.usageDetails.list(expand, filter, skiptoken, top, apply).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 bbbcb3e035..8642178873 100644 --- a/lib/services/consumptionManagement/lib/consumptionManagementClient.d.ts +++ b/lib/services/consumptionManagement/lib/consumptionManagementClient.d.ts @@ -56,8 +56,16 @@ export default class ConsumptionManagementClient extends AzureServiceClient { generateClientRequestId: boolean; // Operation groups - priceSheet: operations.PriceSheet; usageDetails: operations.UsageDetails; + marketplaces: operations.Marketplaces; + balances: operations.Balances; + reservationsSummaries: operations.ReservationsSummaries; + reservationsDetails: operations.ReservationsDetails; + reservationRecommendations: operations.ReservationRecommendations; + budgets: operations.Budgets; + priceSheet: operations.PriceSheet; + costTags: operations.CostTags; + tags: operations.Tags; forecasts: operations.Forecasts; operations: operations.Operations; } diff --git a/lib/services/consumptionManagement/lib/consumptionManagementClient.js b/lib/services/consumptionManagement/lib/consumptionManagementClient.js index 10be56690e..43f58b515b 100644 --- a/lib/services/consumptionManagement/lib/consumptionManagementClient.js +++ b/lib/services/consumptionManagement/lib/consumptionManagementClient.js @@ -50,7 +50,7 @@ class ConsumptionManagementClient extends ServiceClient { super(credentials, options); - this.apiVersion = '2018-05-31'; + this.apiVersion = '2018-06-30'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -72,8 +72,16 @@ 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.marketplaces = new operations.Marketplaces(this); + this.balances = new operations.Balances(this); + this.reservationsSummaries = new operations.ReservationsSummaries(this); + this.reservationsDetails = new operations.ReservationsDetails(this); + this.reservationRecommendations = new operations.ReservationRecommendations(this); + this.budgets = new operations.Budgets(this); + this.priceSheet = new operations.PriceSheet(this); + this.costTags = new operations.CostTags(this); + this.tags = new operations.Tags(this); this.forecasts = new operations.Forecasts(this); this.operations = new operations.Operations(this); this.models = models; diff --git a/lib/services/consumptionManagement/lib/models/costTag.js b/lib/services/consumptionManagement/lib/models/costTag.js index 29a8e275c7..f2b59005de 100644 --- a/lib/services/consumptionManagement/lib/models/costTag.js +++ b/lib/services/consumptionManagement/lib/models/costTag.js @@ -10,16 +10,20 @@ 'use strict'; +const models = require('./index'); + /** - * The cost tag. + * A cost tag resource. * + * @extends models['ProxyResource'] */ -class CostTag { +class CostTag extends models['ProxyResource'] { /** * Create a CostTag. - * @member {string} [key] Cost tag key. + * @member {array} [costTags] Cost tags. */ constructor() { + super(); } /** @@ -36,12 +40,51 @@ class CostTag { name: 'Composite', className: 'CostTag', modelProperties: { - key: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + eTag: { required: false, - serializedName: 'key', + serializedName: 'eTag', type: { name: 'String' } + }, + costTags: { + required: false, + serializedName: 'properties.costTags', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CostTagPropertiesElementType', + type: { + name: 'Composite', + className: 'CostTagProperties' + } + } + } } } } diff --git a/lib/services/consumptionManagement/lib/models/costTagProperties.js b/lib/services/consumptionManagement/lib/models/costTagProperties.js new file mode 100644 index 0000000000..62b16f4d3b --- /dev/null +++ b/lib/services/consumptionManagement/lib/models/costTagProperties.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The properties of the cost tag. + * + */ +class CostTagProperties { + /** + * Create a CostTagProperties. + * @member {string} [key] Cost tag key. + */ + constructor() { + } + + /** + * Defines the metadata of CostTagProperties + * + * @returns {object} metadata of CostTagProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'CostTagProperties', + type: { + name: 'Composite', + className: 'CostTagProperties', + modelProperties: { + key: { + required: false, + serializedName: 'key', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CostTagProperties; diff --git a/lib/services/consumptionManagement/lib/models/costTagsResult.js b/lib/services/consumptionManagement/lib/models/costTagsResult.js new file mode 100644 index 0000000000..ca2cdf5a46 --- /dev/null +++ b/lib/services/consumptionManagement/lib/models/costTagsResult.js @@ -0,0 +1,95 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A cost tag resource. + * + * @extends models['ProxyResource'] + */ +class CostTagsResult extends models['ProxyResource'] { + /** + * Create a CostTagsResult. + * @member {array} [costTags] Cost tags. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of CostTagsResult + * + * @returns {object} metadata of CostTagsResult + * + */ + mapper() { + return { + required: false, + serializedName: 'CostTagsResult', + type: { + name: 'Composite', + className: 'CostTagsResult', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + eTag: { + required: false, + serializedName: 'eTag', + type: { + name: 'String' + } + }, + costTags: { + required: false, + serializedName: 'properties.costTags', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CostTagPropertiesElementType', + type: { + name: 'Composite', + className: 'CostTagProperties' + } + } + } + } + } + } + }; + } +} + +module.exports = CostTagsResult; diff --git a/lib/services/consumptionManagement/lib/models/index.d.ts b/lib/services/consumptionManagement/lib/models/index.d.ts index 4030a06ba8..799a163e63 100644 --- a/lib/services/consumptionManagement/lib/models/index.d.ts +++ b/lib/services/consumptionManagement/lib/models/index.d.ts @@ -18,117 +18,600 @@ export { CloudError } from 'ms-rest-azure'; /** * @class - * Initializes a new instance of the ErrorDetails class. + * Initializes a new instance of the MeterDetails class. * @constructor - * The details of the error. + * The properties of the meter detail. * - * @member {string} [code] Error code. - * @member {string} [message] Error message indicating why the operation - * failed. + * @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. + * @member {string} [serviceName] The name of the service. + * @member {string} [serviceTier] The service tier. */ -export interface ErrorDetails { - readonly code?: string; - readonly message?: string; +export interface MeterDetails { + readonly meterName?: string; + readonly meterCategory?: string; + readonly meterSubCategory?: string; + readonly unit?: string; + readonly meterLocation?: string; + readonly totalIncludedQuantity?: number; + readonly pretaxStandardRate?: number; + readonly serviceName?: string; + readonly serviceTier?: string; } /** * @class - * Initializes a new instance of the ErrorResponse class. + * Initializes a new instance of the Resource class. * @constructor - * Error response indicates that the service is not able to process the - * incoming request. The reason is provided in the error message. + * The Resource model definition. + * + * @member {string} [id] Resource Id. + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + * @member {object} [tags] Resource tags. + */ +export interface Resource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; + readonly tags?: { [propertyName: string]: string }; +} + +/** + * @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 {string} [meterDetails.serviceName] The name of the service. + * @member {string} [meterDetails.serviceTier] The service tier. + * @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} [location] Resource Location + * @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 location?: string; + readonly additionalProperties?: string; +} + +/** + * @class + * Initializes a new instance of the Marketplace class. + * @constructor + * An marketplace resource. + * + * @member {string} [billingPeriodId] The id of the billing period 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 {number} [resourceRate] The marketplace resource rate. + * @member {string} [offerName] The type of offer. + * @member {string} [resourceGroup] The name of resource group. + * @member {string} [orderNumber] The order number. + * @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} [currency] The ISO currency in which the meter is charged, + * for example, USD. + * @member {number} [consumedQuantity] The quantity of usage. + * @member {string} [unitOfMeasure] The unit of measure. + * @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 {uuid} [subscriptionGuid] Subscription guid. + * @member {string} [subscriptionName] Subscription name. + * @member {string} [accountName] Account name. + * @member {string} [departmentName] Department 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} [additionalProperties] Additional details of this usage + * item. By default this is not populated, unless it's specified in $expand. + * @member {string} [publisherName] The name of publisher. + * @member {string} [planName] The name of plan. + */ +export interface Marketplace extends Resource { + readonly billingPeriodId?: string; + readonly usageStart?: Date; + readonly usageEnd?: Date; + readonly resourceRate?: number; + readonly offerName?: string; + readonly resourceGroup?: string; + readonly orderNumber?: string; + readonly instanceName?: string; + readonly instanceId?: string; + readonly currency?: string; + readonly consumedQuantity?: number; + readonly unitOfMeasure?: string; + readonly pretaxCost?: number; + readonly isEstimated?: boolean; + readonly meterId?: string; + readonly subscriptionGuid?: string; + readonly subscriptionName?: string; + readonly accountName?: string; + readonly departmentName?: string; + readonly consumedService?: string; + readonly costCenter?: string; + readonly additionalProperties?: string; + readonly publisherName?: string; + readonly planName?: string; +} + +/** + * @class + * Initializes a new instance of the BalancePropertiesNewPurchasesDetailsItem class. + * @constructor + * @member {string} [name] the name of new purchase. + * @member {number} [value] the value of new purchase. + */ +export interface BalancePropertiesNewPurchasesDetailsItem { + readonly name?: string; + readonly value?: number; +} + +/** + * @class + * Initializes a new instance of the BalancePropertiesAdjustmentDetailsItem class. + * @constructor + * @member {string} [name] the name of new adjustment. + * @member {number} [value] the value of new adjustment. + */ +export interface BalancePropertiesAdjustmentDetailsItem { + readonly name?: string; + readonly value?: number; +} + +/** + * @class + * Initializes a new instance of the Balance class. + * @constructor + * A balance resource. + * + * @member {string} [currency] The ISO currency in which the meter is charged, + * for example, USD. + * @member {number} [beginningBalance] The beginning balance for the billing + * period. + * @member {number} [endingBalance] The ending balance for the billing period + * (for open periods this will be updated daily). + * @member {number} [newPurchases] Total new purchase amount. + * @member {number} [adjustments] Total adjustment amount. + * @member {number} [utilized] Total Commitment usage. + * @member {number} [serviceOverage] Overage for Azure services. + * @member {number} [chargesBilledSeparately] Charges Billed separately. + * @member {number} [totalOverage] serviceOverage + chargesBilledSeparately. + * @member {number} [totalUsage] Azure service commitment + total Overage. + * @member {number} [azureMarketplaceServiceCharges] Total charges for Azure + * Marketplace. + * @member {string} [billingFrequency] The billing frequency. Possible values + * include: 'Month', 'Quarter', 'Year' + * @member {boolean} [priceHidden] Price is hidden or not. + * @member {array} [newPurchasesDetails] List of new purchases. + * @member {array} [adjustmentDetails] List of Adjustments (Promo credit, SIE + * credit etc.). + */ +export interface Balance extends Resource { + readonly currency?: string; + readonly beginningBalance?: number; + readonly endingBalance?: number; + readonly newPurchases?: number; + readonly adjustments?: number; + readonly utilized?: number; + readonly serviceOverage?: number; + readonly chargesBilledSeparately?: number; + readonly totalOverage?: number; + readonly totalUsage?: number; + readonly azureMarketplaceServiceCharges?: number; + billingFrequency?: string; + readonly priceHidden?: boolean; + readonly newPurchasesDetails?: BalancePropertiesNewPurchasesDetailsItem[]; + readonly adjustmentDetails?: BalancePropertiesAdjustmentDetailsItem[]; +} + +/** + * @class + * Initializes a new instance of the ReservationSummary class. + * @constructor + * reservation summary resource. + * + * @member {string} [reservationOrderId] The reservation order ID is the + * identifier for a reservation purchase. Each reservation order ID represents + * a single purchase transaction. A reservation order contains reservations. + * The reservation order specifies the VM size and region for the reservations. + * @member {string} [reservationId] The reservation ID is the identifier of a + * reservation within a reservation order. Each reservation is the grouping for + * applying the benefit scope and also specifies the number of instances to + * which the reservation benefit can be applied to. + * @member {string} [skuName] This is the ARM Sku name. It can be used to join + * with the servicetype field in additoinalinfo in usage records. + * @member {number} [reservedHours] This is the total hours reserved. E.g. if + * reservation for 1 instance was made on 1 PM, this will be 11 hours for that + * day and 24 hours from subsequent days + * @member {date} [usageDate] Data corresponding to the utilization record. If + * the grain of data is monthly, it will be first day of month. + * @member {number} [usedHours] Total used hours by the reservation + * @member {number} [minUtilizationPercentage] This is the minimum hourly + * utilization in the usage time (day or month). E.g. if usage record + * corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, + * this field will return 10% for that day + * @member {number} [avgUtilizationPercentage] This is average utilization for + * the entire time range. (day or month depending on the grain) + * @member {number} [maxUtilizationPercentage] This is the maximum hourly + * utilization in the usage time (day or month). E.g. if usage record + * corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was + * 100%, this field will return 100% for that day. + */ +export interface ReservationSummary extends Resource { + readonly reservationOrderId?: string; + readonly reservationId?: string; + readonly skuName?: string; + readonly reservedHours?: number; + readonly usageDate?: Date; + readonly usedHours?: number; + readonly minUtilizationPercentage?: number; + readonly avgUtilizationPercentage?: number; + readonly maxUtilizationPercentage?: number; +} + +/** + * @class + * Initializes a new instance of the ReservationDetail class. + * @constructor + * reservation detail resource. + * + * @member {string} [reservationOrderId] The reservation order ID is the + * identifier for a reservation purchase. Each reservation order ID represents + * a single purchase transaction. A reservation order contains reservations. + * The reservation order specifies the VM size and region for the reservations. + * @member {string} [reservationId] The reservation ID is the identifier of a + * reservation within a reservation order. Each reservation is the grouping for + * applying the benefit scope and also specifies the number of instances to + * which the reservation benefit can be applied to. + * @member {string} [skuName] This is the ARM Sku name. It can be used to join + * with the servicetype field in additoinalinfo in usage records. + * @member {number} [reservedHours] This is the total hours reserved for the + * day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 + * hours for that day and 24 hours from subsequent days. + * @member {date} [usageDate] The date on which consumption occurred. + * @member {number} [usedHours] This is the total hours used by the instance. + * @member {string} [instanceId] This identifier is the name of the resource or + * the fully qualified Resource ID. + * @member {number} [totalReservedQuantity] This is the total count of + * instances that are reserved for the reservationid. + */ +export interface ReservationDetail extends Resource { + readonly reservationOrderId?: string; + readonly reservationId?: string; + readonly skuName?: string; + readonly reservedHours?: number; + readonly usageDate?: Date; + readonly usedHours?: number; + readonly instanceId?: string; + readonly totalReservedQuantity?: number; +} + +/** + * @class + * Initializes a new instance of the ReservationRecommendation class. + * @constructor + * Reservation recommendation resource. + * + * @member {string} [id] Resource Id. + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + * @member {object} [tags] Resource tags. + * @member {string} [location] Resource location + * @member {string} [sku] Resource sku + * @member {string} [lookBackPeriod] The number of days of usage to look back + * for recommendation. + * @member {uuid} [meterId] The meter id (GUID) + * @member {string} [term] RI recommendations in one or three year terms. + * @member {number} [costWithNoReservedInstances] The total amount of cost + * without reserved instances. + * @member {number} [recommendedQuantity] Recomended quality for reserved + * instances. + * @member {number} [totalCostWithReservedInstances] The total amount of cost + * with reserved instances. + * @member {number} [netSavings] Total estimated savings with reserved + * instances. + * @member {date} [firstUsageDate] The usage date for looking back. + * @member {string} [scope] Shared or single recommendation. + */ +export interface ReservationRecommendation { + readonly id?: string; + readonly name?: string; + readonly type?: string; + readonly tags?: { [propertyName: string]: string }; + readonly location?: string; + readonly sku?: string; + readonly lookBackPeriod?: string; + readonly meterId?: string; + readonly term?: string; + readonly costWithNoReservedInstances?: number; + readonly recommendedQuantity?: number; + readonly totalCostWithReservedInstances?: number; + readonly netSavings?: number; + readonly firstUsageDate?: Date; + readonly scope?: string; +} + +/** + * @class + * Initializes a new instance of the Tag class. + * @constructor + * The tag resource. + * + * @member {string} [key] Tag key. + */ +export interface Tag { + key?: string; +} + +/** + * @class + * Initializes a new instance of the ProxyResource class. + * @constructor + * The Resource model definition. + * + * @member {string} [id] Resource Id. + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + * @member {string} [eTag] eTag of the resource. To handle concurrent update + * scenarion, this field will be used to determine whether the user is updating + * the latest version or not. + */ +export interface ProxyResource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; + eTag?: string; +} + +/** + * @class + * Initializes a new instance of the TagsResult class. + * @constructor + * A resource listing all tags. + * + * @member {array} [tags] A list of Tag. + */ +export interface TagsResult extends ProxyResource { + tags?: Tag[]; +} + +/** + * @class + * Initializes a new instance of the BudgetTimePeriod class. + * @constructor + * The start and end date for a budget. + * + * @member {date} startDate The start date for the budget. + * @member {date} [endDate] The end date for the budget. If not provided, we + * default this to 10 years from the start date. + */ +export interface BudgetTimePeriod { + startDate: Date; + endDate?: Date; +} + +/** + * @class + * Initializes a new instance of the Filters class. + * @constructor + * May be used to filter budgets by resource group, resource, or meter. + * + * @member {array} [resourceGroups] The list of filters on resource groups, + * allowed at subscription level only. + * @member {array} [resources] The list of filters on resources. + * @member {array} [meters] The list of filters on meters (GUID), mandatory for + * budgets of usage category. + * @member {object} [tags] The dictionary of filters on tags. + */ +export interface Filters { + resourceGroups?: string[]; + resources?: string[]; + meters?: string[]; + tags?: { [propertyName: string]: string[] }; +} + +/** + * @class + * Initializes a new instance of the CurrentSpend class. + * @constructor + * The current amount of cost which is being tracked for a budget. * - * @member {object} [error] The details of the error. - * @member {string} [error.code] Error code. - * @member {string} [error.message] Error message indicating why the operation - * failed. + * @member {number} [amount] The total amount of cost which is being tracked by + * the budget. + * @member {string} [unit] The unit of measure for the budget amount. */ -export interface ErrorResponse { - error?: ErrorDetails; +export interface CurrentSpend { + readonly amount?: number; + readonly unit?: string; } /** * @class - * Initializes a new instance of the OperationDisplay class. + * Initializes a new instance of the Notification class. * @constructor - * The object that represents the operation. + * The notification associated with a budget. * - * @member {string} [provider] Service provider: Microsoft.Consumption. - * @member {string} [resource] Resource on which the operation is performed: - * UsageDetail, etc. - * @member {string} [operation] Operation type: Read, write, delete, etc. + * @member {boolean} enabled The notification is enabled or not. + * @member {string} operator The comparison operator. Possible values include: + * 'EqualTo', 'GreaterThan', 'GreaterThanOrEqualTo' + * @member {number} threshold Threshold value associated with a notification. + * Notification is sent when the cost exceeded the threshold. It is always + * percent and has to be between 0 and 1000. + * @member {array} contactEmails Email addresses to send the budget + * notification to when the threshold is exceeded. + * @member {array} [contactRoles] Contact roles to send the budget notification + * to when the threshold is exceeded. + * @member {array} [contactGroups] Action groups to send the budget + * notification to when the threshold is exceeded. */ -export interface OperationDisplay { - readonly provider?: string; - readonly resource?: string; - readonly operation?: string; +export interface Notification { + enabled: boolean; + operator: string; + threshold: number; + contactEmails: string[]; + contactRoles?: string[]; + contactGroups?: string[]; } /** * @class - * Initializes a new instance of the Operation class. + * Initializes a new instance of the Budget class. * @constructor - * A Consumption REST API operation. + * A budget resource. * - * @member {string} [name] Operation name: {provider}/{resource}/{operation}. - * @member {object} [display] The object that represents the operation. - * @member {string} [display.provider] Service provider: Microsoft.Consumption. - * @member {string} [display.resource] Resource on which the operation is - * performed: UsageDetail, etc. - * @member {string} [display.operation] Operation type: Read, write, delete, - * etc. + * @member {string} category The category of the budget, whether the budget + * tracks cost or usage. Possible values include: 'Cost', 'Usage' + * @member {number} amount The total amount of cost to track with the budget + * @member {string} timeGrain The time covered by a budget. Tracking of the + * amount will be reset based on the time grain. Possible values include: + * 'Monthly', 'Quarterly', 'Annually' + * @member {object} timePeriod Has start and end date of the budget. The start + * date must be first of the month and should be less than the end date. Budget + * start date must be on or after June 1, 2017. Future start date should not be + * more than three months. Past start date should be selected within the + * timegrain preiod. There are no restrictions on the end date. + * @member {date} [timePeriod.startDate] The start date for the budget. + * @member {date} [timePeriod.endDate] The end date for the budget. If not + * provided, we default this to 10 years from the start date. + * @member {object} [filters] May be used to filter budgets by resource group, + * resource, or meter. + * @member {array} [filters.resourceGroups] The list of filters on resource + * groups, allowed at subscription level only. + * @member {array} [filters.resources] The list of filters on resources. + * @member {array} [filters.meters] The list of filters on meters (GUID), + * mandatory for budgets of usage category. + * @member {object} [filters.tags] The dictionary of filters on tags. + * @member {object} [currentSpend] The current amount of cost which is being + * tracked for a budget. + * @member {number} [currentSpend.amount] The total amount of cost which is + * being tracked by the budget. + * @member {string} [currentSpend.unit] The unit of measure for the budget + * amount. + * @member {object} [notifications] Dictionary of notifications associated with + * the budget. Budget can have up to five notifications. */ -export interface Operation { - readonly name?: string; - display?: OperationDisplay; +export interface Budget extends ProxyResource { + category: string; + amount: number; + timeGrain: string; + timePeriod: BudgetTimePeriod; + filters?: Filters; + readonly currentSpend?: CurrentSpend; + notifications?: { [propertyName: string]: Notification }; } /** * @class - * Initializes a new instance of the Resource class. + * Initializes a new instance of the CostTagProperties class. * @constructor - * The Resource model definition. + * The properties of the cost tag. * - * @member {string} [id] Resource Id. - * @member {string} [name] Resource name. - * @member {string} [type] Resource type. - * @member {object} [tags] Resource tags. + * @member {string} [key] Cost tag key. */ -export interface Resource extends BaseResource { - readonly id?: string; - readonly name?: string; - readonly type?: string; - readonly tags?: { [propertyName: string]: string }; +export interface CostTagProperties { + key?: string; } /** * @class - * Initializes a new instance of the MeterDetails class. + * Initializes a new instance of the CostTag class. * @constructor - * The properties of the meter detail. + * A cost tag resource. * - * @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. + * @member {array} [costTags] Cost tags. */ -export interface MeterDetails { - readonly meterName?: string; - readonly meterCategory?: string; - readonly meterSubCategory?: string; - readonly unit?: string; - readonly meterLocation?: string; - readonly totalIncludedQuantity?: number; - readonly pretaxStandardRate?: number; +export interface CostTag extends ProxyResource { + costTags?: CostTagProperties[]; } /** @@ -155,6 +638,8 @@ export interface MeterDetails { * @member {number} [meterDetails.totalIncludedQuantity] The total included * quantity associated with the offer. * @member {number} [meterDetails.pretaxStandardRate] The pretax listing price. + * @member {string} [meterDetails.serviceName] The name of the service. + * @member {string} [meterDetails.serviceTier] The service tier. * @member {string} [unitOfMeasure] Unit of measure * @member {number} [includedQuantity] Included quality for an offer * @member {string} [partNumber] Part Number @@ -231,88 +716,83 @@ export interface Forecast extends Resource { /** * @class - * Initializes a new instance of the UsageDetail class. + * Initializes a new instance of the ErrorDetails class. * @constructor - * An usage detail resource. + * The details of the error. * - * @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. + * @member {string} [code] Error code. + * @member {string} [message] Error message indicating why the operation + * failed. */ -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; +export interface ErrorDetails { + readonly code?: string; + readonly message?: string; +} + +/** + * @class + * Initializes a new instance of the ErrorResponse class. + * @constructor + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + * + * @member {object} [error] The details of the error. + * @member {string} [error.code] Error code. + * @member {string} [error.message] Error message indicating why the operation + * failed. + */ +export interface ErrorResponse { + error?: ErrorDetails; +} + +/** + * @class + * Initializes a new instance of the OperationDisplay class. + * @constructor + * The object that represents the operation. + * + * @member {string} [provider] Service provider: Microsoft.Consumption. + * @member {string} [resource] Resource on which the operation is performed: + * UsageDetail, etc. + * @member {string} [operation] Operation type: Read, write, delete, etc. + */ +export interface OperationDisplay { + readonly provider?: string; + readonly resource?: string; + readonly operation?: string; +} + +/** + * @class + * Initializes a new instance of the Operation class. + * @constructor + * A Consumption REST API operation. + * + * @member {string} [name] Operation name: {provider}/{resource}/{operation}. + * @member {object} [display] The object that represents the operation. + * @member {string} [display.provider] Service provider: Microsoft.Consumption. + * @member {string} [display.resource] Resource on which the operation is + * performed: UsageDetail, etc. + * @member {string} [display.operation] Operation type: Read, write, delete, + * etc. + */ +export interface Operation { + readonly name?: string; + display?: OperationDisplay; +} + +/** + * @class + * Initializes a new instance of the ResourceAttributes class. + * @constructor + * The Resource model definition. + * + * @member {string} [location] Resource location + * @member {string} [sku] Resource sku + */ +export interface ResourceAttributes { + readonly location?: string; + readonly sku?: string; } /** @@ -342,6 +822,68 @@ export interface UsageDetailsListResult extends Array { readonly nextLink?: string; } +/** + * @class + * Initializes a new instance of the MarketplacesListResult class. + * @constructor + * Result of listing marketplaces. It contains a list of available marketplaces + * in reverse chronological order by billing period. + * + * @member {string} [nextLink] The link (url) to the next page of results. + */ +export interface MarketplacesListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ReservationSummariesListResult class. + * @constructor + * Result of listing reservation summaries. + * + * @member {string} [nextLink] The link (url) to the next page of results. + */ +export interface ReservationSummariesListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ReservationDetailsListResult class. + * @constructor + * Result of listing reservation details. + * + * @member {string} [nextLink] The link (url) to the next page of results. + */ +export interface ReservationDetailsListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ReservationRecommendationsListResult class. + * @constructor + * Result of listing reservation recommendations. + * + * @member {string} [nextLink] The link (url) to the next page of results. + */ +export interface ReservationRecommendationsListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the BudgetsListResult class. + * @constructor + * Result of listing budgets. It contains a list of available budgets in the + * scope provided. + * + * @member {string} [nextLink] The link (url) to the next page of results. + */ +export interface BudgetsListResult extends Array { + readonly nextLink?: string; +} + /** * @class * Initializes a new instance of the ForecastsListResult class. diff --git a/lib/services/consumptionManagement/lib/models/index.js b/lib/services/consumptionManagement/lib/models/index.js index 72a500dca9..b9ab71cd44 100644 --- a/lib/services/consumptionManagement/lib/models/index.js +++ b/lib/services/consumptionManagement/lib/models/index.js @@ -18,18 +18,41 @@ var msRestAzure = require('ms-rest-azure'); exports.BaseResource = msRestAzure.BaseResource; exports.CloudError = msRestAzure.CloudError; -exports.ErrorDetails = require('./errorDetails'); -exports.ErrorResponse = require('./errorResponse'); -exports.OperationDisplay = require('./operationDisplay'); -exports.Operation = require('./operation'); -exports.Resource = require('./resource'); exports.MeterDetails = require('./meterDetails'); +exports.Resource = require('./resource'); +exports.UsageDetail = require('./usageDetail'); +exports.Marketplace = require('./marketplace'); +exports.BalancePropertiesNewPurchasesDetailsItem = require('./balancePropertiesNewPurchasesDetailsItem'); +exports.BalancePropertiesAdjustmentDetailsItem = require('./balancePropertiesAdjustmentDetailsItem'); +exports.Balance = require('./balance'); +exports.ReservationSummary = require('./reservationSummary'); +exports.ReservationDetail = require('./reservationDetail'); +exports.ReservationRecommendation = require('./reservationRecommendation'); +exports.Tag = require('./tag'); +exports.ProxyResource = require('./proxyResource'); +exports.TagsResult = require('./tagsResult'); +exports.BudgetTimePeriod = require('./budgetTimePeriod'); +exports.Filters = require('./filters'); +exports.CurrentSpend = require('./currentSpend'); +exports.Notification = require('./notification'); +exports.Budget = require('./budget'); +exports.CostTagProperties = require('./costTagProperties'); +exports.CostTag = require('./costTag'); exports.PriceSheetProperties = require('./priceSheetProperties'); exports.PriceSheetResult = require('./priceSheetResult'); exports.ForecastPropertiesConfidenceLevelsItem = require('./forecastPropertiesConfidenceLevelsItem'); exports.Forecast = require('./forecast'); -exports.UsageDetail = require('./usageDetail'); +exports.ErrorDetails = require('./errorDetails'); +exports.ErrorResponse = require('./errorResponse'); +exports.OperationDisplay = require('./operationDisplay'); +exports.Operation = require('./operation'); +exports.ResourceAttributes = require('./resourceAttributes'); exports.QueryOptions = require('./queryOptions'); exports.UsageDetailsListResult = require('./usageDetailsListResult'); +exports.MarketplacesListResult = require('./marketplacesListResult'); +exports.ReservationSummariesListResult = require('./reservationSummariesListResult'); +exports.ReservationDetailsListResult = require('./reservationDetailsListResult'); +exports.ReservationRecommendationsListResult = require('./reservationRecommendationsListResult'); +exports.BudgetsListResult = require('./budgetsListResult'); exports.ForecastsListResult = require('./forecastsListResult'); exports.OperationListResult = require('./operationListResult'); diff --git a/lib/services/consumptionManagement/lib/models/meterDetails.js b/lib/services/consumptionManagement/lib/models/meterDetails.js index 3420ce4172..9f38c8d5f7 100644 --- a/lib/services/consumptionManagement/lib/models/meterDetails.js +++ b/lib/services/consumptionManagement/lib/models/meterDetails.js @@ -30,6 +30,8 @@ class MeterDetails { * @member {number} [totalIncludedQuantity] The total included quantity * associated with the offer. * @member {number} [pretaxStandardRate] The pretax listing price. + * @member {string} [serviceName] The name of the service. + * @member {string} [serviceTier] The service tier. */ constructor() { } @@ -103,6 +105,22 @@ class MeterDetails { type: { name: 'Number' } + }, + serviceName: { + required: false, + readOnly: true, + serializedName: 'serviceName', + type: { + name: 'String' + } + }, + serviceTier: { + required: false, + readOnly: true, + serializedName: 'serviceTier', + type: { + name: 'String' + } } } } diff --git a/lib/services/consumptionManagement/lib/models/priceSheetProperties.js b/lib/services/consumptionManagement/lib/models/priceSheetProperties.js index 42cec9de79..7fc321d7ef 100644 --- a/lib/services/consumptionManagement/lib/models/priceSheetProperties.js +++ b/lib/services/consumptionManagement/lib/models/priceSheetProperties.js @@ -38,6 +38,8 @@ class PriceSheetProperties { * quantity associated with the offer. * @member {number} [meterDetails.pretaxStandardRate] The pretax listing * price. + * @member {string} [meterDetails.serviceName] The name of the service. + * @member {string} [meterDetails.serviceTier] The service tier. * @member {string} [unitOfMeasure] Unit of measure * @member {number} [includedQuantity] Included quality for an offer * @member {string} [partNumber] Part Number diff --git a/lib/services/consumptionManagement/lib/models/reservationDetail.js b/lib/services/consumptionManagement/lib/models/reservationDetail.js new file mode 100644 index 0000000000..e6b382824e --- /dev/null +++ b/lib/services/consumptionManagement/lib/models/reservationDetail.js @@ -0,0 +1,171 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * reservation detail resource. + * + * @extends models['Resource'] + */ +class ReservationDetail extends models['Resource'] { + /** + * Create a ReservationDetail. + * @member {string} [reservationOrderId] The reservation order ID is the + * identifier for a reservation purchase. Each reservation order ID + * represents a single purchase transaction. A reservation order contains + * reservations. The reservation order specifies the VM size and region for + * the reservations. + * @member {string} [reservationId] The reservation ID is the identifier of a + * reservation within a reservation order. Each reservation is the grouping + * for applying the benefit scope and also specifies the number of instances + * to which the reservation benefit can be applied to. + * @member {string} [skuName] This is the ARM Sku name. It can be used to + * join with the servicetype field in additoinalinfo in usage records. + * @member {number} [reservedHours] This is the total hours reserved for the + * day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 + * hours for that day and 24 hours from subsequent days. + * @member {date} [usageDate] The date on which consumption occurred. + * @member {number} [usedHours] This is the total hours used by the instance. + * @member {string} [instanceId] This identifier is the name of the resource + * or the fully qualified Resource ID. + * @member {number} [totalReservedQuantity] This is the total count of + * instances that are reserved for the reservationid. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ReservationDetail + * + * @returns {object} metadata of ReservationDetail + * + */ + mapper() { + return { + required: false, + serializedName: 'ReservationDetail', + type: { + name: 'Composite', + className: 'ReservationDetail', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + tags: { + required: false, + readOnly: true, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + reservationOrderId: { + required: false, + readOnly: true, + serializedName: 'properties.reservationOrderId', + type: { + name: 'String' + } + }, + reservationId: { + required: false, + readOnly: true, + serializedName: 'properties.reservationId', + type: { + name: 'String' + } + }, + skuName: { + required: false, + readOnly: true, + serializedName: 'properties.skuName', + type: { + name: 'String' + } + }, + reservedHours: { + required: false, + readOnly: true, + serializedName: 'properties.reservedHours', + type: { + name: 'Number' + } + }, + usageDate: { + required: false, + readOnly: true, + serializedName: 'properties.usageDate', + type: { + name: 'DateTime' + } + }, + usedHours: { + required: false, + readOnly: true, + serializedName: 'properties.usedHours', + type: { + name: 'Number' + } + }, + instanceId: { + required: false, + readOnly: true, + serializedName: 'properties.instanceId', + type: { + name: 'String' + } + }, + totalReservedQuantity: { + required: false, + readOnly: true, + serializedName: 'properties.totalReservedQuantity', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ReservationDetail; diff --git a/lib/services/consumptionManagement/lib/models/reservationDetailsListResult.js b/lib/services/consumptionManagement/lib/models/reservationDetailsListResult.js index 2e81e65d1a..3739225d33 100644 --- a/lib/services/consumptionManagement/lib/models/reservationDetailsListResult.js +++ b/lib/services/consumptionManagement/lib/models/reservationDetailsListResult.js @@ -44,10 +44,10 @@ class ReservationDetailsListResult extends Array { name: 'Sequence', element: { required: false, - serializedName: 'ReservationDetailsElementType', + serializedName: 'ReservationDetailElementType', type: { name: 'Composite', - className: 'ReservationDetails' + className: 'ReservationDetail' } } } diff --git a/lib/services/consumptionManagement/lib/models/reservationRecommendation.js b/lib/services/consumptionManagement/lib/models/reservationRecommendation.js new file mode 100644 index 0000000000..0e4dcc4ca0 --- /dev/null +++ b/lib/services/consumptionManagement/lib/models/reservationRecommendation.js @@ -0,0 +1,191 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Reservation recommendation resource. + * + */ +class ReservationRecommendation { + /** + * Create a ReservationRecommendation. + * @member {string} [id] Resource Id. + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + * @member {object} [tags] Resource tags. + * @member {string} [location] Resource location + * @member {string} [sku] Resource sku + * @member {string} [lookBackPeriod] The number of days of usage to look back + * for recommendation. + * @member {uuid} [meterId] The meter id (GUID) + * @member {string} [term] RI recommendations in one or three year terms. + * @member {number} [costWithNoReservedInstances] The total amount of cost + * without reserved instances. + * @member {number} [recommendedQuantity] Recomended quality for reserved + * instances. + * @member {number} [totalCostWithReservedInstances] The total amount of cost + * with reserved instances. + * @member {number} [netSavings] Total estimated savings with reserved + * instances. + * @member {date} [firstUsageDate] The usage date for looking back. + * @member {string} [scope] Shared or single recommendation. + */ + constructor() { + } + + /** + * Defines the metadata of ReservationRecommendation + * + * @returns {object} metadata of ReservationRecommendation + * + */ + mapper() { + return { + required: false, + serializedName: 'ReservationRecommendation', + type: { + name: 'Composite', + className: 'ReservationRecommendation', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + tags: { + required: false, + readOnly: true, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: false, + readOnly: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + sku: { + required: false, + readOnly: true, + serializedName: 'sku', + type: { + name: 'String' + } + }, + lookBackPeriod: { + required: false, + readOnly: true, + serializedName: 'properties.lookBackPeriod', + type: { + name: 'String' + } + }, + meterId: { + required: false, + readOnly: true, + serializedName: 'properties.meterId', + type: { + name: 'String' + } + }, + term: { + required: false, + readOnly: true, + serializedName: 'properties.term', + type: { + name: 'String' + } + }, + costWithNoReservedInstances: { + required: false, + readOnly: true, + serializedName: 'properties.costWithNoReservedInstances', + type: { + name: 'Number' + } + }, + recommendedQuantity: { + required: false, + readOnly: true, + serializedName: 'properties.recommendedQuantity', + type: { + name: 'Number' + } + }, + totalCostWithReservedInstances: { + required: false, + readOnly: true, + serializedName: 'properties.totalCostWithReservedInstances', + type: { + name: 'Number' + } + }, + netSavings: { + required: false, + readOnly: true, + serializedName: 'properties.netSavings', + type: { + name: 'Number' + } + }, + firstUsageDate: { + required: false, + readOnly: true, + serializedName: 'properties.firstUsageDate', + type: { + name: 'DateTime' + } + }, + scope: { + required: false, + readOnly: true, + serializedName: 'properties.scope', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ReservationRecommendation; diff --git a/lib/services/consumptionManagement/lib/models/reservationRecommendationsListResult.js b/lib/services/consumptionManagement/lib/models/reservationRecommendationsListResult.js index b7529c060d..c689e9857b 100644 --- a/lib/services/consumptionManagement/lib/models/reservationRecommendationsListResult.js +++ b/lib/services/consumptionManagement/lib/models/reservationRecommendationsListResult.js @@ -44,10 +44,10 @@ class ReservationRecommendationsListResult extends Array { name: 'Sequence', element: { required: false, - serializedName: 'ReservationRecommendationsElementType', + serializedName: 'ReservationRecommendationElementType', type: { name: 'Composite', - className: 'ReservationRecommendations' + className: 'ReservationRecommendation' } } } diff --git a/lib/services/consumptionManagement/lib/models/reservationSummariesListResult.js b/lib/services/consumptionManagement/lib/models/reservationSummariesListResult.js index 864c674160..b5abffdb42 100644 --- a/lib/services/consumptionManagement/lib/models/reservationSummariesListResult.js +++ b/lib/services/consumptionManagement/lib/models/reservationSummariesListResult.js @@ -44,10 +44,10 @@ class ReservationSummariesListResult extends Array { name: 'Sequence', element: { required: false, - serializedName: 'ReservationSummariesElementType', + serializedName: 'ReservationSummaryElementType', type: { name: 'Composite', - className: 'ReservationSummaries' + className: 'ReservationSummary' } } } diff --git a/lib/services/consumptionManagement/lib/models/reservationSummary.js b/lib/services/consumptionManagement/lib/models/reservationSummary.js new file mode 100644 index 0000000000..b7b1928543 --- /dev/null +++ b/lib/services/consumptionManagement/lib/models/reservationSummary.js @@ -0,0 +1,186 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * reservation summary resource. + * + * @extends models['Resource'] + */ +class ReservationSummary extends models['Resource'] { + /** + * Create a ReservationSummary. + * @member {string} [reservationOrderId] The reservation order ID is the + * identifier for a reservation purchase. Each reservation order ID + * represents a single purchase transaction. A reservation order contains + * reservations. The reservation order specifies the VM size and region for + * the reservations. + * @member {string} [reservationId] The reservation ID is the identifier of a + * reservation within a reservation order. Each reservation is the grouping + * for applying the benefit scope and also specifies the number of instances + * to which the reservation benefit can be applied to. + * @member {string} [skuName] This is the ARM Sku name. It can be used to + * join with the servicetype field in additoinalinfo in usage records. + * @member {number} [reservedHours] This is the total hours reserved. E.g. if + * reservation for 1 instance was made on 1 PM, this will be 11 hours for + * that day and 24 hours from subsequent days + * @member {date} [usageDate] Data corresponding to the utilization record. + * If the grain of data is monthly, it will be first day of month. + * @member {number} [usedHours] Total used hours by the reservation + * @member {number} [minUtilizationPercentage] This is the minimum hourly + * utilization in the usage time (day or month). E.g. if usage record + * corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was + * 10%, this field will return 10% for that day + * @member {number} [avgUtilizationPercentage] This is average utilization + * for the entire time range. (day or month depending on the grain) + * @member {number} [maxUtilizationPercentage] This is the maximum hourly + * utilization in the usage time (day or month). E.g. if usage record + * corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was + * 100%, this field will return 100% for that day. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ReservationSummary + * + * @returns {object} metadata of ReservationSummary + * + */ + mapper() { + return { + required: false, + serializedName: 'ReservationSummary', + type: { + name: 'Composite', + className: 'ReservationSummary', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + tags: { + required: false, + readOnly: true, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + reservationOrderId: { + required: false, + readOnly: true, + serializedName: 'properties.reservationOrderId', + type: { + name: 'String' + } + }, + reservationId: { + required: false, + readOnly: true, + serializedName: 'properties.reservationId', + type: { + name: 'String' + } + }, + skuName: { + required: false, + readOnly: true, + serializedName: 'properties.skuName', + type: { + name: 'String' + } + }, + reservedHours: { + required: false, + readOnly: true, + serializedName: 'properties.reservedHours', + type: { + name: 'Number' + } + }, + usageDate: { + required: false, + readOnly: true, + serializedName: 'properties.usageDate', + type: { + name: 'DateTime' + } + }, + usedHours: { + required: false, + readOnly: true, + serializedName: 'properties.usedHours', + type: { + name: 'Number' + } + }, + minUtilizationPercentage: { + required: false, + readOnly: true, + serializedName: 'properties.minUtilizationPercentage', + type: { + name: 'Number' + } + }, + avgUtilizationPercentage: { + required: false, + readOnly: true, + serializedName: 'properties.avgUtilizationPercentage', + type: { + name: 'Number' + } + }, + maxUtilizationPercentage: { + required: false, + readOnly: true, + serializedName: 'properties.maxUtilizationPercentage', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ReservationSummary; diff --git a/lib/services/consumptionManagement/lib/models/tagsResult.js b/lib/services/consumptionManagement/lib/models/tagsResult.js new file mode 100644 index 0000000000..54cd3eaca9 --- /dev/null +++ b/lib/services/consumptionManagement/lib/models/tagsResult.js @@ -0,0 +1,95 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A resource listing all tags. + * + * @extends models['ProxyResource'] + */ +class TagsResult extends models['ProxyResource'] { + /** + * Create a TagsResult. + * @member {array} [tags] A list of Tag. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of TagsResult + * + * @returns {object} metadata of TagsResult + * + */ + mapper() { + return { + required: false, + serializedName: 'TagsResult', + type: { + name: 'Composite', + className: 'TagsResult', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + eTag: { + required: false, + serializedName: 'eTag', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'properties.tags', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TagElementType', + type: { + name: 'Composite', + className: 'Tag' + } + } + } + } + } + } + }; + } +} + +module.exports = TagsResult; diff --git a/lib/services/consumptionManagement/lib/models/usageDetail.js b/lib/services/consumptionManagement/lib/models/usageDetail.js index 5fbbcdaa37..fca8718d41 100644 --- a/lib/services/consumptionManagement/lib/models/usageDetail.js +++ b/lib/services/consumptionManagement/lib/models/usageDetail.js @@ -57,6 +57,8 @@ class UsageDetail extends models['Resource'] { * quantity associated with the offer. * @member {number} [meterDetails.pretaxStandardRate] The pretax listing * price. + * @member {string} [meterDetails.serviceName] The name of the service. + * @member {string} [meterDetails.serviceTier] The service tier. * @member {uuid} [subscriptionGuid] Subscription guid. * @member {string} [subscriptionName] Subscription name. * @member {string} [accountName] Account name. @@ -69,6 +71,7 @@ class UsageDetail extends models['Resource'] { * @member {string} [resourceGuid] Resource Guid * @member {string} [offerId] Offer Id * @member {boolean} [chargesBilledSeparately] Charges billed separately + * @member {string} [location] Resource Location * @member {string} [additionalProperties] Additional details of this usage * item. By default this is not populated, unless it's specified in $expand. */ @@ -330,6 +333,14 @@ class UsageDetail extends models['Resource'] { name: 'Boolean' } }, + location: { + required: false, + readOnly: true, + serializedName: 'properties.location', + type: { + name: 'String' + } + }, additionalProperties: { required: false, readOnly: true, diff --git a/lib/services/consumptionManagement/lib/operations/balances.js b/lib/services/consumptionManagement/lib/operations/balances.js new file mode 100644 index 0000000000..17e2d6c80d --- /dev/null +++ b/lib/services/consumptionManagement/lib/operations/balances.js @@ -0,0 +1,483 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets the balances for a scope by billingAccountId. Balances are available + * via this API only for May 1, 2014 or later. + * + * @param {string} billingAccountId BillingAccount ID + * + * @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 Balance} 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 _getByBillingAccount(billingAccountId, 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 (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 (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 (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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/balances'; + requestUrl = requestUrl.replace('{billingAccountId}', encodeURIComponent(billingAccountId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + 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['Balance']().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); + }); +} + +/** + * Gets the balances for a scope by billing period and billingAccountId. + * Balances 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 {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 Balance} 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 _getForBillingPeriodByBillingAccount(billingAccountId, 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.'); + } + // Validate + try { + 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 (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 (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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/balances'; + requestUrl = requestUrl.replace('{billingAccountId}', encodeURIComponent(billingAccountId)); + requestUrl = requestUrl.replace('{billingPeriodName}', encodeURIComponent(billingPeriodName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + 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['Balance']().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 Balances. */ +class Balances { + /** + * Create a Balances. + * @param {ConsumptionManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._getByBillingAccount = _getByBillingAccount; + this._getForBillingPeriodByBillingAccount = _getForBillingPeriodByBillingAccount; + } + + /** + * Gets the balances for a scope by billingAccountId. Balances are available + * via this API only for May 1, 2014 or later. + * + * @param {string} billingAccountId BillingAccount ID + * + * @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. + */ + getByBillingAccountWithHttpOperationResponse(billingAccountId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getByBillingAccount(billingAccountId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the balances for a scope by billingAccountId. Balances are available + * via this API only for May 1, 2014 or later. + * + * @param {string} billingAccountId BillingAccount ID + * + * @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 {Balance} - 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 Balance} 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. + */ + getByBillingAccount(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._getByBillingAccount(billingAccountId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getByBillingAccount(billingAccountId, options, optionalCallback); + } + } + + /** + * Gets the balances for a scope by billing period and billingAccountId. + * Balances 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 {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. + */ + getForBillingPeriodByBillingAccountWithHttpOperationResponse(billingAccountId, billingPeriodName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getForBillingPeriodByBillingAccount(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; + }); + }); + } + + /** + * Gets the balances for a scope by billing period and billingAccountId. + * Balances 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 {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 {Balance} - 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 Balance} 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. + */ + getForBillingPeriodByBillingAccount(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._getForBillingPeriodByBillingAccount(billingAccountId, billingPeriodName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getForBillingPeriodByBillingAccount(billingAccountId, billingPeriodName, options, optionalCallback); + } + } + +} + +module.exports = Balances; diff --git a/lib/services/consumptionManagement/lib/operations/costTags.js b/lib/services/consumptionManagement/lib/operations/costTags.js new file mode 100644 index 0000000000..15f495039d --- /dev/null +++ b/lib/services/consumptionManagement/lib/operations/costTags.js @@ -0,0 +1,537 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Get cost tags for a billing account. + * + * @param {string} billingAccountId BillingAccount ID + * + * @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 CostTag} 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 _get(billingAccountId, 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 (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 (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 (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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/costTags'; + requestUrl = requestUrl.replace('{billingAccountId}', encodeURIComponent(billingAccountId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + 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['CostTag']().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); + }); +} + +/** + * The operation to create or update cost tags assiciated with a billing + * account. Update operation requires latest eTag to be set in the request + * mandatorily. You may obtain the latest eTag by performing a get operation. + * Create operation does not require eTag. + * + * @param {string} billingAccountId BillingAccount ID + * + * @param {object} parameters Parameters supplied to the Create cost tags + * operation. + * + * @param {array} [parameters.costTags] Cost tags. + * + * @param {string} [parameters.eTag] eTag of the resource. To handle concurrent + * update scenarion, this field will be used to determine whether the user is + * updating the latest version or not. + * + * @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 CostTag} 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 _createOrUpdate(billingAccountId, parameters, 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 (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 (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/costTags'; + requestUrl = requestUrl.replace('{billingAccountId}', encodeURIComponent(billingAccountId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + 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]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CostTag']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + 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['CostTag']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['CostTag']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a CostTags. */ +class CostTags { + /** + * Create a CostTags. + * @param {ConsumptionManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + } + + /** + * Get cost tags for a billing account. + * + * @param {string} billingAccountId BillingAccount ID + * + * @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. + */ + getWithHttpOperationResponse(billingAccountId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(billingAccountId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get cost tags for a billing account. + * + * @param {string} billingAccountId BillingAccount ID + * + * @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 {CostTag} - 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 CostTag} 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. + */ + get(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._get(billingAccountId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(billingAccountId, options, optionalCallback); + } + } + + /** + * The operation to create or update cost tags assiciated with a billing + * account. Update operation requires latest eTag to be set in the request + * mandatorily. You may obtain the latest eTag by performing a get operation. + * Create operation does not require eTag. + * + * @param {string} billingAccountId BillingAccount ID + * + * @param {object} parameters Parameters supplied to the Create cost tags + * operation. + * + * @param {array} [parameters.costTags] Cost tags. + * + * @param {string} [parameters.eTag] eTag of the resource. To handle concurrent + * update scenarion, this field will be used to determine whether the user is + * updating the latest version or not. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(billingAccountId, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(billingAccountId, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * The operation to create or update cost tags assiciated with a billing + * account. Update operation requires latest eTag to be set in the request + * mandatorily. You may obtain the latest eTag by performing a get operation. + * Create operation does not require eTag. + * + * @param {string} billingAccountId BillingAccount ID + * + * @param {object} parameters Parameters supplied to the Create cost tags + * operation. + * + * @param {array} [parameters.costTags] Cost tags. + * + * @param {string} [parameters.eTag] eTag of the resource. To handle concurrent + * update scenarion, this field will be used to determine whether the user is + * updating the latest version or not. + * + * @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 {CostTag} - 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 CostTag} 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. + */ + createOrUpdate(billingAccountId, parameters, 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._createOrUpdate(billingAccountId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(billingAccountId, parameters, options, optionalCallback); + } + } + +} + +module.exports = CostTags; diff --git a/lib/services/consumptionManagement/lib/operations/index.d.ts b/lib/services/consumptionManagement/lib/operations/index.d.ts index c56b27cd21..7f218b2ea9 100644 --- a/lib/services/consumptionManagement/lib/operations/index.d.ts +++ b/lib/services/consumptionManagement/lib/operations/index.d.ts @@ -12,173 +12,6 @@ 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 @@ -1576,6 +1409,3122 @@ export interface UsageDetails { listForBillingPeriodByEnrollmentAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } +/** + * @class + * Marketplaces + * __NOTE__: An instance of this class is automatically created for an + * instance of the ConsumptionManagementClient. + */ +export interface Marketplaces { + + + /** + * Lists the marketplaces for a scope by subscriptionId and current billing + * period. Marketplaces are available via this API only for May 1, 2014 or + * later. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the marketplaces for a scope by subscriptionId and current billing + * period. Marketplaces are available via this API only for May 1, 2014 or + * later. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the marketplaces for a scope by billing period and subscripotionId. + * Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the marketplaces for a scope by billing period and subscripotionId. + * Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByBillingPeriod(billingPeriodName: string, callback: ServiceCallback): void; + listByBillingPeriod(billingPeriodName: string, options: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing + * period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing + * period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByBillingAccount(billingAccountId: string, callback: ServiceCallback): void; + listByBillingAccount(billingAccountId: string, options: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. + * Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. + * Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listForBillingPeriodByBillingAccount(billingAccountId: string, billingPeriodName: string, callback: ServiceCallback): void; + listForBillingPeriodByBillingAccount(billingAccountId: string, billingPeriodName: string, options: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the marketplaces for a scope by departmentId and current billing + * period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the marketplaces for a scope by departmentId and current billing + * period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByDepartment(departmentId: string, callback: ServiceCallback): void; + listByDepartment(departmentId: string, options: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the marketplaces for a scope by billing period and departmentId. + * Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the marketplaces for a scope by billing period and departmentId. + * Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listForBillingPeriodByDepartment(departmentId: string, billingPeriodName: string, callback: ServiceCallback): void; + listForBillingPeriodByDepartment(departmentId: string, billingPeriodName: string, options: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current + * billing period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current + * billing period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByEnrollmentAccount(enrollmentAccountId: string, callback: ServiceCallback): void; + listByEnrollmentAccount(enrollmentAccountId: string, options: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the marketplaces for a scope by billing period and + * enrollmentAccountId. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the marketplaces for a scope by billing period and + * enrollmentAccountId. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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?: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listForBillingPeriodByEnrollmentAccount(enrollmentAccountId: string, billingPeriodName: string, callback: ServiceCallback): void; + listForBillingPeriodByEnrollmentAccount(enrollmentAccountId: string, billingPeriodName: string, options: { filter? : string, top? : number, skiptoken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the marketplaces for a scope by subscriptionId and current billing + * period. Marketplaces 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 marketplaces for a scope by subscriptionId and current billing + * period. Marketplaces 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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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 marketplaces for a scope by billing period and subscripotionId. + * Marketplaces 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 marketplaces for a scope by billing period and subscripotionId. + * Marketplaces 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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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 marketplaces for a scope by billingAccountId and current billing + * period. Marketplaces 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 marketplaces for a scope by billingAccountId and current billing + * period. Marketplaces 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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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 marketplaces for a scope by billing period and billingAccountId. + * Marketplaces 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 marketplaces for a scope by billing period and billingAccountId. + * Marketplaces 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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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 marketplaces for a scope by departmentId and current billing + * period. Marketplaces 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 marketplaces for a scope by departmentId and current billing + * period. Marketplaces 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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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 marketplaces for a scope by billing period and departmentId. + * Marketplaces 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 marketplaces for a scope by billing period and departmentId. + * Marketplaces 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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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 marketplaces for a scope by enrollmentAccountId and current + * billing period. Marketplaces 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 marketplaces for a scope by enrollmentAccountId and current + * billing period. Marketplaces 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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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 marketplaces for a scope by billing period and + * enrollmentAccountId. Marketplaces 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 marketplaces for a scope by billing period and + * enrollmentAccountId. Marketplaces 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 {MarketplacesListResult} - 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. + * + * {MarketplacesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MarketplacesListResult} 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 + * Balances + * __NOTE__: An instance of this class is automatically created for an + * instance of the ConsumptionManagementClient. + */ +export interface Balances { + + + /** + * Gets the balances for a scope by billingAccountId. Balances are available + * via this API only for May 1, 2014 or later. + * + * @param {string} billingAccountId BillingAccount ID + * + * @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. + */ + getByBillingAccountWithHttpOperationResponse(billingAccountId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the balances for a scope by billingAccountId. Balances are available + * via this API only for May 1, 2014 or later. + * + * @param {string} billingAccountId BillingAccount ID + * + * @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 {Balance} - 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. + * + * {Balance} [result] - The deserialized result object if an error did not occur. + * See {@link Balance} 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. + */ + getByBillingAccount(billingAccountId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getByBillingAccount(billingAccountId: string, callback: ServiceCallback): void; + getByBillingAccount(billingAccountId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the balances for a scope by billing period and billingAccountId. + * Balances 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 {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. + */ + getForBillingPeriodByBillingAccountWithHttpOperationResponse(billingAccountId: string, billingPeriodName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the balances for a scope by billing period and billingAccountId. + * Balances 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 {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 {Balance} - 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. + * + * {Balance} [result] - The deserialized result object if an error did not occur. + * See {@link Balance} 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. + */ + getForBillingPeriodByBillingAccount(billingAccountId: string, billingPeriodName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getForBillingPeriodByBillingAccount(billingAccountId: string, billingPeriodName: string, callback: ServiceCallback): void; + getForBillingPeriodByBillingAccount(billingAccountId: string, billingPeriodName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ReservationsSummaries + * __NOTE__: An instance of this class is automatically created for an + * instance of the ConsumptionManagementClient. + */ +export interface ReservationsSummaries { + + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param {string} reservationOrderId Order Id of the reservation + * + * @param {string} grain Can be daily or monthly. Possible values include: + * 'DailyGrain', 'MonthlyGrain' + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Required only for daily grain. The + * properties/UsageDate for start date and end date. The filter supports 'le' + * and 'ge' + * + * @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. + */ + listByReservationOrderWithHttpOperationResponse(reservationOrderId: string, grain: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param {string} reservationOrderId Order Id of the reservation + * + * @param {string} grain Can be daily or monthly. Possible values include: + * 'DailyGrain', 'MonthlyGrain' + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Required only for daily grain. The + * properties/UsageDate for start date and end date. The filter supports 'le' + * and 'ge' + * + * @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 {ReservationSummariesListResult} - 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. + * + * {ReservationSummariesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ReservationSummariesListResult} 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. + */ + listByReservationOrder(reservationOrderId: string, grain: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByReservationOrder(reservationOrderId: string, grain: string, callback: ServiceCallback): void; + listByReservationOrder(reservationOrderId: string, grain: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param {string} reservationOrderId Order Id of the reservation + * + * @param {string} reservationId Id of the reservation + * + * @param {string} grain Can be daily or monthly. Possible values include: + * 'DailyGrain', 'MonthlyGrain' + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Required only for daily grain. The + * properties/UsageDate for start date and end date. The filter supports 'le' + * and 'ge' + * + * @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. + */ + listByReservationOrderAndReservationWithHttpOperationResponse(reservationOrderId: string, reservationId: string, grain: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param {string} reservationOrderId Order Id of the reservation + * + * @param {string} reservationId Id of the reservation + * + * @param {string} grain Can be daily or monthly. Possible values include: + * 'DailyGrain', 'MonthlyGrain' + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] Required only for daily grain. The + * properties/UsageDate for start date and end date. The filter supports 'le' + * and 'ge' + * + * @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 {ReservationSummariesListResult} - 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. + * + * {ReservationSummariesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ReservationSummariesListResult} 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. + */ + listByReservationOrderAndReservation(reservationOrderId: string, reservationId: string, grain: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByReservationOrderAndReservation(reservationOrderId: string, reservationId: string, grain: string, callback: ServiceCallback): void; + listByReservationOrderAndReservation(reservationOrderId: string, reservationId: string, grain: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @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. + */ + listByReservationOrderNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @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 {ReservationSummariesListResult} - 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. + * + * {ReservationSummariesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ReservationSummariesListResult} 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. + */ + listByReservationOrderNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByReservationOrderNext(nextPageLink: string, callback: ServiceCallback): void; + listByReservationOrderNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @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. + */ + listByReservationOrderAndReservationNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @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 {ReservationSummariesListResult} - 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. + * + * {ReservationSummariesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ReservationSummariesListResult} 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. + */ + listByReservationOrderAndReservationNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByReservationOrderAndReservationNext(nextPageLink: string, callback: ServiceCallback): void; + listByReservationOrderAndReservationNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ReservationsDetails + * __NOTE__: An instance of this class is automatically created for an + * instance of the ConsumptionManagementClient. + */ +export interface ReservationsDetails { + + + /** + * Lists the reservations details for provided date range. + * + * @param {string} reservationOrderId Order Id of the reservation + * + * @param {string} filter Filter reservation details by date range. The + * properties/UsageDate for start date and end date. The filter supports 'le' + * and 'ge' + * + * @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. + */ + listByReservationOrderWithHttpOperationResponse(reservationOrderId: string, filter: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the reservations details for provided date range. + * + * @param {string} reservationOrderId Order Id of the reservation + * + * @param {string} filter Filter reservation details by date range. The + * properties/UsageDate for start date and end date. The filter supports 'le' + * and 'ge' + * + * @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 {ReservationDetailsListResult} - 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. + * + * {ReservationDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ReservationDetailsListResult} 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. + */ + listByReservationOrder(reservationOrderId: string, filter: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByReservationOrder(reservationOrderId: string, filter: string, callback: ServiceCallback): void; + listByReservationOrder(reservationOrderId: string, filter: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the reservations details for provided date range. + * + * @param {string} reservationOrderId Order Id of the reservation + * + * @param {string} reservationId Id of the reservation + * + * @param {string} filter Filter reservation details by date range. The + * properties/UsageDate for start date and end date. The filter supports 'le' + * and 'ge' + * + * @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. + */ + listByReservationOrderAndReservationWithHttpOperationResponse(reservationOrderId: string, reservationId: string, filter: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the reservations details for provided date range. + * + * @param {string} reservationOrderId Order Id of the reservation + * + * @param {string} reservationId Id of the reservation + * + * @param {string} filter Filter reservation details by date range. The + * properties/UsageDate for start date and end date. The filter supports 'le' + * and 'ge' + * + * @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 {ReservationDetailsListResult} - 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. + * + * {ReservationDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ReservationDetailsListResult} 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. + */ + listByReservationOrderAndReservation(reservationOrderId: string, reservationId: string, filter: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByReservationOrderAndReservation(reservationOrderId: string, reservationId: string, filter: string, callback: ServiceCallback): void; + listByReservationOrderAndReservation(reservationOrderId: string, reservationId: string, filter: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the reservations details for provided date range. + * + * @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. + */ + listByReservationOrderNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the reservations details for provided date range. + * + * @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 {ReservationDetailsListResult} - 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. + * + * {ReservationDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ReservationDetailsListResult} 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. + */ + listByReservationOrderNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByReservationOrderNext(nextPageLink: string, callback: ServiceCallback): void; + listByReservationOrderNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the reservations details for provided date range. + * + * @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. + */ + listByReservationOrderAndReservationNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the reservations details for provided date range. + * + * @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 {ReservationDetailsListResult} - 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. + * + * {ReservationDetailsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ReservationDetailsListResult} 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. + */ + listByReservationOrderAndReservationNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByReservationOrderAndReservationNext(nextPageLink: string, callback: ServiceCallback): void; + listByReservationOrderAndReservationNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ReservationRecommendations + * __NOTE__: An instance of this class is automatically created for an + * instance of the ConsumptionManagementClient. + */ +export interface ReservationRecommendations { + + + /** + * List of recomendations for purchasing reserved instances. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] May be used to filter + * reservationRecommendations by properties/scope and + * properties/lookBackPeriod. + * + * @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?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List of recomendations for purchasing reserved instances. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] May be used to filter + * reservationRecommendations by properties/scope and + * properties/lookBackPeriod. + * + * @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 {ReservationRecommendationsListResult} - 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. + * + * {ReservationRecommendationsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ReservationRecommendationsListResult} 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?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List of recomendations for purchasing reserved instances. + * + * @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>; + + /** + * List of recomendations for purchasing reserved instances. + * + * @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 {ReservationRecommendationsListResult} - 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. + * + * {ReservationRecommendationsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ReservationRecommendationsListResult} 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; +} + +/** + * @class + * Budgets + * __NOTE__: An instance of this class is automatically created for an + * instance of the ConsumptionManagementClient. + */ +export interface Budgets { + + + /** + * Lists all budgets for a subscription. + * + * @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. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all budgets for a subscription. + * + * @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 {BudgetsListResult} - 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. + * + * {BudgetsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link BudgetsListResult} 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?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all budgets for a resource group under a subscription. + * + * @param {string} resourceGroupName Azure Resource Group Name. + * + * @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. + */ + listByResourceGroupNameWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all budgets for a resource group under a subscription. + * + * @param {string} resourceGroupName Azure Resource Group Name. + * + * @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 {BudgetsListResult} - 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. + * + * {BudgetsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link BudgetsListResult} 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. + */ + listByResourceGroupName(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupName(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroupName(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the budget for a subscription by budget name. + * + * @param {string} budgetName Budget Name. + * + * @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. + */ + getWithHttpOperationResponse(budgetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the budget for a subscription by budget name. + * + * @param {string} budgetName Budget Name. + * + * @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 {Budget} - 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. + * + * {Budget} [result] - The deserialized result object if an error did not occur. + * See {@link Budget} 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(budgetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(budgetName: string, callback: ServiceCallback): void; + get(budgetName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The operation to create or update a budget. Update operation requires latest + * eTag to be set in the request mandatorily. You may obtain the latest eTag by + * performing a get operation. Create operation does not require eTag. + * + * @param {string} budgetName Budget Name. + * + * @param {object} parameters Parameters supplied to the Create Budget + * operation. + * + * @param {string} parameters.category The category of the budget, whether the + * budget tracks cost or usage. Possible values include: 'Cost', 'Usage' + * + * @param {number} parameters.amount The total amount of cost to track with the + * budget + * + * @param {string} parameters.timeGrain The time covered by a budget. Tracking + * of the amount will be reset based on the time grain. Possible values + * include: 'Monthly', 'Quarterly', 'Annually' + * + * @param {object} parameters.timePeriod Has start and end date of the budget. + * The start date must be first of the month and should be less than the end + * date. Budget start date must be on or after June 1, 2017. Future start date + * should not be more than three months. Past start date should be selected + * within the timegrain preiod. There are no restrictions on the end date. + * + * @param {date} parameters.timePeriod.startDate The start date for the budget. + * + * @param {date} [parameters.timePeriod.endDate] The end date for the budget. + * If not provided, we default this to 10 years from the start date. + * + * @param {object} [parameters.filters] May be used to filter budgets by + * resource group, resource, or meter. + * + * @param {array} [parameters.filters.resourceGroups] The list of filters on + * resource groups, allowed at subscription level only. + * + * @param {array} [parameters.filters.resources] The list of filters on + * resources. + * + * @param {array} [parameters.filters.meters] The list of filters on meters + * (GUID), mandatory for budgets of usage category. + * + * @param {object} [parameters.filters.tags] The dictionary of filters on tags. + * + * @param {object} [parameters.notifications] Dictionary of notifications + * associated with the budget. Budget can have up to five notifications. + * + * @param {string} [parameters.eTag] eTag of the resource. To handle concurrent + * update scenarion, this field will be used to determine whether the user is + * updating the latest version or not. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(budgetName: string, parameters: models.Budget, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The operation to create or update a budget. Update operation requires latest + * eTag to be set in the request mandatorily. You may obtain the latest eTag by + * performing a get operation. Create operation does not require eTag. + * + * @param {string} budgetName Budget Name. + * + * @param {object} parameters Parameters supplied to the Create Budget + * operation. + * + * @param {string} parameters.category The category of the budget, whether the + * budget tracks cost or usage. Possible values include: 'Cost', 'Usage' + * + * @param {number} parameters.amount The total amount of cost to track with the + * budget + * + * @param {string} parameters.timeGrain The time covered by a budget. Tracking + * of the amount will be reset based on the time grain. Possible values + * include: 'Monthly', 'Quarterly', 'Annually' + * + * @param {object} parameters.timePeriod Has start and end date of the budget. + * The start date must be first of the month and should be less than the end + * date. Budget start date must be on or after June 1, 2017. Future start date + * should not be more than three months. Past start date should be selected + * within the timegrain preiod. There are no restrictions on the end date. + * + * @param {date} parameters.timePeriod.startDate The start date for the budget. + * + * @param {date} [parameters.timePeriod.endDate] The end date for the budget. + * If not provided, we default this to 10 years from the start date. + * + * @param {object} [parameters.filters] May be used to filter budgets by + * resource group, resource, or meter. + * + * @param {array} [parameters.filters.resourceGroups] The list of filters on + * resource groups, allowed at subscription level only. + * + * @param {array} [parameters.filters.resources] The list of filters on + * resources. + * + * @param {array} [parameters.filters.meters] The list of filters on meters + * (GUID), mandatory for budgets of usage category. + * + * @param {object} [parameters.filters.tags] The dictionary of filters on tags. + * + * @param {object} [parameters.notifications] Dictionary of notifications + * associated with the budget. Budget can have up to five notifications. + * + * @param {string} [parameters.eTag] eTag of the resource. To handle concurrent + * update scenarion, this field will be used to determine whether the user is + * updating the latest version or not. + * + * @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 {Budget} - 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. + * + * {Budget} [result] - The deserialized result object if an error did not occur. + * See {@link Budget} 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. + */ + createOrUpdate(budgetName: string, parameters: models.Budget, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(budgetName: string, parameters: models.Budget, callback: ServiceCallback): void; + createOrUpdate(budgetName: string, parameters: models.Budget, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The operation to delete a budget. + * + * @param {string} budgetName Budget Name. + * + * @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. + */ + deleteMethodWithHttpOperationResponse(budgetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The operation to delete a budget. + * + * @param {string} budgetName Budget Name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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. + */ + deleteMethod(budgetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(budgetName: string, callback: ServiceCallback): void; + deleteMethod(budgetName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the budget for a resource group under a subscription by budget name. + * + * @param {string} resourceGroupName Azure Resource Group Name. + * + * @param {string} budgetName Budget Name. + * + * @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. + */ + getByResourceGroupNameWithHttpOperationResponse(resourceGroupName: string, budgetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the budget for a resource group under a subscription by budget name. + * + * @param {string} resourceGroupName Azure Resource Group Name. + * + * @param {string} budgetName Budget Name. + * + * @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 {Budget} - 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. + * + * {Budget} [result] - The deserialized result object if an error did not occur. + * See {@link Budget} 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. + */ + getByResourceGroupName(resourceGroupName: string, budgetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getByResourceGroupName(resourceGroupName: string, budgetName: string, callback: ServiceCallback): void; + getByResourceGroupName(resourceGroupName: string, budgetName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The operation to create or update a budget. Update operation requires latest + * eTag to be set in the request mandatorily. You may obtain the latest eTag by + * performing a get operation. Create operation does not require eTag. + * + * @param {string} resourceGroupName Azure Resource Group Name. + * + * @param {string} budgetName Budget Name. + * + * @param {object} parameters Parameters supplied to the Create Budget + * operation. + * + * @param {string} parameters.category The category of the budget, whether the + * budget tracks cost or usage. Possible values include: 'Cost', 'Usage' + * + * @param {number} parameters.amount The total amount of cost to track with the + * budget + * + * @param {string} parameters.timeGrain The time covered by a budget. Tracking + * of the amount will be reset based on the time grain. Possible values + * include: 'Monthly', 'Quarterly', 'Annually' + * + * @param {object} parameters.timePeriod Has start and end date of the budget. + * The start date must be first of the month and should be less than the end + * date. Budget start date must be on or after June 1, 2017. Future start date + * should not be more than three months. Past start date should be selected + * within the timegrain preiod. There are no restrictions on the end date. + * + * @param {date} parameters.timePeriod.startDate The start date for the budget. + * + * @param {date} [parameters.timePeriod.endDate] The end date for the budget. + * If not provided, we default this to 10 years from the start date. + * + * @param {object} [parameters.filters] May be used to filter budgets by + * resource group, resource, or meter. + * + * @param {array} [parameters.filters.resourceGroups] The list of filters on + * resource groups, allowed at subscription level only. + * + * @param {array} [parameters.filters.resources] The list of filters on + * resources. + * + * @param {array} [parameters.filters.meters] The list of filters on meters + * (GUID), mandatory for budgets of usage category. + * + * @param {object} [parameters.filters.tags] The dictionary of filters on tags. + * + * @param {object} [parameters.notifications] Dictionary of notifications + * associated with the budget. Budget can have up to five notifications. + * + * @param {string} [parameters.eTag] eTag of the resource. To handle concurrent + * update scenarion, this field will be used to determine whether the user is + * updating the latest version or not. + * + * @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. + */ + createOrUpdateByResourceGroupNameWithHttpOperationResponse(resourceGroupName: string, budgetName: string, parameters: models.Budget, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The operation to create or update a budget. Update operation requires latest + * eTag to be set in the request mandatorily. You may obtain the latest eTag by + * performing a get operation. Create operation does not require eTag. + * + * @param {string} resourceGroupName Azure Resource Group Name. + * + * @param {string} budgetName Budget Name. + * + * @param {object} parameters Parameters supplied to the Create Budget + * operation. + * + * @param {string} parameters.category The category of the budget, whether the + * budget tracks cost or usage. Possible values include: 'Cost', 'Usage' + * + * @param {number} parameters.amount The total amount of cost to track with the + * budget + * + * @param {string} parameters.timeGrain The time covered by a budget. Tracking + * of the amount will be reset based on the time grain. Possible values + * include: 'Monthly', 'Quarterly', 'Annually' + * + * @param {object} parameters.timePeriod Has start and end date of the budget. + * The start date must be first of the month and should be less than the end + * date. Budget start date must be on or after June 1, 2017. Future start date + * should not be more than three months. Past start date should be selected + * within the timegrain preiod. There are no restrictions on the end date. + * + * @param {date} parameters.timePeriod.startDate The start date for the budget. + * + * @param {date} [parameters.timePeriod.endDate] The end date for the budget. + * If not provided, we default this to 10 years from the start date. + * + * @param {object} [parameters.filters] May be used to filter budgets by + * resource group, resource, or meter. + * + * @param {array} [parameters.filters.resourceGroups] The list of filters on + * resource groups, allowed at subscription level only. + * + * @param {array} [parameters.filters.resources] The list of filters on + * resources. + * + * @param {array} [parameters.filters.meters] The list of filters on meters + * (GUID), mandatory for budgets of usage category. + * + * @param {object} [parameters.filters.tags] The dictionary of filters on tags. + * + * @param {object} [parameters.notifications] Dictionary of notifications + * associated with the budget. Budget can have up to five notifications. + * + * @param {string} [parameters.eTag] eTag of the resource. To handle concurrent + * update scenarion, this field will be used to determine whether the user is + * updating the latest version or not. + * + * @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 {Budget} - 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. + * + * {Budget} [result] - The deserialized result object if an error did not occur. + * See {@link Budget} 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. + */ + createOrUpdateByResourceGroupName(resourceGroupName: string, budgetName: string, parameters: models.Budget, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdateByResourceGroupName(resourceGroupName: string, budgetName: string, parameters: models.Budget, callback: ServiceCallback): void; + createOrUpdateByResourceGroupName(resourceGroupName: string, budgetName: string, parameters: models.Budget, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The operation to delete a budget. + * + * @param {string} resourceGroupName Azure Resource Group Name. + * + * @param {string} budgetName Budget Name. + * + * @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. + */ + deleteByResourceGroupNameWithHttpOperationResponse(resourceGroupName: string, budgetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The operation to delete a budget. + * + * @param {string} resourceGroupName Azure Resource Group Name. + * + * @param {string} budgetName Budget Name. + * + * @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 {null} - 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {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. + */ + deleteByResourceGroupName(resourceGroupName: string, budgetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteByResourceGroupName(resourceGroupName: string, budgetName: string, callback: ServiceCallback): void; + deleteByResourceGroupName(resourceGroupName: string, budgetName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all budgets for a subscription. + * + * @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 all budgets for a subscription. + * + * @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 {BudgetsListResult} - 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. + * + * {BudgetsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link BudgetsListResult} 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 all budgets for a resource group under a subscription. + * + * @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. + */ + listByResourceGroupNameNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all budgets for a resource group under a subscription. + * + * @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 {BudgetsListResult} - 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. + * + * {BudgetsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link BudgetsListResult} 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. + */ + listByResourceGroupNameNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNameNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNameNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @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 + * CostTags + * __NOTE__: An instance of this class is automatically created for an + * instance of the ConsumptionManagementClient. + */ +export interface CostTags { + + + /** + * Get cost tags for a billing account. + * + * @param {string} billingAccountId BillingAccount ID + * + * @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. + */ + getWithHttpOperationResponse(billingAccountId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get cost tags for a billing account. + * + * @param {string} billingAccountId BillingAccount ID + * + * @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 {CostTag} - 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. + * + * {CostTag} [result] - The deserialized result object if an error did not occur. + * See {@link CostTag} 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(billingAccountId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(billingAccountId: string, callback: ServiceCallback): void; + get(billingAccountId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The operation to create or update cost tags assiciated with a billing + * account. Update operation requires latest eTag to be set in the request + * mandatorily. You may obtain the latest eTag by performing a get operation. + * Create operation does not require eTag. + * + * @param {string} billingAccountId BillingAccount ID + * + * @param {object} parameters Parameters supplied to the Create cost tags + * operation. + * + * @param {array} [parameters.costTags] Cost tags. + * + * @param {string} [parameters.eTag] eTag of the resource. To handle concurrent + * update scenarion, this field will be used to determine whether the user is + * updating the latest version or not. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(billingAccountId: string, parameters: models.CostTag, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The operation to create or update cost tags assiciated with a billing + * account. Update operation requires latest eTag to be set in the request + * mandatorily. You may obtain the latest eTag by performing a get operation. + * Create operation does not require eTag. + * + * @param {string} billingAccountId BillingAccount ID + * + * @param {object} parameters Parameters supplied to the Create cost tags + * operation. + * + * @param {array} [parameters.costTags] Cost tags. + * + * @param {string} [parameters.eTag] eTag of the resource. To handle concurrent + * update scenarion, this field will be used to determine whether the user is + * updating the latest version or not. + * + * @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 {CostTag} - 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. + * + * {CostTag} [result] - The deserialized result object if an error did not occur. + * See {@link CostTag} 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. + */ + createOrUpdate(billingAccountId: string, parameters: models.CostTag, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(billingAccountId: string, parameters: models.CostTag, callback: ServiceCallback): void; + createOrUpdate(billingAccountId: string, parameters: models.CostTag, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Tags + * __NOTE__: An instance of this class is automatically created for an + * instance of the ConsumptionManagementClient. + */ +export interface Tags { + + + /** + * Get all available tag keys for a billing account. + * + * @param {string} billingAccountId BillingAccount ID + * + * @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. + */ + getWithHttpOperationResponse(billingAccountId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get all available tag keys for a billing account. + * + * @param {string} billingAccountId BillingAccount ID + * + * @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 {TagsResult} - 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. + * + * {TagsResult} [result] - The deserialized result object if an error did not occur. + * See {@link TagsResult} 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(billingAccountId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(billingAccountId: string, callback: ServiceCallback): void; + get(billingAccountId: 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 483623b162..092ae808a1 100644 --- a/lib/services/consumptionManagement/lib/operations/index.js +++ b/lib/services/consumptionManagement/lib/operations/index.js @@ -14,7 +14,15 @@ 'use strict'; -exports.PriceSheet = require('./priceSheet'); exports.UsageDetails = require('./usageDetails'); +exports.Marketplaces = require('./marketplaces'); +exports.Balances = require('./balances'); +exports.ReservationsSummaries = require('./reservationsSummaries'); +exports.ReservationsDetails = require('./reservationsDetails'); +exports.ReservationRecommendations = require('./reservationRecommendations'); +exports.Budgets = require('./budgets'); +exports.PriceSheet = require('./priceSheet'); +exports.CostTags = require('./costTags'); +exports.Tags = require('./tags'); exports.Forecasts = require('./forecasts'); exports.Operations = require('./operations'); diff --git a/lib/services/consumptionManagement/lib/operations/marketplaces.js b/lib/services/consumptionManagement/lib/operations/marketplaces.js index f0ef834b31..d5716af463 100644 --- a/lib/services/consumptionManagement/lib/operations/marketplaces.js +++ b/lib/services/consumptionManagement/lib/operations/marketplaces.js @@ -384,15 +384,28 @@ function _listByBillingPeriod(billingPeriodName, options, callback) { } /** - * Lists the marketplaces for a scope by subscriptionId and current billing + * Lists the marketplaces for a scope by billingAccountId and current billing * period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {object} [options.customHeaders] Headers that will be added to the * request * @@ -410,7 +423,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') { @@ -420,10 +433,35 @@ function _listNext(nextPageLink, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skiptoken = (options && options.skiptoken !== undefined) ? options.skiptoken : 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 (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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 (skiptoken !== null && skiptoken !== undefined && typeof skiptoken.valueOf() !== 'string') { + throw new Error('skiptoken must be of type string.'); + } + 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 (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 (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.'); @@ -433,8 +471,23 @@ function _listNext(nextPageLink, options, callback) { } // 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/marketplaces'; + requestUrl = requestUrl.replace('{billingAccountId}', encodeURIComponent(billingAccountId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skiptoken !== null && skiptoken !== undefined) { + queryParameters.push('$skiptoken=' + encodeURIComponent(skiptoken)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } // Create HTTP transport objects let httpRequest = new WebResource(); @@ -515,14 +568,29 @@ function _listNext(nextPageLink, options, callback) { } /** - * Lists the marketplaces for a scope by billing period and subscripotionId. + * Lists the marketplaces for a scope by billing period and billingAccountId. * Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {object} [options.customHeaders] Headers that will be added to the * request * @@ -540,7 +608,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') { @@ -550,10 +618,38 @@ function _listByBillingPeriodNext(nextPageLink, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skiptoken = (options && options.skiptoken !== undefined) ? options.skiptoken : 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 (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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 (skiptoken !== null && skiptoken !== undefined && typeof skiptoken.valueOf() !== 'string') { + throw new Error('skiptoken must be of type string.'); + } + 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 (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 (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.'); @@ -563,8 +659,24 @@ function _listByBillingPeriodNext(nextPageLink, options, callback) { } // 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/marketplaces'; + requestUrl = requestUrl.replace('{billingAccountId}', encodeURIComponent(billingAccountId)); + requestUrl = requestUrl.replace('{billingPeriodName}', encodeURIComponent(billingPeriodName)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skiptoken !== null && skiptoken !== undefined) { + queryParameters.push('$skiptoken=' + encodeURIComponent(skiptoken)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } // Create HTTP transport objects let httpRequest = new WebResource(); @@ -644,40 +756,3019 @@ function _listByBillingPeriodNext(nextPageLink, options, callback) { }); } -/** Class representing a Marketplaces. */ -class Marketplaces { +/** + * Lists the marketplaces for a scope by departmentId and current billing + * period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 MarketplacesListResult} 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 filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skiptoken = (options && options.skiptoken !== undefined) ? options.skiptoken : undefined; + // Validate + try { + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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 (skiptoken !== null && skiptoken !== undefined && typeof skiptoken.valueOf() !== 'string') { + throw new Error('skiptoken must be of type string.'); + } + 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 (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 (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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Consumption/marketplaces'; + requestUrl = requestUrl.replace('{departmentId}', encodeURIComponent(departmentId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skiptoken !== null && skiptoken !== undefined) { + queryParameters.push('$skiptoken=' + encodeURIComponent(skiptoken)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + 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['MarketplacesListResult']().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 marketplaces for a scope by billing period and departmentId. + * Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 MarketplacesListResult} 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 filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skiptoken = (options && options.skiptoken !== undefined) ? options.skiptoken : undefined; + // Validate + try { + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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 (skiptoken !== null && skiptoken !== undefined && typeof skiptoken.valueOf() !== 'string') { + throw new Error('skiptoken must be of type string.'); + } + 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 (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 (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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/marketplaces'; + requestUrl = requestUrl.replace('{departmentId}', encodeURIComponent(departmentId)); + requestUrl = requestUrl.replace('{billingPeriodName}', encodeURIComponent(billingPeriodName)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skiptoken !== null && skiptoken !== undefined) { + queryParameters.push('$skiptoken=' + encodeURIComponent(skiptoken)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + 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['MarketplacesListResult']().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 marketplaces for a scope by enrollmentAccountId and current + * billing period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 MarketplacesListResult} 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 filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skiptoken = (options && options.skiptoken !== undefined) ? options.skiptoken : undefined; + // Validate + try { + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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 (skiptoken !== null && skiptoken !== undefined && typeof skiptoken.valueOf() !== 'string') { + throw new Error('skiptoken must be of type string.'); + } + 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 (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 (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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Consumption/marketplaces'; + requestUrl = requestUrl.replace('{enrollmentAccountId}', encodeURIComponent(enrollmentAccountId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skiptoken !== null && skiptoken !== undefined) { + queryParameters.push('$skiptoken=' + encodeURIComponent(skiptoken)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + 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['MarketplacesListResult']().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 marketplaces for a scope by billing period and + * enrollmentAccountId. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 MarketplacesListResult} 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 filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skiptoken = (options && options.skiptoken !== undefined) ? options.skiptoken : undefined; + // Validate + try { + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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 (skiptoken !== null && skiptoken !== undefined && typeof skiptoken.valueOf() !== 'string') { + throw new Error('skiptoken must be of type string.'); + } + 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 (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 (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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/marketplaces'; + requestUrl = requestUrl.replace('{enrollmentAccountId}', encodeURIComponent(enrollmentAccountId)); + requestUrl = requestUrl.replace('{billingPeriodName}', encodeURIComponent(billingPeriodName)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skiptoken !== null && skiptoken !== undefined) { + queryParameters.push('$skiptoken=' + encodeURIComponent(skiptoken)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + 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['MarketplacesListResult']().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 marketplaces for a scope by subscriptionId and current billing + * period. Marketplaces 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 MarketplacesListResult} 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['MarketplacesListResult']().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 marketplaces for a scope by billing period and subscripotionId. + * Marketplaces 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 MarketplacesListResult} 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['MarketplacesListResult']().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 marketplaces for a scope by billingAccountId and current billing + * period. Marketplaces 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 MarketplacesListResult} 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['MarketplacesListResult']().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 marketplaces for a scope by billing period and billingAccountId. + * Marketplaces 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 MarketplacesListResult} 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['MarketplacesListResult']().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 marketplaces for a scope by departmentId and current billing + * period. Marketplaces 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 MarketplacesListResult} 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['MarketplacesListResult']().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 marketplaces for a scope by billing period and departmentId. + * Marketplaces 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 MarketplacesListResult} 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['MarketplacesListResult']().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 marketplaces for a scope by enrollmentAccountId and current + * billing period. Marketplaces 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 MarketplacesListResult} 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['MarketplacesListResult']().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 marketplaces for a scope by billing period and + * enrollmentAccountId. Marketplaces 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 MarketplacesListResult} 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['MarketplacesListResult']().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 Marketplaces. */ +class Marketplaces { + /** + * Create a Marketplaces. + * @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 marketplaces for a scope by subscriptionId and current billing + * period. Marketplaces are available via this API only for May 1, 2014 or + * later. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 marketplaces for a scope by subscriptionId and current billing + * period. Marketplaces are available via this API only for May 1, 2014 or + * later. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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 MarketplacesListResult} 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 marketplaces for a scope by billing period and subscripotionId. + * Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 marketplaces for a scope by billing period and subscripotionId. + * Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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 MarketplacesListResult} 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 marketplaces for a scope by billingAccountId and current billing + * period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 marketplaces for a scope by billingAccountId and current billing + * period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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 MarketplacesListResult} 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 marketplaces for a scope by billing period and billingAccountId. + * Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 marketplaces for a scope by billing period and billingAccountId. + * Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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 MarketplacesListResult} 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 marketplaces for a scope by departmentId and current billing + * period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 marketplaces for a scope by departmentId and current billing + * period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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 MarketplacesListResult} 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 marketplaces for a scope by billing period and departmentId. + * Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 marketplaces for a scope by billing period and departmentId. + * Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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 MarketplacesListResult} 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 marketplaces for a scope by enrollmentAccountId and current + * billing period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 marketplaces for a scope by enrollmentAccountId and current + * billing period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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 MarketplacesListResult} 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 marketplaces for a scope by billing period and + * enrollmentAccountId. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 marketplaces for a scope by billing period and + * enrollmentAccountId. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * + * @param {number} [options.top] May be used to limit the number of results to + * the most recent N marketplaces. + * + * @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 {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 {MarketplacesListResult} - 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 MarketplacesListResult} 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 marketplaces for a scope by subscriptionId and current billing + * period. Marketplaces 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 marketplaces for a scope by subscriptionId and current billing + * period. Marketplaces 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 {MarketplacesListResult} - 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 MarketplacesListResult} 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 marketplaces for a scope by billing period and subscripotionId. + * Marketplaces 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 marketplaces for a scope by billing period and subscripotionId. + * Marketplaces 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 {MarketplacesListResult} - 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 MarketplacesListResult} 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); + } + } + /** - * Create a Marketplaces. - * @param {ConsumptionManagementClient} client Reference to the service client. + * Lists the marketplaces for a scope by billingAccountId and current billing + * period. Marketplaces 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. */ - constructor(client) { - this.client = client; - this._list = _list; - this._listByBillingPeriod = _listByBillingPeriod; - this._listNext = _listNext; - this._listByBillingPeriodNext = _listByBillingPeriodNext; + 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 marketplaces for a scope by subscriptionId and current billing + * Lists the marketplaces for a scope by billingAccountId and current billing * period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {number} [options.top] May be used to limit the number of results to - * the most recent N marketplaces. + * @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. + * + * {Promise} A promise is returned + * + * @resolve {MarketplacesListResult} - 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 MarketplacesListResult} 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 marketplaces for a scope by billing period and billingAccountId. + * Marketplaces 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 @@ -688,11 +3779,11 @@ class Marketplaces { * * @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); } @@ -703,25 +3794,102 @@ class Marketplaces { } /** - * Lists the marketplaces for a scope by subscriptionId and current billing + * Lists the marketplaces for a scope by billing period and billingAccountId. + * Marketplaces 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 {MarketplacesListResult} - 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 MarketplacesListResult} 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. + */ + listForBillingPeriodByBillingAccountNext(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._listForBillingPeriodByBillingAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listForBillingPeriodByBillingAccountNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing * period. Marketplaces 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.filter] May be used to filter marketplaces 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'. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {number} [options.top] May be used to limit the number of results to - * the most recent N marketplaces. + * @returns {Promise} A promise is returned * - * @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. + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByDepartmentNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDepartmentNext(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 marketplaces for a scope by departmentId and current billing + * period. Marketplaces 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 @@ -749,7 +3917,7 @@ class Marketplaces { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - list(options, optionalCallback) { + listByDepartmentNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -758,39 +3926,26 @@ class Marketplaces { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { + self._listByDepartmentNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._list(options, optionalCallback); + return self._listByDepartmentNext(nextPageLink, options, optionalCallback); } } /** - * Lists the marketplaces for a scope by billing period and subscripotionId. + * Lists the marketplaces for a scope by billing period and departmentId. * Marketplaces 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.filter] May be used to filter marketplaces 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'. - * - * @param {number} [options.top] May be used to limit the number of results to - * the most recent N marketplaces. - * - * @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 {object} [options.customHeaders] Headers that will be added to the * request * @@ -800,11 +3955,11 @@ class Marketplaces { * * @reject {Error} - The error object. */ - listByBillingPeriodWithHttpOperationResponse(billingPeriodName, options) { + listForBillingPeriodByDepartmentNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listByBillingPeriod(billingPeriodName, options, (err, result, request, response) => { + self._listForBillingPeriodByDepartmentNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -815,27 +3970,14 @@ class Marketplaces { } /** - * Lists the marketplaces for a scope by billing period and subscripotionId. + * Lists the marketplaces for a scope by billing period and departmentId. * Marketplaces 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.filter] May be used to filter marketplaces 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'. - * - * @param {number} [options.top] May be used to limit the number of results to - * the most recent N marketplaces. - * - * @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 {object} [options.customHeaders] Headers that will be added to the * request * @@ -862,7 +4004,7 @@ class Marketplaces { * * {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') { @@ -871,21 +4013,21 @@ class Marketplaces { } 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 marketplaces for a scope by subscriptionId and current billing - * period. Marketplaces are available via this API only for May 1, 2014 or - * later. + * Lists the marketplaces for a scope by enrollmentAccountId and current + * billing period. Marketplaces 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. @@ -901,11 +4043,11 @@ class Marketplaces { * * @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); } @@ -916,9 +4058,9 @@ class Marketplaces { } /** - * Lists the marketplaces for a scope by subscriptionId and current billing - * period. Marketplaces are available via this API only for May 1, 2014 or - * later. + * Lists the marketplaces for a scope by enrollmentAccountId and current + * billing period. Marketplaces 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. @@ -951,7 +4093,7 @@ class Marketplaces { * * {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') { @@ -960,20 +4102,21 @@ class Marketplaces { } 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 marketplaces for a scope by billing period and subscripotionId. - * Marketplaces are available via this API only for May 1, 2014 or later. + * Lists the marketplaces for a scope by billing period and + * enrollmentAccountId. Marketplaces 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. @@ -989,11 +4132,11 @@ class Marketplaces { * * @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); } @@ -1004,8 +4147,9 @@ class Marketplaces { } /** - * Lists the marketplaces for a scope by billing period and subscripotionId. - * Marketplaces are available via this API only for May 1, 2014 or later. + * Lists the marketplaces for a scope by billing period and + * enrollmentAccountId. Marketplaces 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. @@ -1038,7 +4182,7 @@ class Marketplaces { * * {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') { @@ -1047,14 +4191,14 @@ class Marketplaces { } 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); } } diff --git a/lib/services/consumptionManagement/lib/operations/reservationRecommendations.js b/lib/services/consumptionManagement/lib/operations/reservationRecommendations.js new file mode 100644 index 0000000000..89a5db3632 --- /dev/null +++ b/lib/services/consumptionManagement/lib/operations/reservationRecommendations.js @@ -0,0 +1,478 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * List of recomendations for purchasing reserved instances. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] May be used to filter + * reservationRecommendations by properties/scope and + * properties/lookBackPeriod. + * + * @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 ReservationRecommendationsListResult} 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 _list(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 filter = (options && options.filter !== undefined) ? options.filter : undefined; + // Validate + try { + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + 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.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId 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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Consumption/reservationRecommendations'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + 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['ReservationRecommendationsListResult']().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); + }); +} + +/** + * List of recomendations for purchasing reserved instances. + * + * @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 ReservationRecommendationsListResult} 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['ReservationRecommendationsListResult']().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 ReservationRecommendations. */ +class ReservationRecommendations { + /** + * Create a ReservationRecommendations. + * @param {ConsumptionManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * List of recomendations for purchasing reserved instances. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] May be used to filter + * reservationRecommendations by properties/scope and + * properties/lookBackPeriod. + * + * @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; + }); + }); + } + + /** + * List of recomendations for purchasing reserved instances. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] May be used to filter + * reservationRecommendations by properties/scope and + * properties/lookBackPeriod. + * + * @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 {ReservationRecommendationsListResult} - 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 ReservationRecommendationsListResult} 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); + } + } + + /** + * List of recomendations for purchasing reserved instances. + * + * @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; + }); + }); + } + + /** + * List of recomendations for purchasing reserved instances. + * + * @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 {ReservationRecommendationsListResult} - 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 ReservationRecommendationsListResult} 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); + } + } + +} + +module.exports = ReservationRecommendations; diff --git a/lib/services/consumptionManagement/lib/operations/tags.js b/lib/services/consumptionManagement/lib/operations/tags.js new file mode 100644 index 0000000000..cd32865e9c --- /dev/null +++ b/lib/services/consumptionManagement/lib/operations/tags.js @@ -0,0 +1,248 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Get all available tag keys for a billing account. + * + * @param {string} billingAccountId BillingAccount ID + * + * @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 TagsResult} 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 _get(billingAccountId, 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 (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 (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 (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 baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.CostManagement/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/tags'; + requestUrl = requestUrl.replace('{billingAccountId}', encodeURIComponent(billingAccountId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + 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['TagsResult']().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 Tags. */ +class Tags { + /** + * Create a Tags. + * @param {ConsumptionManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + } + + /** + * Get all available tag keys for a billing account. + * + * @param {string} billingAccountId BillingAccount ID + * + * @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. + */ + getWithHttpOperationResponse(billingAccountId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(billingAccountId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get all available tag keys for a billing account. + * + * @param {string} billingAccountId BillingAccount ID + * + * @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 {TagsResult} - 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 TagsResult} 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. + */ + get(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._get(billingAccountId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(billingAccountId, options, optionalCallback); + } + } + +} + +module.exports = Tags;