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
2 changes: 1 addition & 1 deletion lib/services/consumptionManagement/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2018 Microsoft
Copyright (c) 2019 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
Expand Down
37 changes: 16 additions & 21 deletions lib/services/consumptionManagement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,41 @@ uid: azure-arm-consumption
summary: *content

---
# Microsoft Azure SDK for Node.js - ConsumptionManagementClient
**This SDK will be deprecated next year and will be replaced by a new TypeScript-based isomorphic SDK (found at https://github.com/Azure/azure-sdk-for-js) which works on Node.js and browsers.**
## 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
### Features


## How to Install
### How to Install

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

## How to use
### How to use

### Authentication, client creation and list usageDetails as an example.
#### Authentication, client creation, and list operations 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);
});
const subscriptionId = "<Subscription_Id>";
const client = new ConsumptionManagementClient(creds, subscriptionId);

return client.operations.list().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
```
### Related projects

- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node)


![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-node%2Flib%2Fservices%2FconsumptionManagement%2FREADME.png)
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ export default class ConsumptionManagementClient extends AzureServiceClient {
* @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
Expand All @@ -41,34 +39,28 @@ export default class ConsumptionManagementClient extends AzureServiceClient {
* @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);
constructor(credentials: ServiceClientCredentials, baseUri?: string, options?: AzureServiceClientOptions);

credentials: ServiceClientCredentials;

apiVersion: string;

subscriptionId: string;

acceptLanguage: string;

longRunningOperationRetryTimeout: number;

generateClientRequestId: boolean;

// Operation groups
usageDetails: operations.UsageDetails;
marketplaces: operations.Marketplaces;
balances: operations.Balances;
reservationsSummaries: operations.ReservationsSummaries;
reservationsDetails: operations.ReservationsDetails;
reservationRecommendations: operations.ReservationRecommendations;
budgets: operations.Budgets;
priceSheet: operations.PriceSheet;
tags: operations.Tags;
forecasts: operations.Forecasts;
operations: operations.Operations;
aggregatedCost: operations.AggregatedCost;
charges: operations.Charges;
creditSummaryByBillingProfile: operations.CreditSummaryByBillingProfile;
eventsByBillingProfile: operations.EventsByBillingProfile;
lotsByBillingProfile: operations.LotsByBillingProfile;
invoicePricesheet: operations.InvoicePricesheet;
billingProfilePricesheet: operations.BillingProfilePricesheet;
chargesByBillingAccount: operations.ChargesByBillingAccount;
chargesByBillingProfile: operations.ChargesByBillingProfile;
chargesByInvoiceSection: operations.ChargesByInvoiceSection;
}

export { ConsumptionManagementClient, models as ConsumptionManagementModels };
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,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 {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 @@ -38,19 +37,16 @@ class ConsumptionManagementClient extends ServiceClient {
* @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) {
constructor(credentials, 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-10-01';
this.apiVersion = '2018-11-01-preview';
this.acceptLanguage = 'en-US';
this.longRunningOperationRetryTimeout = 30;
this.generateClientRequestId = true;
Expand All @@ -59,7 +55,6 @@ class ConsumptionManagementClient extends ServiceClient {
this.baseUri = 'https://management.azure.com';
}
this.credentials = credentials;
this.subscriptionId = subscriptionId;

let packageInfo = this.getPackageJsonInfo(__dirname);
this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`);
Expand All @@ -72,19 +67,15 @@ class ConsumptionManagementClient extends ServiceClient {
if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) {
this.generateClientRequestId = options.generateClientRequestId;
}
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.tags = new operations.Tags(this);
this.forecasts = new operations.Forecasts(this);
this.operations = new operations.Operations(this);
this.aggregatedCost = new operations.AggregatedCost(this);
this.charges = new operations.Charges(this);
this.creditSummaryByBillingProfile = new operations.CreditSummaryByBillingProfile(this);
this.eventsByBillingProfile = new operations.EventsByBillingProfile(this);
this.lotsByBillingProfile = new operations.LotsByBillingProfile(this);
this.invoicePricesheet = new operations.InvoicePricesheet(this);
this.billingProfilePricesheet = new operations.BillingProfilePricesheet(this);
this.chargesByBillingAccount = new operations.ChargesByBillingAccount(this);
this.chargesByBillingProfile = new operations.ChargesByBillingProfile(this);
this.chargesByInvoiceSection = new operations.ChargesByInvoiceSection(this);
this.models = models;
msRest.addSerializationMixin(this);
}
Expand Down
108 changes: 108 additions & 0 deletions lib/services/consumptionManagement/lib/models/address.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* 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';

/**
* Address details.
*
*/
class Address {
/**
* Create a Address.
* @property {string} [addressLine1] Address Line1.
* @property {string} [addressLine2] Address Line2.
* @property {string} [addressLine3] Address Line3.
* @property {string} [city] Address City.
* @property {string} [region] Address Region.
* @property {string} [country] Country code uses ISO2, 2-digit format..
* @property {string} [postalCode] Postal Code.
* @property {string} [phoneNumber] Phone Number.
*/
constructor() {
}

/**
* Defines the metadata of Address
*
* @returns {object} metadata of Address
*
*/
mapper() {
return {
required: false,
serializedName: 'Address',
type: {
name: 'Composite',
className: 'Address',
modelProperties: {
addressLine1: {
required: false,
serializedName: 'addressLine1',
type: {
name: 'String'
}
},
addressLine2: {
required: false,
serializedName: 'addressLine2',
type: {
name: 'String'
}
},
addressLine3: {
required: false,
serializedName: 'addressLine3',
type: {
name: 'String'
}
},
city: {
required: false,
serializedName: 'city',
type: {
name: 'String'
}
},
region: {
required: false,
serializedName: 'region',
type: {
name: 'String'
}
},
country: {
required: false,
serializedName: 'country',
type: {
name: 'String'
}
},
postalCode: {
required: false,
serializedName: 'postalCode',
type: {
name: 'String'
}
},
phoneNumber: {
required: false,
serializedName: 'phoneNumber',
type: {
name: 'String'
}
}
}
}
};
}
}

module.exports = Address;
62 changes: 62 additions & 0 deletions lib/services/consumptionManagement/lib/models/amount.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* 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';

/**
* Object to represent monetary quantities.
*
*/
class Amount {
/**
* Create a Amount.
* @property {string} [currency] The currency for the amount value.
* @property {number} [value] Amount value.
*/
constructor() {
}

/**
* Defines the metadata of Amount
*
* @returns {object} metadata of Amount
*
*/
mapper() {
return {
required: false,
serializedName: 'Amount',
type: {
name: 'Composite',
className: 'Amount',
modelProperties: {
currency: {
required: false,
readOnly: true,
serializedName: 'currency',
type: {
name: 'String'
}
},
value: {
required: false,
readOnly: true,
serializedName: 'value',
type: {
name: 'Number'
}
}
}
}
};
}
}

module.exports = Amount;
Loading