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

Commit

Permalink
Merge pull request #2700 from Azure/restapi_auto_consumption/resource…
Browse files Browse the repository at this point in the history
…-manager

[AutoPR] consumption/resource-manager
  • Loading branch information
Dan Schulte authored Jul 26, 2018
2 parents a834d97 + aaa4d87 commit 2b2fbe4
Show file tree
Hide file tree
Showing 93 changed files with 35,068 additions and 483 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
21 changes: 21 additions & 0 deletions lib/services/consumptionManagement/lib/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2018 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ export default class ConsumptionManagementClient extends AzureServiceClient {
*
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
*
* @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response.
* @param {string} [options.acceptLanguage] - The preferred language for the response.
*
* @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
* @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30.
*
* @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
* @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*
*/
constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions);
Expand All @@ -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 @@ -34,9 +34,9 @@ class ConsumptionManagementClient extends ServiceClient {
* @param {object} [options.requestOptions] - Options for the underlying request object
* {@link https://github.com/request/request#requestoptions-callback Options doc}
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
* @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response.
* @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
* @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
* @param {string} [options.acceptLanguage] - The preferred language for the response.
* @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30.
* @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*/
constructor(credentials, subscriptionId, baseUri, options) {
if (credentials === null || credentials === undefined) {
Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* 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.
*/

import { ServiceClientCredentials } from 'ms-rest';
import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure';
import * as models from "./models";
import * as operations from "./operations";

export default class ConsumptionManagementClient extends AzureServiceClient {
/**
* Initializes a new instance of the ConsumptionManagementClient class.
* @constructor
*
* @class
* @param {credentials} credentials - Credentials needed for the client to connect to Azure.
*
* @param {string} subscriptionId - Azure Subscription ID.
*
* @param {string} [baseUri] - The base URI of the service.
*
* @param {object} [options] - The parameter options
*
* @param {Array} [options.filters] - Filters to be added to the request pipeline
*
* @param {object} [options.requestOptions] - Options for the underlying request object
* {@link https://github.com/request/request#requestoptions-callback Options doc}
*
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
*
* @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response.
*
* @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
*
* @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*
*/
constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions);

credentials: ServiceClientCredentials;

apiVersion: string;

subscriptionId: string;

acceptLanguage: string;

longRunningOperationRetryTimeout: number;

generateClientRequestId: boolean;

// Operation groups
usageDetails: operations.UsageDetails;
marketplaces: operations.Marketplaces;
reservationsSummaries: operations.ReservationsSummaries;
reservationsDetails: operations.ReservationsDetails;
reservationRecommendationsOperations: operations.ReservationRecommendationsOperations;
budgets: operations.Budgets;
operations: operations.Operations;
priceSheet: operations.PriceSheet;
costAllocationTagsOperations: operations.CostAllocationTagsOperations;
}

export { ConsumptionManagementClient, models as ConsumptionManagementModels };
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* 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.
*/

/* jshint latedef:false */
/* jshint forin:false */
/* jshint noempty:false */

'use strict';

const msRest = require('ms-rest');
const msRestAzure = require('ms-rest-azure');
const ServiceClient = msRestAzure.AzureServiceClient;

const models = require('./models');
const operations = require('./operations');


/** Class representing a ConsumptionManagementClient. */
class ConsumptionManagementClient extends ServiceClient {
/**
* Create a ConsumptionManagementClient.
* @param {credentials} credentials - Credentials needed for the client to connect to Azure.
* @param {string} subscriptionId - Azure Subscription ID.
* @param {string} [baseUri] - The base URI of the service.
* @param {object} [options] - The parameter options
* @param {Array} [options.filters] - Filters to be added to the request pipeline
* @param {object} [options.requestOptions] - Options for the underlying request object
* {@link https://github.com/request/request#requestoptions-callback Options doc}
* @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy
* @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response.
* @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
* @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*/
constructor(credentials, subscriptionId, baseUri, options) {
if (credentials === null || credentials === undefined) {
throw new Error('\'credentials\' cannot be null.');
}
if (subscriptionId === null || subscriptionId === undefined) {
throw new Error('\'subscriptionId\' cannot be null.');
}

if (!options) options = {};

super(credentials, options);

this.apiVersion = '2018-03-31';
this.acceptLanguage = 'en-US';
this.longRunningOperationRetryTimeout = 30;
this.generateClientRequestId = true;
this.baseUri = baseUri;
if (!this.baseUri) {
this.baseUri = 'https://management.azure.com';
}
this.credentials = credentials;
this.subscriptionId = subscriptionId;

let packageInfo = this.getPackageJsonInfo(__dirname);
this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`);
if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
this.acceptLanguage = options.acceptLanguage;
}
if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout;
}
if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) {
this.generateClientRequestId = options.generateClientRequestId;
}
this.usageDetails = new operations.UsageDetails(this);
this.marketplaces = new operations.Marketplaces(this);
this.reservationsSummaries = new operations.ReservationsSummaries(this);
this.reservationsDetails = new operations.ReservationsDetails(this);
this.reservationRecommendationsOperations = new operations.ReservationRecommendationsOperations(this);
this.budgets = new operations.Budgets(this);
this.operations = new operations.Operations(this);
this.priceSheet = new operations.PriceSheet(this);
this.costAllocationTagsOperations = new operations.CostAllocationTagsOperations(this);
this.models = models;
msRest.addSerializationMixin(this);
}

}

module.exports = ConsumptionManagementClient;
module.exports['default'] = ConsumptionManagementClient;
module.exports.ConsumptionManagementClient = ConsumptionManagementClient;
module.exports.ConsumptionManagementModels = models;
Loading

0 comments on commit 2b2fbe4

Please sign in to comment.