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] Adding new properties to Consum…
Browse files Browse the repository at this point in the history
…ption 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.
  • Loading branch information
AutorestCI authored Jul 12, 2018
1 parent 0914101 commit 62f11c4
Show file tree
Hide file tree
Showing 25 changed files with 9,748 additions and 454 deletions.
6 changes: 4 additions & 2 deletions lib/services/consumptionManagement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -27,9 +27,11 @@ msRestAzure.interactiveLogin().then((creds) => {
const subscriptionId = "<Subscription_Id>";
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);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
53 changes: 48 additions & 5 deletions lib/services/consumptionManagement/lib/models/costTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand All @@ -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'
}
}
}
}
}
}
Expand Down
52 changes: 52 additions & 0 deletions lib/services/consumptionManagement/lib/models/costTagProperties.js
Original file line number Diff line number Diff line change
@@ -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;
95 changes: 95 additions & 0 deletions lib/services/consumptionManagement/lib/models/costTagsResult.js
Original file line number Diff line number Diff line change
@@ -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;
Loading

0 comments on commit 62f11c4

Please sign in to comment.