Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions lib/services/consumptionManagement/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,21 +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.
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.
88 changes: 43 additions & 45 deletions lib/services/consumptionManagement/README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,43 @@
---
uid: azure-arm-consumption
summary: *content

---
# Microsoft Azure SDK for Node.js - ConsumptionManagementClient
This project provides a Node.js package for accessing Azure. Right now it supports:
- **Node.js version 6.x.x or higher**

## Features


## How to Install

```bash
npm install azure-arm-consumption
```

## How to use

### Authentication, client creation and list usageDetails 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 expand = "testexpand";
const filter = "testfilter";
const skiptoken = "testskiptoken";
const top = 1;
const apply = "testapply";
return client.usageDetails.list(expand, filter, skiptoken, top, apply).then((result) => {
console.log("The result is:");
console.log(result);
});
}).catch((err) => {
console.log('An error ocurred:');
console.dir(err, {depth: null, colors: true});
});

## Related projects

- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node)
---
uid: azure-arm-consumption
summary: *content

---
# Microsoft Azure SDK for Node.js - ConsumptionManagementClient
This project provides a Node.js package for accessing Azure. Right now it supports:
- **Node.js version 6.x.x or higher**

## Features


## How to Install

```bash
npm install azure-arm-consumption
```

## How to use

### 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 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);
});
}).catch((err) => {
console.log('An error occurred:');
console.dir(err, {depth: null, colors: true});
});

## Related projects

- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node)
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ export default class ConsumptionManagementClient extends AzureServiceClient {
*
* @param {string} subscriptionId - Azure Subscription ID.
*
* @param {datagrain} grain - Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain'
*
* @param {string} [baseUri] - The base URI of the service.
*
* @param {object} [options] - The parameter options
Expand All @@ -43,31 +41,25 @@ export default class ConsumptionManagementClient extends AzureServiceClient {
* @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, grain: string, baseUri?: string, options?: AzureServiceClientOptions);
constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions);

credentials: ServiceClientCredentials;

apiVersion: string;

subscriptionId: string;

grain: string;

acceptLanguage: string;

longRunningOperationRetryTimeout: number;

generateClientRequestId: boolean;

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

export { ConsumptionManagementClient, models as ConsumptionManagementModels };
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ 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 {datagrain} grain - Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain'
* @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
Expand All @@ -39,22 +38,19 @@ class ConsumptionManagementClient extends ServiceClient {
* @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, grain, baseUri, options) {
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 (grain === null || grain === undefined) {
throw new Error('\'grain\' cannot be null.');
}

if (!options) options = {};

super(credentials, options);

this.apiVersion = '2018-03-31';
this.apiVersion = '2018-05-31';
this.acceptLanguage = 'en-US';
this.longRunningOperationRetryTimeout = 30;
this.generateClientRequestId = true;
Expand All @@ -64,7 +60,6 @@ class ConsumptionManagementClient extends ServiceClient {
}
this.credentials = credentials;
this.subscriptionId = subscriptionId;
this.grain = grain;

let packageInfo = this.getPackageJsonInfo(__dirname);
this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`);
Expand All @@ -77,14 +72,10 @@ 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.reservationsSummaries = new operations.ReservationsSummaries(this);
this.reservationsDetails = new operations.ReservationsDetails(this);
this.reservationRecommendationsOperations = new operations.ReservationRecommendationsOperations(this);
this.budgets = new operations.Budgets(this);
this.forecasts = new operations.Forecasts(this);
this.operations = new operations.Operations(this);
this.priceSheet = new operations.PriceSheet(this);
this.models = models;
msRest.addSerializationMixin(this);
}
Expand Down
151 changes: 151 additions & 0 deletions lib/services/consumptionManagement/lib/models/forecast.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
/*
* 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 forecast resource.
*
* @extends models['Resource']
*/
class Forecast extends models['Resource'] {
/**
* Create a Forecast.
* @member {string} [usageDate] The usage date of the forecast.
* @member {string} [grain] The granularity of forecast. Possible values
* include: 'Daily', 'Monthly', 'Yearly'
* @member {number} [charge] The amount of charge
* @member {string} [currency] The ISO currency in which the meter is
* charged, for example, USD.
* @member {string} [chargeType] The type of the charge. Could be actual or
* forecast. Possible values include: 'Actual', 'Forecast'
* @member {array} [confidenceLevels] The details about the forecast
* confidence levels. This is populated only when chargeType is Forecast.
*/
constructor() {
super();
}

/**
* Defines the metadata of Forecast
*
* @returns {object} metadata of Forecast
*
*/
mapper() {
return {
required: false,
serializedName: 'Forecast',
type: {
name: 'Composite',
className: 'Forecast',
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'
}
}
}
},
usageDate: {
required: false,
readOnly: true,
serializedName: 'properties.usageDate',
type: {
name: 'String'
}
},
grain: {
required: false,
serializedName: 'properties.grain',
type: {
name: 'String'
}
},
charge: {
required: false,
readOnly: true,
serializedName: 'properties.charge',
type: {
name: 'Number'
}
},
currency: {
required: false,
readOnly: true,
serializedName: 'properties.currency',
type: {
name: 'String'
}
},
chargeType: {
required: false,
serializedName: 'properties.chargeType',
type: {
name: 'String'
}
},
confidenceLevels: {
required: false,
readOnly: true,
serializedName: 'properties.confidenceLevels',
type: {
name: 'Sequence',
element: {
required: false,
serializedName: 'ForecastPropertiesConfidenceLevelsItemElementType',
type: {
name: 'Composite',
className: 'ForecastPropertiesConfidenceLevelsItem'
}
}
}
}
}
}
};
}
}

module.exports = Forecast;
Loading