Skip to content

Commit

Permalink
CodeGen from PR 15007 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge d55179ef97c8eb24664ad3e916b7d7b5369307ba into 4017737e3dfb6b7dc329c9a8e2c59e1b521e2688
  • Loading branch information
SDKAuto committed Jun 28, 2021
1 parent b8da289 commit b890e2b
Show file tree
Hide file tree
Showing 46 changed files with 9,242 additions and 7,425 deletions.
18 changes: 9 additions & 9 deletions sdk/consumption/arm-consumption/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
## Azure ConsumptionManagementClient SDK for JavaScript

This package contains an isomorphic SDK (runs both in Node.js and in browsers) for ConsumptionManagementClient.
This package contains an isomorphic SDK (runs both in node.js and in browsers) for ConsumptionManagementClient.

### Currently supported environments

- [LTS versions of Node.js](https://nodejs.org/about/releases/)
- Latest versions of Safari, Chrome, Edge, and Firefox.
- Latest versions of Safari, Chrome, Edge and Firefox.

### Prerequisites

Expand All @@ -21,7 +21,6 @@ Install both packages using the below command:
```bash
npm install --save @azure/arm-consumption @azure/identity
```

> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features.
If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options.

Expand All @@ -37,7 +36,6 @@ If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/

In the below samples, we pass the credential and the Azure subscription id to instantiate the client.
Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started.

#### nodejs - Authentication, client creation, and list usageDetails as an example written in JavaScript.

##### Sample code
Expand All @@ -51,12 +49,13 @@ const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];
// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead.
const creds = new DefaultAzureCredential();
const client = new ConsumptionManagementClient(creds, subscriptionId);
const scope = "testscope";
const expand = "testexpand";
const filter = "testfilter";
const skiptoken = "testskiptoken";
const top = 1;
const apply = "testapply";
client.usageDetails.list(expand, filter, skiptoken, top, apply).then((result) => {
const metric = "actualcost";
client.usageDetails.list(scope, expand, filter, skiptoken, top, metric).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
Expand Down Expand Up @@ -90,15 +89,16 @@ In browser applications, we recommend using the `InteractiveBrowserCredential` t
const credential = new InteractiveBrowserCredential(
{
clientId: "<client id for your Azure AD app>",
tenantId: "<optional tenant for your organization>"
tenant: "<optional tenant for your organization>"
});
const client = new Azure.ArmConsumption.ConsumptionManagementClient(creds, subscriptionId);
const scope = "testscope";
const expand = "testexpand";
const filter = "testfilter";
const skiptoken = "testskiptoken";
const top = 1;
const apply = "testapply";
client.usageDetails.list(expand, filter, skiptoken, top, apply).then((result) => {
const metric = "actualcost";
client.usageDetails.list(scope, expand, filter, skiptoken, top, metric).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
Expand Down
2 changes: 1 addition & 1 deletion sdk/consumption/arm-consumption/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"rollup-plugin-sourcemaps": "^0.4.2",
"uglify-js": "^3.6.0"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/consumption/arm-consumption",
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/consumption/arm-consumption",
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-sdk-for-js.git"
Expand Down
10 changes: 8 additions & 2 deletions sdk/consumption/arm-consumption/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import sourcemaps from "rollup-plugin-sourcemaps";
*/
const config = {
input: "./esm/consumptionManagementClient.js",
external: ["@azure/ms-rest-js", "@azure/ms-rest-azure-js"],
external: [
"@azure/ms-rest-js",
"@azure/ms-rest-azure-js"
],
output: {
file: "./dist/arm-consumption.js",
format: "umd",
Expand All @@ -25,7 +28,10 @@ const config = {
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/`
},
plugins: [nodeResolve({ mainFields: ["module", "main"] }), sourcemaps()]
plugins: [
nodeResolve({ mainFields: ['module', 'main'] }),
sourcemaps()
]
};

export default config;
31 changes: 18 additions & 13 deletions sdk/consumption/arm-consumption/src/consumptionManagementClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,27 @@ import * as Mappers from "./models/mappers";
import * as operations from "./operations";
import { ConsumptionManagementClientContext } from "./consumptionManagementClientContext";


class ConsumptionManagementClient extends ConsumptionManagementClientContext {
// Operation groups
usageDetails: operations.UsageDetails;
marketplaces: operations.Marketplaces;
budgets: operations.Budgets;
tags: operations.Tags;
charges: operations.Charges;
balances: operations.Balances;
reservationsSummaries: operations.ReservationsSummaries;
reservationsDetails: operations.ReservationsDetails;
reservationRecommendations: operations.ReservationRecommendations;
budgets: operations.Budgets;
reservationRecommendationDetails: operations.ReservationRecommendationDetails;
reservationTransactions: operations.ReservationTransactions;
priceSheet: operations.PriceSheet;
tags: operations.Tags;
forecasts: operations.Forecasts;
operations: operations.Operations;
aggregatedCost: operations.AggregatedCost;
charges: operations.Charges;
tenants: operations.Tenants;
events: operations.EventsOperations;
lots: operations.LotsOperations;
credits: operations.Credits;

/**
* Initializes a new instance of the ConsumptionManagementClient class.
Expand All @@ -42,26 +47,26 @@ class ConsumptionManagementClient extends ConsumptionManagementClientContext {
* @param subscriptionId Azure Subscription ID.
* @param [options] The parameter options
*/
constructor(
credentials: msRest.ServiceClientCredentials | TokenCredential,
subscriptionId: string,
options?: Models.ConsumptionManagementClientOptions
) {
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.ConsumptionManagementClientOptions) {
super(credentials, subscriptionId, options);
this.usageDetails = new operations.UsageDetails(this);
this.marketplaces = new operations.Marketplaces(this);
this.budgets = new operations.Budgets(this);
this.tags = new operations.Tags(this);
this.charges = new operations.Charges(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.reservationRecommendationDetails = new operations.ReservationRecommendationDetails(this);
this.reservationTransactions = new operations.ReservationTransactions(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.tenants = new operations.Tenants(this);
this.events = new operations.EventsOperations(this);
this.lots = new operations.LotsOperations(this);
this.credits = new operations.Credits(this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import * as Models from "./models";
import * as msRest from "@azure/ms-rest-js";
import { TokenCredential } from "@azure/core-auth";
import * as msRestAzure from "@azure/ms-rest-azure-js";
import { TokenCredential } from "@azure/core-auth";

const packageName = "@azure/arm-consumption";
const packageVersion = "7.1.0";
Expand All @@ -31,16 +31,12 @@ export class ConsumptionManagementClientContext extends msRestAzure.AzureService
* @param subscriptionId Azure Subscription ID.
* @param [options] The parameter options
*/
constructor(
credentials: msRest.ServiceClientCredentials | TokenCredential,
subscriptionId: string,
options?: Models.ConsumptionManagementClientOptions
) {
constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.ConsumptionManagementClientOptions) {
if (credentials == undefined) {
throw new Error("'credentials' cannot be null.");
throw new Error('\'credentials\' cannot be null.');
}
if (subscriptionId == undefined) {
throw new Error("'subscriptionId' cannot be null.");
throw new Error('\'subscriptionId\' cannot be null.');
}

if (!options) {
Expand All @@ -53,8 +49,8 @@ export class ConsumptionManagementClientContext extends msRestAzure.AzureService

super(credentials, options);

this.apiVersion = "2018-10-01";
this.acceptLanguage = "en-US";
this.apiVersion = '2021-05-01';
this.acceptLanguage = 'en-US';
this.longRunningOperationRetryTimeout = 30;
this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com";
this.requestContentType = "application/json; charset=utf-8";
Expand All @@ -64,10 +60,7 @@ export class ConsumptionManagementClientContext extends msRestAzure.AzureService
if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) {
this.acceptLanguage = options.acceptLanguage;
}
if (
options.longRunningOperationRetryTimeout !== null &&
options.longRunningOperationRetryTimeout !== undefined
) {
if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) {
this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,55 @@
*/

export {
discriminators,
Amount,
AmountWithExchangeRate,
Balance,
BalancePropertiesAdjustmentDetailsItem,
BalancePropertiesNewPurchasesDetailsItem,
BaseResource,
Budget,
BudgetComparisonExpression,
BudgetFilter,
BudgetFilterProperties,
BudgetTimePeriod,
ChargeSummary,
CreditBalanceSummary,
CreditSummary,
CurrentSpend,
ErrorDetails,
ErrorResponse,
Filters,
EventSummary,
Forecast,
ForecastPropertiesConfidenceLevelsItem,
ForecastSpend,
LegacyChargeSummary,
LegacyReservationTransaction,
LegacyUsageDetail,
LotSummary,
ManagementGroupAggregatedCostResult,
Marketplace,
MeterDetails,
MeterDetailsResponse,
ModernChargeSummary,
ModernReservationTransaction,
ModernUsageDetail,
Notification,
PriceSheetProperties,
PriceSheetResult,
ProxyResource,
Reseller,
ReservationDetail,
ReservationRecommendationDetailsCalculatedSavingsProperties,
ReservationRecommendationDetailsModel,
ReservationRecommendationDetailsResourceProperties,
ReservationRecommendationDetailsSavingsProperties,
ReservationRecommendationDetailsUsageProperties,
ReservationSummary,
ReservationTransaction,
ReservationTransactionResource,
Resource,
Tag,
TagsResult,
Tenant,
UsageDetail
} from "../models/mappers";
28 changes: 26 additions & 2 deletions sdk/consumption/arm-consumption/src/models/balancesMappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,55 @@
*/

export {
discriminators,
Amount,
AmountWithExchangeRate,
Balance,
BalancePropertiesAdjustmentDetailsItem,
BalancePropertiesNewPurchasesDetailsItem,
BaseResource,
Budget,
BudgetComparisonExpression,
BudgetFilter,
BudgetFilterProperties,
BudgetTimePeriod,
ChargeSummary,
CreditBalanceSummary,
CreditSummary,
CurrentSpend,
ErrorDetails,
ErrorResponse,
Filters,
EventSummary,
Forecast,
ForecastPropertiesConfidenceLevelsItem,
ForecastSpend,
LegacyChargeSummary,
LegacyReservationTransaction,
LegacyUsageDetail,
LotSummary,
ManagementGroupAggregatedCostResult,
Marketplace,
MeterDetails,
MeterDetailsResponse,
ModernChargeSummary,
ModernReservationTransaction,
ModernUsageDetail,
Notification,
PriceSheetProperties,
PriceSheetResult,
ProxyResource,
Reseller,
ReservationDetail,
ReservationRecommendationDetailsCalculatedSavingsProperties,
ReservationRecommendationDetailsModel,
ReservationRecommendationDetailsResourceProperties,
ReservationRecommendationDetailsSavingsProperties,
ReservationRecommendationDetailsUsageProperties,
ReservationSummary,
ReservationTransaction,
ReservationTransactionResource,
Resource,
Tag,
TagsResult,
Tenant,
UsageDetail
} from "../models/mappers";
28 changes: 26 additions & 2 deletions sdk/consumption/arm-consumption/src/models/budgetsMappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,56 @@
*/

export {
discriminators,
Amount,
AmountWithExchangeRate,
Balance,
BalancePropertiesAdjustmentDetailsItem,
BalancePropertiesNewPurchasesDetailsItem,
BaseResource,
Budget,
BudgetComparisonExpression,
BudgetFilter,
BudgetFilterProperties,
BudgetsListResult,
BudgetTimePeriod,
ChargeSummary,
CreditBalanceSummary,
CreditSummary,
CurrentSpend,
ErrorDetails,
ErrorResponse,
Filters,
EventSummary,
Forecast,
ForecastPropertiesConfidenceLevelsItem,
ForecastSpend,
LegacyChargeSummary,
LegacyReservationTransaction,
LegacyUsageDetail,
LotSummary,
ManagementGroupAggregatedCostResult,
Marketplace,
MeterDetails,
MeterDetailsResponse,
ModernChargeSummary,
ModernReservationTransaction,
ModernUsageDetail,
Notification,
PriceSheetProperties,
PriceSheetResult,
ProxyResource,
Reseller,
ReservationDetail,
ReservationRecommendationDetailsCalculatedSavingsProperties,
ReservationRecommendationDetailsModel,
ReservationRecommendationDetailsResourceProperties,
ReservationRecommendationDetailsSavingsProperties,
ReservationRecommendationDetailsUsageProperties,
ReservationSummary,
ReservationTransaction,
ReservationTransactionResource,
Resource,
Tag,
TagsResult,
Tenant,
UsageDetail
} from "../models/mappers";
Loading

0 comments on commit b890e2b

Please sign in to comment.