Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
[AutoPR consumption/resource-manager] Added new api versions for Pric…
Browse files Browse the repository at this point in the history
…eSheet and UsageDetail (#2951)

* Generated from 0f5512a3c534b877d238e57f41c9f0ef21a38119

Added new api versions for PriceSheet and UsageDetail

* Generated from 900a52724a80781934651db97154547762681c5e

consolidating the operation groups based on code review.
  • Loading branch information
AutorestCI authored Jun 11, 2018
1 parent d9fe641 commit 0914101
Show file tree
Hide file tree
Showing 10 changed files with 5,489 additions and 163 deletions.
8 changes: 5 additions & 3 deletions lib/services/consumptionManagement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@ npm install azure-arm-consumption

## How to use

### Authentication, client creation and list forecasts as an example.
### Authentication, client creation and get priceSheet as an example.

```javascript
const msRestAzure = require("ms-rest-azure");
const ConsumptionManagementClient = require("azure-arm-consumption");
msRestAzure.interactiveLogin().then((creds) => {
const subscriptionId = "<Subscription_Id>";
const client = new ConsumptionManagementClient(creds, subscriptionId);
const filter = "testfilter";
return client.forecasts.list(filter).then((result) => {
const expand = "testexpand";
const skiptoken = "testskiptoken";
const top = 1;
return client.priceSheet.get(expand, skiptoken, top).then((result) => {
console.log("The result is:");
console.log(result);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export default class ConsumptionManagementClient extends AzureServiceClient {
generateClientRequestId: boolean;

// Operation groups
priceSheet: operations.PriceSheet;
usageDetails: operations.UsageDetails;
forecasts: operations.Forecasts;
operations: operations.Operations;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class ConsumptionManagementClient extends ServiceClient {
if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) {
this.generateClientRequestId = options.generateClientRequestId;
}
this.priceSheet = new operations.PriceSheet(this);
this.usageDetails = new operations.UsageDetails(this);
this.forecasts = new operations.Forecasts(this);
this.operations = new operations.Operations(this);
this.models = models;
Expand Down
199 changes: 199 additions & 0 deletions lib/services/consumptionManagement/lib/models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,93 @@ export interface Resource extends BaseResource {
readonly tags?: { [propertyName: string]: string };
}

/**
* @class
* Initializes a new instance of the MeterDetails class.
* @constructor
* The properties of the meter detail.
*
* @member {string} [meterName] The name of the meter, within the given meter
* category
* @member {string} [meterCategory] The category of the meter, for example,
* 'Cloud services', 'Networking', etc..
* @member {string} [meterSubCategory] The subcategory of the meter, for
* example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc..
* @member {string} [unit] The unit in which the meter consumption is charged,
* for example, 'Hours', 'GB', etc.
* @member {string} [meterLocation] The location in which the Azure service is
* available.
* @member {number} [totalIncludedQuantity] The total included quantity
* associated with the offer.
* @member {number} [pretaxStandardRate] The pretax listing price.
*/
export interface MeterDetails {
readonly meterName?: string;
readonly meterCategory?: string;
readonly meterSubCategory?: string;
readonly unit?: string;
readonly meterLocation?: string;
readonly totalIncludedQuantity?: number;
readonly pretaxStandardRate?: number;
}

/**
* @class
* Initializes a new instance of the PriceSheetProperties class.
* @constructor
* The properties of the price sheet.
*
* @member {string} [billingPeriodId] The id of the billing period resource
* that the usage belongs to.
* @member {uuid} [meterId] The meter id (GUID)
* @member {object} [meterDetails] The details about the meter. By default this
* is not populated, unless it's specified in $expand.
* @member {string} [meterDetails.meterName] The name of the meter, within the
* given meter category
* @member {string} [meterDetails.meterCategory] The category of the meter, for
* example, 'Cloud services', 'Networking', etc..
* @member {string} [meterDetails.meterSubCategory] The subcategory of the
* meter, for example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc..
* @member {string} [meterDetails.unit] The unit in which the meter consumption
* is charged, for example, 'Hours', 'GB', etc.
* @member {string} [meterDetails.meterLocation] The location in which the
* Azure service is available.
* @member {number} [meterDetails.totalIncludedQuantity] The total included
* quantity associated with the offer.
* @member {number} [meterDetails.pretaxStandardRate] The pretax listing price.
* @member {string} [unitOfMeasure] Unit of measure
* @member {number} [includedQuantity] Included quality for an offer
* @member {string} [partNumber] Part Number
* @member {number} [unitPrice] Unit Price
* @member {string} [currencyCode] Currency Code
* @member {string} [offerId] Offer Id
*/
export interface PriceSheetProperties {
readonly billingPeriodId?: string;
readonly meterId?: string;
readonly meterDetails?: MeterDetails;
readonly unitOfMeasure?: string;
readonly includedQuantity?: number;
readonly partNumber?: string;
readonly unitPrice?: number;
readonly currencyCode?: string;
readonly offerId?: string;
}

/**
* @class
* Initializes a new instance of the PriceSheetResult class.
* @constructor
* An pricesheet resource.
*
* @member {array} [pricesheets] Price sheet
* @member {string} [nextLink] The link (url) to the next page of results.
*/
export interface PriceSheetResult extends Resource {
readonly pricesheets?: PriceSheetProperties[];
readonly nextLink?: string;
}

/**
* @class
* Initializes a new instance of the ForecastPropertiesConfidenceLevelsItem class.
Expand Down Expand Up @@ -142,6 +229,118 @@ export interface Forecast extends Resource {
readonly confidenceLevels?: ForecastPropertiesConfidenceLevelsItem[];
}

/**
* @class
* Initializes a new instance of the UsageDetail class.
* @constructor
* An usage detail resource.
*
* @member {string} [billingPeriodId] The id of the billing period resource
* that the usage belongs to.
* @member {string} [invoiceId] The id of the invoice resource that the usage
* belongs to.
* @member {date} [usageStart] The start of the date time range covered by the
* usage detail.
* @member {date} [usageEnd] The end of the date time range covered by the
* usage detail.
* @member {string} [instanceName] The name of the resource instance that the
* usage is about.
* @member {string} [instanceId] The uri of the resource instance that the
* usage is about.
* @member {string} [instanceLocation] The location of the resource instance
* that the usage is about.
* @member {string} [currency] The ISO currency in which the meter is charged,
* for example, USD.
* @member {number} [usageQuantity] The quantity of usage.
* @member {number} [billableQuantity] The billable usage quantity.
* @member {number} [pretaxCost] The amount of cost before tax.
* @member {boolean} [isEstimated] The estimated usage is subject to change.
* @member {uuid} [meterId] The meter id (GUID).
* @member {object} [meterDetails] The details about the meter. By default this
* is not populated, unless it's specified in $expand.
* @member {string} [meterDetails.meterName] The name of the meter, within the
* given meter category
* @member {string} [meterDetails.meterCategory] The category of the meter, for
* example, 'Cloud services', 'Networking', etc..
* @member {string} [meterDetails.meterSubCategory] The subcategory of the
* meter, for example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc..
* @member {string} [meterDetails.unit] The unit in which the meter consumption
* is charged, for example, 'Hours', 'GB', etc.
* @member {string} [meterDetails.meterLocation] The location in which the
* Azure service is available.
* @member {number} [meterDetails.totalIncludedQuantity] The total included
* quantity associated with the offer.
* @member {number} [meterDetails.pretaxStandardRate] The pretax listing price.
* @member {uuid} [subscriptionGuid] Subscription guid.
* @member {string} [subscriptionName] Subscription name.
* @member {string} [accountName] Account name.
* @member {string} [departmentName] Department name.
* @member {string} [product] Product name.
* @member {string} [consumedService] Consumed service name.
* @member {string} [costCenter] The cost center of this department if it is a
* department and a costcenter exists
* @member {string} [partNumber] Part Number
* @member {string} [resourceGuid] Resource Guid
* @member {string} [offerId] Offer Id
* @member {boolean} [chargesBilledSeparately] Charges billed separately
* @member {string} [additionalProperties] Additional details of this usage
* item. By default this is not populated, unless it's specified in $expand.
*/
export interface UsageDetail extends Resource {
readonly billingPeriodId?: string;
readonly invoiceId?: string;
readonly usageStart?: Date;
readonly usageEnd?: Date;
readonly instanceName?: string;
readonly instanceId?: string;
readonly instanceLocation?: string;
readonly currency?: string;
readonly usageQuantity?: number;
readonly billableQuantity?: number;
readonly pretaxCost?: number;
readonly isEstimated?: boolean;
readonly meterId?: string;
readonly meterDetails?: MeterDetails;
readonly subscriptionGuid?: string;
readonly subscriptionName?: string;
readonly accountName?: string;
readonly departmentName?: string;
readonly product?: string;
readonly consumedService?: string;
readonly costCenter?: string;
readonly partNumber?: string;
readonly resourceGuid?: string;
readonly offerId?: string;
readonly chargesBilledSeparately?: boolean;
readonly additionalProperties?: string;
}

/**
* @class
* Initializes a new instance of the QueryOptions class.
* @constructor
* Additional parameters for a set of operations.
*
* @member {string} [apply] OData apply expression to aggregate usageDetails by
* tags or (tags and properties/usageStart)
*/
export interface QueryOptions {
apply?: string;
}


/**
* @class
* Initializes a new instance of the UsageDetailsListResult class.
* @constructor
* Result of listing usage details. It contains a list of available usage
* details in reverse chronological order by billing period.
*
* @member {string} [nextLink] The link (url) to the next page of results.
*/
export interface UsageDetailsListResult extends Array<UsageDetail> {
readonly nextLink?: string;
}

/**
* @class
Expand Down
6 changes: 6 additions & 0 deletions lib/services/consumptionManagement/lib/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ exports.ErrorResponse = require('./errorResponse');
exports.OperationDisplay = require('./operationDisplay');
exports.Operation = require('./operation');
exports.Resource = require('./resource');
exports.MeterDetails = require('./meterDetails');
exports.PriceSheetProperties = require('./priceSheetProperties');
exports.PriceSheetResult = require('./priceSheetResult');
exports.ForecastPropertiesConfidenceLevelsItem = require('./forecastPropertiesConfidenceLevelsItem');
exports.Forecast = require('./forecast');
exports.UsageDetail = require('./usageDetail');
exports.QueryOptions = require('./queryOptions');
exports.UsageDetailsListResult = require('./usageDetailsListResult');
exports.ForecastsListResult = require('./forecastsListResult');
exports.OperationListResult = require('./operationListResult');
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class PriceSheetProperties {
* @member {string} [partNumber] Part Number
* @member {number} [unitPrice] Unit Price
* @member {string} [currencyCode] Currency Code
* @member {string} [offerId] Offer Id
*/
constructor() {
}
Expand Down Expand Up @@ -125,6 +126,14 @@ class PriceSheetProperties {
type: {
name: 'String'
}
},
offerId: {
required: false,
readOnly: true,
serializedName: 'offerId',
type: {
name: 'String'
}
}
}
}
Expand Down
36 changes: 36 additions & 0 deletions lib/services/consumptionManagement/lib/models/usageDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ class UsageDetail extends models['Resource'] {
* @member {string} [consumedService] Consumed service name.
* @member {string} [costCenter] The cost center of this department if it is
* a department and a costcenter exists
* @member {string} [partNumber] Part Number
* @member {string} [resourceGuid] Resource Guid
* @member {string} [offerId] Offer Id
* @member {boolean} [chargesBilledSeparately] Charges billed separately
* @member {string} [additionalProperties] Additional details of this usage
* item. By default this is not populated, unless it's specified in $expand.
*/
Expand Down Expand Up @@ -294,6 +298,38 @@ class UsageDetail extends models['Resource'] {
name: 'String'
}
},
partNumber: {
required: false,
readOnly: true,
serializedName: 'properties.partNumber',
type: {
name: 'String'
}
},
resourceGuid: {
required: false,
readOnly: true,
serializedName: 'properties.resourceGuid',
type: {
name: 'String'
}
},
offerId: {
required: false,
readOnly: true,
serializedName: 'properties.offerId',
type: {
name: 'String'
}
},
chargesBilledSeparately: {
required: false,
readOnly: true,
serializedName: 'properties.chargesBilledSeparately',
type: {
name: 'Boolean'
}
},
additionalProperties: {
required: false,
readOnly: true,
Expand Down
Loading

0 comments on commit 0914101

Please sign in to comment.