@azure/arm-commerce 4.0.0-alpha.20250110.1 → 4.0.0-alpha.20250113.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.ts +5 -0
- package/{dist-esm/src → dist/browser}/index.d.ts.map +1 -1
- package/{dist-esm/src → dist/browser}/index.js +4 -4
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/models/index.js.map +1 -0
- package/dist/browser/models/mappers.js.map +1 -0
- package/dist/browser/models/parameters.js.map +1 -0
- package/dist/browser/operations/index.d.ts +3 -0
- package/{dist-esm/src → dist/browser}/operations/index.d.ts.map +1 -1
- package/{dist-esm/src → dist/browser}/operations/index.js +2 -2
- package/dist/browser/operations/index.js.map +1 -0
- package/{dist-esm/src → dist/browser}/operations/rateCard.d.ts +3 -3
- package/dist/browser/operations/rateCard.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/operations/rateCard.js +2 -2
- package/dist/browser/operations/rateCard.js.map +1 -0
- package/{dist-esm/src → dist/browser}/operations/usageAggregates.d.ts +3 -3
- package/dist/browser/operations/usageAggregates.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/operations/usageAggregates.js +3 -3
- package/dist/browser/operations/usageAggregates.js.map +1 -0
- package/dist/browser/operationsInterfaces/index.d.ts +3 -0
- package/{dist-esm/src → dist/browser}/operationsInterfaces/index.d.ts.map +1 -1
- package/{dist-esm/src → dist/browser}/operationsInterfaces/index.js +2 -2
- package/dist/browser/operationsInterfaces/index.js.map +1 -0
- package/{dist-esm/src → dist/browser}/operationsInterfaces/rateCard.d.ts +1 -1
- package/dist/browser/operationsInterfaces/rateCard.d.ts.map +1 -0
- package/dist/browser/operationsInterfaces/rateCard.js.map +1 -0
- package/{dist-esm/src → dist/browser}/operationsInterfaces/usageAggregates.d.ts +1 -1
- package/dist/browser/operationsInterfaces/usageAggregates.d.ts.map +1 -0
- package/dist/browser/operationsInterfaces/usageAggregates.js.map +1 -0
- package/dist/browser/package.json +3 -0
- package/dist/browser/pagingHelper.js.map +1 -0
- package/{dist-esm/src → dist/browser}/usageManagementClient.d.ts +2 -2
- package/dist/browser/usageManagementClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/usageManagementClient.js +15 -18
- package/dist/browser/usageManagementClient.js.map +1 -0
- package/dist/commonjs/index.d.ts +5 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +19 -0
- package/dist/commonjs/index.js.map +1 -0
- package/{types/arm-commerce.d.ts → dist/commonjs/models/index.d.ts} +178 -258
- package/dist/commonjs/models/index.d.ts.map +1 -0
- package/dist/commonjs/models/index.js +10 -0
- package/dist/commonjs/models/index.js.map +1 -0
- package/dist/commonjs/models/mappers.d.ts +19 -0
- package/dist/commonjs/models/mappers.d.ts.map +1 -0
- package/dist/commonjs/models/mappers.js +436 -0
- package/dist/commonjs/models/mappers.js.map +1 -0
- package/dist/commonjs/models/parameters.d.ts +13 -0
- package/dist/commonjs/models/parameters.d.ts.map +1 -0
- package/dist/commonjs/models/parameters.js +124 -0
- package/dist/commonjs/models/parameters.js.map +1 -0
- package/dist/commonjs/operations/index.d.ts +3 -0
- package/dist/commonjs/operations/index.d.ts.map +1 -0
- package/dist/commonjs/operations/index.js +13 -0
- package/dist/commonjs/operations/index.js.map +1 -0
- package/dist/commonjs/operations/rateCard.d.ts +27 -0
- package/dist/commonjs/operations/rateCard.d.ts.map +1 -0
- package/dist/commonjs/operations/rateCard.js +60 -0
- package/dist/commonjs/operations/rateCard.js.map +1 -0
- package/dist/commonjs/operations/usageAggregates.d.ts +38 -0
- package/dist/commonjs/operations/usageAggregates.d.ts.map +1 -0
- package/dist/commonjs/operations/usageAggregates.js +162 -0
- package/dist/commonjs/operations/usageAggregates.js.map +1 -0
- package/dist/commonjs/operationsInterfaces/index.d.ts +3 -0
- package/dist/commonjs/operationsInterfaces/index.d.ts.map +1 -0
- package/dist/commonjs/operationsInterfaces/index.js +13 -0
- package/dist/commonjs/operationsInterfaces/index.js.map +1 -0
- package/dist/commonjs/operationsInterfaces/rateCard.d.ts +19 -0
- package/dist/commonjs/operationsInterfaces/rateCard.d.ts.map +1 -0
- package/dist/commonjs/operationsInterfaces/rateCard.js +10 -0
- package/dist/commonjs/operationsInterfaces/rateCard.js.map +1 -0
- package/dist/commonjs/operationsInterfaces/usageAggregates.d.ts +13 -0
- package/dist/commonjs/operationsInterfaces/usageAggregates.d.ts.map +1 -0
- package/dist/commonjs/operationsInterfaces/usageAggregates.js +10 -0
- package/dist/commonjs/operationsInterfaces/usageAggregates.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/pagingHelper.d.ts +13 -0
- package/dist/commonjs/pagingHelper.d.ts.map +1 -0
- package/dist/commonjs/pagingHelper.js +36 -0
- package/dist/commonjs/pagingHelper.js.map +1 -0
- package/dist/commonjs/usageManagementClient.d.ts +22 -0
- package/dist/commonjs/usageManagementClient.d.ts.map +1 -0
- package/dist/commonjs/usageManagementClient.js +104 -0
- package/dist/commonjs/usageManagementClient.js.map +1 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/{src/index.ts → dist/esm/index.js} +5 -5
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/models/index.d.ts +178 -0
- package/dist/esm/models/index.d.ts.map +1 -0
- package/{src/operations/index.ts → dist/esm/models/index.js} +2 -3
- package/dist/esm/models/index.js.map +1 -0
- package/dist/esm/models/mappers.d.ts +19 -0
- package/dist/esm/models/mappers.d.ts.map +1 -0
- package/dist/esm/models/mappers.js +433 -0
- package/dist/esm/models/mappers.js.map +1 -0
- package/dist/esm/models/parameters.d.ts +13 -0
- package/dist/esm/models/parameters.d.ts.map +1 -0
- package/dist/esm/models/parameters.js +121 -0
- package/dist/esm/models/parameters.js.map +1 -0
- package/dist/esm/operations/index.d.ts +3 -0
- package/dist/esm/operations/index.d.ts.map +1 -0
- package/dist/esm/operations/index.js +10 -0
- package/dist/esm/operations/index.js.map +1 -0
- package/dist/esm/operations/rateCard.d.ts +27 -0
- package/dist/esm/operations/rateCard.d.ts.map +1 -0
- package/dist/esm/operations/rateCard.js +55 -0
- package/dist/esm/operations/rateCard.js.map +1 -0
- package/dist/esm/operations/usageAggregates.d.ts +38 -0
- package/dist/esm/operations/usageAggregates.d.ts.map +1 -0
- package/dist/esm/operations/usageAggregates.js +158 -0
- package/dist/esm/operations/usageAggregates.js.map +1 -0
- package/dist/esm/operationsInterfaces/index.d.ts +3 -0
- package/dist/esm/operationsInterfaces/index.d.ts.map +1 -0
- package/dist/esm/operationsInterfaces/index.js +10 -0
- package/dist/esm/operationsInterfaces/index.js.map +1 -0
- package/dist/esm/operationsInterfaces/rateCard.d.ts +19 -0
- package/dist/esm/operationsInterfaces/rateCard.d.ts.map +1 -0
- package/dist/esm/operationsInterfaces/rateCard.js +9 -0
- package/dist/esm/operationsInterfaces/rateCard.js.map +1 -0
- package/dist/esm/operationsInterfaces/usageAggregates.d.ts +13 -0
- package/dist/esm/operationsInterfaces/usageAggregates.d.ts.map +1 -0
- package/dist/esm/operationsInterfaces/usageAggregates.js +9 -0
- package/dist/esm/operationsInterfaces/usageAggregates.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/pagingHelper.d.ts +13 -0
- package/dist/esm/pagingHelper.d.ts.map +1 -0
- package/dist/esm/pagingHelper.js +32 -0
- package/dist/esm/pagingHelper.js.map +1 -0
- package/dist/esm/usageManagementClient.d.ts +22 -0
- package/dist/esm/usageManagementClient.d.ts.map +1 -0
- package/dist/esm/usageManagementClient.js +99 -0
- package/dist/esm/usageManagementClient.js.map +1 -0
- package/dist/react-native/index.d.ts +5 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +13 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/models/index.d.ts +178 -0
- package/dist/react-native/models/index.d.ts.map +1 -0
- package/dist/react-native/models/index.js +9 -0
- package/dist/react-native/models/index.js.map +1 -0
- package/dist/react-native/models/mappers.d.ts +19 -0
- package/dist/react-native/models/mappers.d.ts.map +1 -0
- package/dist/react-native/models/mappers.js +433 -0
- package/dist/react-native/models/mappers.js.map +1 -0
- package/dist/react-native/models/parameters.d.ts +13 -0
- package/dist/react-native/models/parameters.d.ts.map +1 -0
- package/dist/react-native/models/parameters.js +121 -0
- package/dist/react-native/models/parameters.js.map +1 -0
- package/dist/react-native/operations/index.d.ts +3 -0
- package/dist/react-native/operations/index.d.ts.map +1 -0
- package/dist/react-native/operations/index.js +10 -0
- package/dist/react-native/operations/index.js.map +1 -0
- package/dist/react-native/operations/rateCard.d.ts +27 -0
- package/dist/react-native/operations/rateCard.d.ts.map +1 -0
- package/dist/react-native/operations/rateCard.js +55 -0
- package/dist/react-native/operations/rateCard.js.map +1 -0
- package/dist/react-native/operations/usageAggregates.d.ts +38 -0
- package/dist/react-native/operations/usageAggregates.d.ts.map +1 -0
- package/dist/react-native/operations/usageAggregates.js +158 -0
- package/dist/react-native/operations/usageAggregates.js.map +1 -0
- package/dist/react-native/operationsInterfaces/index.d.ts +3 -0
- package/dist/react-native/operationsInterfaces/index.d.ts.map +1 -0
- package/dist/react-native/operationsInterfaces/index.js +10 -0
- package/dist/react-native/operationsInterfaces/index.js.map +1 -0
- package/dist/react-native/operationsInterfaces/rateCard.d.ts +19 -0
- package/dist/react-native/operationsInterfaces/rateCard.d.ts.map +1 -0
- package/dist/react-native/operationsInterfaces/rateCard.js +9 -0
- package/dist/react-native/operationsInterfaces/rateCard.js.map +1 -0
- package/dist/react-native/operationsInterfaces/usageAggregates.d.ts +13 -0
- package/dist/react-native/operationsInterfaces/usageAggregates.d.ts.map +1 -0
- package/dist/react-native/operationsInterfaces/usageAggregates.js +9 -0
- package/dist/react-native/operationsInterfaces/usageAggregates.js.map +1 -0
- package/dist/react-native/package.json +3 -0
- package/dist/react-native/pagingHelper.d.ts +13 -0
- package/dist/react-native/pagingHelper.d.ts.map +1 -0
- package/dist/react-native/pagingHelper.js +32 -0
- package/dist/react-native/pagingHelper.js.map +1 -0
- package/dist/react-native/usageManagementClient.d.ts +22 -0
- package/dist/react-native/usageManagementClient.d.ts.map +1 -0
- package/dist/react-native/usageManagementClient.js +99 -0
- package/dist/react-native/usageManagementClient.js.map +1 -0
- package/package.json +58 -28
- package/dist/index.js +0 -936
- package/dist/index.js.map +0 -1
- package/dist/index.min.js +0 -1
- package/dist/index.min.js.map +0 -1
- package/dist-esm/samples-dev/getRateCard.d.ts +0 -2
- package/dist-esm/samples-dev/getRateCard.d.ts.map +0 -1
- package/dist-esm/samples-dev/getRateCard.js +0 -30
- package/dist-esm/samples-dev/getRateCard.js.map +0 -1
- package/dist-esm/samples-dev/rateCardGetSample.d.ts +0 -2
- package/dist-esm/samples-dev/rateCardGetSample.d.ts.map +0 -1
- package/dist-esm/samples-dev/rateCardGetSample.js +0 -30
- package/dist-esm/samples-dev/rateCardGetSample.js.map +0 -1
- package/dist-esm/src/index.d.ts +0 -5
- package/dist-esm/src/index.js.map +0 -1
- package/dist-esm/src/models/index.js.map +0 -1
- package/dist-esm/src/models/mappers.js.map +0 -1
- package/dist-esm/src/models/parameters.js.map +0 -1
- package/dist-esm/src/operations/index.d.ts +0 -3
- package/dist-esm/src/operations/index.js.map +0 -1
- package/dist-esm/src/operations/rateCard.d.ts.map +0 -1
- package/dist-esm/src/operations/rateCard.js.map +0 -1
- package/dist-esm/src/operations/usageAggregates.d.ts.map +0 -1
- package/dist-esm/src/operations/usageAggregates.js.map +0 -1
- package/dist-esm/src/operationsInterfaces/index.d.ts +0 -3
- package/dist-esm/src/operationsInterfaces/index.js.map +0 -1
- package/dist-esm/src/operationsInterfaces/rateCard.d.ts.map +0 -1
- package/dist-esm/src/operationsInterfaces/rateCard.js.map +0 -1
- package/dist-esm/src/operationsInterfaces/usageAggregates.d.ts.map +0 -1
- package/dist-esm/src/operationsInterfaces/usageAggregates.js.map +0 -1
- package/dist-esm/src/pagingHelper.js.map +0 -1
- package/dist-esm/src/usageManagementClient.d.ts.map +0 -1
- package/dist-esm/src/usageManagementClient.js.map +0 -1
- package/dist-esm/test/commerce_examples.d.ts +0 -4
- package/dist-esm/test/commerce_examples.d.ts.map +0 -1
- package/dist-esm/test/commerce_examples.js +0 -60
- package/dist-esm/test/commerce_examples.js.map +0 -1
- package/src/models/index.ts +0 -211
- package/src/models/mappers.ts +0 -460
- package/src/models/parameters.ts +0 -137
- package/src/operations/rateCard.ts +0 -69
- package/src/operations/usageAggregates.ts +0 -206
- package/src/operationsInterfaces/index.ts +0 -10
- package/src/operationsInterfaces/rateCard.ts +0 -30
- package/src/operationsInterfaces/usageAggregates.ts +0 -26
- package/src/pagingHelper.ts +0 -39
- package/src/usageManagementClient.ts +0 -143
- package/tsconfig.json +0 -33
- /package/{dist-esm/src → dist/browser}/models/index.d.ts +0 -0
- /package/{dist-esm/src → dist/browser}/models/index.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/models/index.js +0 -0
- /package/{dist-esm/src → dist/browser}/models/mappers.d.ts +0 -0
- /package/{dist-esm/src → dist/browser}/models/mappers.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/models/mappers.js +0 -0
- /package/{dist-esm/src → dist/browser}/models/parameters.d.ts +0 -0
- /package/{dist-esm/src → dist/browser}/models/parameters.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/models/parameters.js +0 -0
- /package/{dist-esm/src → dist/browser}/operationsInterfaces/rateCard.js +0 -0
- /package/{dist-esm/src → dist/browser}/operationsInterfaces/usageAggregates.js +0 -0
- /package/{dist-esm/src → dist/browser}/pagingHelper.d.ts +0 -0
- /package/{dist-esm/src → dist/browser}/pagingHelper.d.ts.map +0 -0
- /package/{dist-esm/src → dist/browser}/pagingHelper.js +0 -0
- /package/{types → dist/commonjs}/tsdoc-metadata.json +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
*/
|
|
8
|
+
import * as coreClient from "@azure/core-client";
|
|
9
|
+
import * as Mappers from "../models/mappers.js";
|
|
10
|
+
import * as Parameters from "../models/parameters.js";
|
|
11
|
+
/** Class containing RateCard operations. */
|
|
12
|
+
export class RateCardImpl {
|
|
13
|
+
/**
|
|
14
|
+
* Initialize a new instance of the class RateCard class.
|
|
15
|
+
* @param client Reference to the service client
|
|
16
|
+
*/
|
|
17
|
+
constructor(client) {
|
|
18
|
+
this.client = client;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Enables you to query for the resource/meter metadata and related prices used in a given subscription
|
|
22
|
+
* by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including
|
|
23
|
+
* but not limited to service names, types, resources, units of measure, and regions, is subject to
|
|
24
|
+
* change at any time and without notice. If you intend to use this billing data in an automated
|
|
25
|
+
* fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing
|
|
26
|
+
* meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the
|
|
27
|
+
* change.
|
|
28
|
+
* @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical
|
|
29
|
+
* operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region'
|
|
30
|
+
* are required to be a part of the $filter.
|
|
31
|
+
* @param options The options parameters.
|
|
32
|
+
*/
|
|
33
|
+
get(filter, options) {
|
|
34
|
+
return this.client.sendOperationRequest({ filter, options }, getOperationSpec);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Operation Specifications
|
|
38
|
+
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
|
|
39
|
+
const getOperationSpec = {
|
|
40
|
+
path: "/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/RateCard",
|
|
41
|
+
httpMethod: "GET",
|
|
42
|
+
responses: {
|
|
43
|
+
200: {
|
|
44
|
+
bodyMapper: Mappers.ResourceRateCardInfo
|
|
45
|
+
},
|
|
46
|
+
default: {
|
|
47
|
+
bodyMapper: Mappers.ErrorResponse
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
queryParameters: [Parameters.apiVersion, Parameters.filter],
|
|
51
|
+
urlParameters: [Parameters.$host, Parameters.subscriptionId],
|
|
52
|
+
headerParameters: [Parameters.accept],
|
|
53
|
+
serializer
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=rateCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rateCard.js","sourceRoot":"","sources":["../../../src/operations/rateCard.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,UAAU,MAAM,yBAAyB,CAAC;AAItD,4CAA4C;AAC5C,MAAM,OAAO,YAAY;IAGvB;;;OAGG;IACH,YAAY,MAA6B;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,GAAG,CACD,MAAc,EACd,OAAmC;QAEnC,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CACrC,EAAE,MAAM,EAAE,OAAO,EAAE,EACnB,gBAAgB,CACjB,CAAC;IACJ,CAAC;CACF;AACD,2BAA2B;AAC3B,MAAM,UAAU,GAAG,UAAU,CAAC,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;AAE3E,MAAM,gBAAgB,GAA6B;IACjD,IAAI,EAAE,uEAAuE;IAC7E,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,oBAAoB;SACzC;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;KACF;IACD,eAAe,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC;IAC3D,aAAa,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC;IAC5D,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;IACrC,UAAU;CACX,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport { RateCard } from \"../operationsInterfaces/index.js\";\nimport * as coreClient from \"@azure/core-client\";\nimport * as Mappers from \"../models/mappers.js\";\nimport * as Parameters from \"../models/parameters.js\";\nimport { UsageManagementClient } from \"../usageManagementClient.js\";\nimport { RateCardGetOptionalParams, RateCardGetResponse } from \"../models/index.js\";\n\n/** Class containing RateCard operations. */\nexport class RateCardImpl implements RateCard {\n private readonly client: UsageManagementClient;\n\n /**\n * Initialize a new instance of the class RateCard class.\n * @param client Reference to the service client\n */\n constructor(client: UsageManagementClient) {\n this.client = client;\n }\n\n /**\n * Enables you to query for the resource/meter metadata and related prices used in a given subscription\n * by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including\n * but not limited to service names, types, resources, units of measure, and regions, is subject to\n * change at any time and without notice. If you intend to use this billing data in an automated\n * fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing\n * meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the\n * change.\n * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical\n * operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region'\n * are required to be a part of the $filter.\n * @param options The options parameters.\n */\n get(\n filter: string,\n options?: RateCardGetOptionalParams\n ): Promise<RateCardGetResponse> {\n return this.client.sendOperationRequest(\n { filter, options },\n getOperationSpec\n );\n }\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst getOperationSpec: coreClient.OperationSpec = {\n path: \"/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/RateCard\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.ResourceRateCardInfo\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n queryParameters: [Parameters.apiVersion, Parameters.filter],\n urlParameters: [Parameters.$host, Parameters.subscriptionId],\n headerParameters: [Parameters.accept],\n serializer\n};\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { PagedAsyncIterableIterator } from "@azure/core-paging";
|
|
2
|
+
import { UsageAggregates } from "../operationsInterfaces/index.js";
|
|
3
|
+
import { UsageManagementClient } from "../usageManagementClient.js";
|
|
4
|
+
import { UsageAggregation, UsageAggregatesListOptionalParams } from "../models/index.js";
|
|
5
|
+
/** Class containing UsageAggregates operations. */
|
|
6
|
+
export declare class UsageAggregatesImpl implements UsageAggregates {
|
|
7
|
+
private readonly client;
|
|
8
|
+
/**
|
|
9
|
+
* Initialize a new instance of the class UsageAggregates class.
|
|
10
|
+
* @param client Reference to the service client
|
|
11
|
+
*/
|
|
12
|
+
constructor(client: UsageManagementClient);
|
|
13
|
+
/**
|
|
14
|
+
* Query aggregated Azure subscription consumption data for a date range.
|
|
15
|
+
* @param reportedStartTime The start of the time range to retrieve data for.
|
|
16
|
+
* @param reportedEndTime The end of the time range to retrieve data for.
|
|
17
|
+
* @param options The options parameters.
|
|
18
|
+
*/
|
|
19
|
+
list(reportedStartTime: Date, reportedEndTime: Date, options?: UsageAggregatesListOptionalParams): PagedAsyncIterableIterator<UsageAggregation>;
|
|
20
|
+
private listPagingPage;
|
|
21
|
+
private listPagingAll;
|
|
22
|
+
/**
|
|
23
|
+
* Query aggregated Azure subscription consumption data for a date range.
|
|
24
|
+
* @param reportedStartTime The start of the time range to retrieve data for.
|
|
25
|
+
* @param reportedEndTime The end of the time range to retrieve data for.
|
|
26
|
+
* @param options The options parameters.
|
|
27
|
+
*/
|
|
28
|
+
private _list;
|
|
29
|
+
/**
|
|
30
|
+
* ListNext
|
|
31
|
+
* @param reportedStartTime The start of the time range to retrieve data for.
|
|
32
|
+
* @param reportedEndTime The end of the time range to retrieve data for.
|
|
33
|
+
* @param nextLink The nextLink from the previous successful call to the List method.
|
|
34
|
+
* @param options The options parameters.
|
|
35
|
+
*/
|
|
36
|
+
private _listNext;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=usageAggregates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usageAggregates.d.ts","sourceRoot":"","sources":["../../../src/operations/usageAggregates.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,0BAA0B,EAAgB,MAAM,oBAAoB,CAAC;AAE9E,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAInE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EACL,gBAAgB,EAEhB,iCAAiC,EAGlC,MAAM,oBAAoB,CAAC;AAG5B,mDAAmD;AACnD,qBAAa,mBAAoB,YAAW,eAAe;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;IAE/C;;;OAGG;gBACS,MAAM,EAAE,qBAAqB;IAIzC;;;;;OAKG;IACI,IAAI,CACT,iBAAiB,EAAE,IAAI,EACvB,eAAe,EAAE,IAAI,EACrB,OAAO,CAAC,EAAE,iCAAiC,GAC1C,0BAA0B,CAAC,gBAAgB,CAAC;YA2BhC,cAAc;YA6Bd,aAAa;IAc5B;;;;;OAKG;IACH,OAAO,CAAC,KAAK;IAWb;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;CAWlB"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
*/
|
|
8
|
+
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
|
9
|
+
import { setContinuationToken } from "../pagingHelper.js";
|
|
10
|
+
import * as coreClient from "@azure/core-client";
|
|
11
|
+
import * as Mappers from "../models/mappers.js";
|
|
12
|
+
import * as Parameters from "../models/parameters.js";
|
|
13
|
+
/// <reference lib="esnext.asynciterable" />
|
|
14
|
+
/** Class containing UsageAggregates operations. */
|
|
15
|
+
export class UsageAggregatesImpl {
|
|
16
|
+
/**
|
|
17
|
+
* Initialize a new instance of the class UsageAggregates class.
|
|
18
|
+
* @param client Reference to the service client
|
|
19
|
+
*/
|
|
20
|
+
constructor(client) {
|
|
21
|
+
this.client = client;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Query aggregated Azure subscription consumption data for a date range.
|
|
25
|
+
* @param reportedStartTime The start of the time range to retrieve data for.
|
|
26
|
+
* @param reportedEndTime The end of the time range to retrieve data for.
|
|
27
|
+
* @param options The options parameters.
|
|
28
|
+
*/
|
|
29
|
+
list(reportedStartTime, reportedEndTime, options) {
|
|
30
|
+
const iter = this.listPagingAll(reportedStartTime, reportedEndTime, options);
|
|
31
|
+
return {
|
|
32
|
+
next() {
|
|
33
|
+
return iter.next();
|
|
34
|
+
},
|
|
35
|
+
[Symbol.asyncIterator]() {
|
|
36
|
+
return this;
|
|
37
|
+
},
|
|
38
|
+
byPage: (settings) => {
|
|
39
|
+
if (settings === null || settings === void 0 ? void 0 : settings.maxPageSize) {
|
|
40
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
41
|
+
}
|
|
42
|
+
return this.listPagingPage(reportedStartTime, reportedEndTime, options, settings);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
listPagingPage(reportedStartTime, reportedEndTime, options, settings) {
|
|
47
|
+
return __asyncGenerator(this, arguments, function* listPagingPage_1() {
|
|
48
|
+
let result;
|
|
49
|
+
let continuationToken = settings === null || settings === void 0 ? void 0 : settings.continuationToken;
|
|
50
|
+
if (!continuationToken) {
|
|
51
|
+
result = yield __await(this._list(reportedStartTime, reportedEndTime, options));
|
|
52
|
+
let page = result.value || [];
|
|
53
|
+
continuationToken = result.nextLink;
|
|
54
|
+
setContinuationToken(page, continuationToken);
|
|
55
|
+
yield yield __await(page);
|
|
56
|
+
}
|
|
57
|
+
while (continuationToken) {
|
|
58
|
+
result = yield __await(this._listNext(reportedStartTime, reportedEndTime, continuationToken, options));
|
|
59
|
+
continuationToken = result.nextLink;
|
|
60
|
+
let page = result.value || [];
|
|
61
|
+
setContinuationToken(page, continuationToken);
|
|
62
|
+
yield yield __await(page);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
listPagingAll(reportedStartTime, reportedEndTime, options) {
|
|
67
|
+
return __asyncGenerator(this, arguments, function* listPagingAll_1() {
|
|
68
|
+
var _a, e_1, _b, _c;
|
|
69
|
+
try {
|
|
70
|
+
for (var _d = true, _e = __asyncValues(this.listPagingPage(reportedStartTime, reportedEndTime, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) {
|
|
71
|
+
_c = _f.value;
|
|
72
|
+
_d = false;
|
|
73
|
+
const page = _c;
|
|
74
|
+
yield __await(yield* __asyncDelegator(__asyncValues(page)));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
78
|
+
finally {
|
|
79
|
+
try {
|
|
80
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
|
81
|
+
}
|
|
82
|
+
finally { if (e_1) throw e_1.error; }
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Query aggregated Azure subscription consumption data for a date range.
|
|
88
|
+
* @param reportedStartTime The start of the time range to retrieve data for.
|
|
89
|
+
* @param reportedEndTime The end of the time range to retrieve data for.
|
|
90
|
+
* @param options The options parameters.
|
|
91
|
+
*/
|
|
92
|
+
_list(reportedStartTime, reportedEndTime, options) {
|
|
93
|
+
return this.client.sendOperationRequest({ reportedStartTime, reportedEndTime, options }, listOperationSpec);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* ListNext
|
|
97
|
+
* @param reportedStartTime The start of the time range to retrieve data for.
|
|
98
|
+
* @param reportedEndTime The end of the time range to retrieve data for.
|
|
99
|
+
* @param nextLink The nextLink from the previous successful call to the List method.
|
|
100
|
+
* @param options The options parameters.
|
|
101
|
+
*/
|
|
102
|
+
_listNext(reportedStartTime, reportedEndTime, nextLink, options) {
|
|
103
|
+
return this.client.sendOperationRequest({ reportedStartTime, reportedEndTime, nextLink, options }, listNextOperationSpec);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Operation Specifications
|
|
107
|
+
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
|
|
108
|
+
const listOperationSpec = {
|
|
109
|
+
path: "/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/UsageAggregates",
|
|
110
|
+
httpMethod: "GET",
|
|
111
|
+
responses: {
|
|
112
|
+
200: {
|
|
113
|
+
bodyMapper: Mappers.UsageAggregationListResult
|
|
114
|
+
},
|
|
115
|
+
default: {
|
|
116
|
+
bodyMapper: Mappers.ErrorResponse
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
queryParameters: [
|
|
120
|
+
Parameters.reportedStartTime,
|
|
121
|
+
Parameters.reportedEndTime,
|
|
122
|
+
Parameters.showDetails,
|
|
123
|
+
Parameters.aggregationGranularity,
|
|
124
|
+
Parameters.continuationToken,
|
|
125
|
+
Parameters.apiVersion
|
|
126
|
+
],
|
|
127
|
+
urlParameters: [Parameters.$host, Parameters.subscriptionId],
|
|
128
|
+
headerParameters: [Parameters.accept],
|
|
129
|
+
serializer
|
|
130
|
+
};
|
|
131
|
+
const listNextOperationSpec = {
|
|
132
|
+
path: "{nextLink}",
|
|
133
|
+
httpMethod: "GET",
|
|
134
|
+
responses: {
|
|
135
|
+
200: {
|
|
136
|
+
bodyMapper: Mappers.UsageAggregationListResult
|
|
137
|
+
},
|
|
138
|
+
default: {
|
|
139
|
+
bodyMapper: Mappers.ErrorResponse
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
queryParameters: [
|
|
143
|
+
Parameters.reportedStartTime,
|
|
144
|
+
Parameters.reportedEndTime,
|
|
145
|
+
Parameters.showDetails,
|
|
146
|
+
Parameters.aggregationGranularity,
|
|
147
|
+
Parameters.continuationToken,
|
|
148
|
+
Parameters.apiVersion
|
|
149
|
+
],
|
|
150
|
+
urlParameters: [
|
|
151
|
+
Parameters.$host,
|
|
152
|
+
Parameters.subscriptionId,
|
|
153
|
+
Parameters.nextLink
|
|
154
|
+
],
|
|
155
|
+
headerParameters: [Parameters.accept],
|
|
156
|
+
serializer
|
|
157
|
+
};
|
|
158
|
+
//# sourceMappingURL=usageAggregates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usageAggregates.js","sourceRoot":"","sources":["../../../src/operations/usageAggregates.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,KAAK,UAAU,MAAM,yBAAyB,CAAC;AAUtD,4CAA4C;AAC5C,mDAAmD;AACnD,MAAM,OAAO,mBAAmB;IAG9B;;;OAGG;IACH,YAAY,MAA6B;QACvC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACI,IAAI,CACT,iBAAuB,EACvB,eAAqB,EACrB,OAA2C;QAE3C,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAC7B,iBAAiB,EACjB,eAAe,EACf,OAAO,CACR,CAAC;QACF,OAAO;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AAE;QACf,UAAU,CAAC,iBAAiB;QAC5B,UAAU,CAAC,eAAe;QAC1B,UAAU,CAAC,WAAW;QACtB,UAAU,CAAC,sBAAsB;QACjC,UAAU,CAAC,iBAAiB;QAC5B,UAAU,CAAC,UAAU;KACtB;IACD,aAAa,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC;IAC5D,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;IACrC,UAAU;CACX,CAAC;AACF,MAAM,qBAAqB,GAA6B;IACtD,IAAI,EAAE,YAAY;IAClB,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE;QACT,GAAG,EAAE;YACH,UAAU,EAAE,OAAO,CAAC,0BAA0B;SAC/C;QACD,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,aAAa;SAClC;KACF;IACD,eAAe,EAAE;QACf,UAAU,CAAC,iBAAiB;QAC5B,UAAU,CAAC,eAAe;QAC1B,UAAU,CAAC,WAAW;QACtB,UAAU,CAAC,sBAAsB;QACjC,UAAU,CAAC,iBAAiB;QAC5B,UAAU,CAAC,UAAU;KACtB;IACD,aAAa,EAAE;QACb,UAAU,CAAC,KAAK;QAChB,UAAU,CAAC,cAAc;QACzB,UAAU,CAAC,QAAQ;KACpB;IACD,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;IACrC,UAAU;CACX,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport { PagedAsyncIterableIterator, PageSettings } from \"@azure/core-paging\";\nimport { setContinuationToken } from \"../pagingHelper.js\";\nimport { UsageAggregates } from \"../operationsInterfaces/index.js\";\nimport * as coreClient from \"@azure/core-client\";\nimport * as Mappers from \"../models/mappers.js\";\nimport * as Parameters from \"../models/parameters.js\";\nimport { UsageManagementClient } from \"../usageManagementClient.js\";\nimport {\n UsageAggregation,\n UsageAggregatesListNextOptionalParams,\n UsageAggregatesListOptionalParams,\n UsageAggregatesListResponse,\n UsageAggregatesListNextResponse\n} from \"../models/index.js\";\n\n/// <reference lib=\"esnext.asynciterable\" />\n/** Class containing UsageAggregates operations. */\nexport class UsageAggregatesImpl implements UsageAggregates {\n private readonly client: UsageManagementClient;\n\n /**\n * Initialize a new instance of the class UsageAggregates class.\n * @param client Reference to the service client\n */\n constructor(client: UsageManagementClient) {\n this.client = client;\n }\n\n /**\n * Query aggregated Azure subscription consumption data for a date range.\n * @param reportedStartTime The start of the time range to retrieve data for.\n * @param reportedEndTime The end of the time range to retrieve data for.\n * @param options The options parameters.\n */\n public list(\n reportedStartTime: Date,\n reportedEndTime: Date,\n options?: UsageAggregatesListOptionalParams\n ): PagedAsyncIterableIterator<UsageAggregation> {\n const iter = this.listPagingAll(\n reportedStartTime,\n reportedEndTime,\n options\n );\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings?: PageSettings) => {\n if (settings?.maxPageSize) {\n throw new Error(\"maxPageSize is not supported by this operation.\");\n }\n return this.listPagingPage(\n reportedStartTime,\n reportedEndTime,\n options,\n settings\n );\n }\n };\n }\n\n private async *listPagingPage(\n reportedStartTime: Date,\n reportedEndTime: Date,\n options?: UsageAggregatesListOptionalParams,\n settings?: PageSettings\n ): AsyncIterableIterator<UsageAggregation[]> {\n let result: UsageAggregatesListResponse;\n let continuationToken = settings?.continuationToken;\n if (!continuationToken) {\n result = await this._list(reportedStartTime, reportedEndTime, options);\n let page = result.value || [];\n continuationToken = result.nextLink;\n setContinuationToken(page, continuationToken);\n yield page;\n }\n while (continuationToken) {\n result = await this._listNext(\n reportedStartTime,\n reportedEndTime,\n continuationToken,\n options\n );\n continuationToken = result.nextLink;\n let page = result.value || [];\n setContinuationToken(page, continuationToken);\n yield page;\n }\n }\n\n private async *listPagingAll(\n reportedStartTime: Date,\n reportedEndTime: Date,\n options?: UsageAggregatesListOptionalParams\n ): AsyncIterableIterator<UsageAggregation> {\n for await (const page of this.listPagingPage(\n reportedStartTime,\n reportedEndTime,\n options\n )) {\n yield* page;\n }\n }\n\n /**\n * Query aggregated Azure subscription consumption data for a date range.\n * @param reportedStartTime The start of the time range to retrieve data for.\n * @param reportedEndTime The end of the time range to retrieve data for.\n * @param options The options parameters.\n */\n private _list(\n reportedStartTime: Date,\n reportedEndTime: Date,\n options?: UsageAggregatesListOptionalParams\n ): Promise<UsageAggregatesListResponse> {\n return this.client.sendOperationRequest(\n { reportedStartTime, reportedEndTime, options },\n listOperationSpec\n );\n }\n\n /**\n * ListNext\n * @param reportedStartTime The start of the time range to retrieve data for.\n * @param reportedEndTime The end of the time range to retrieve data for.\n * @param nextLink The nextLink from the previous successful call to the List method.\n * @param options The options parameters.\n */\n private _listNext(\n reportedStartTime: Date,\n reportedEndTime: Date,\n nextLink: string,\n options?: UsageAggregatesListNextOptionalParams\n ): Promise<UsageAggregatesListNextResponse> {\n return this.client.sendOperationRequest(\n { reportedStartTime, reportedEndTime, nextLink, options },\n listNextOperationSpec\n );\n }\n}\n// Operation Specifications\nconst serializer = coreClient.createSerializer(Mappers, /* isXml */ false);\n\nconst listOperationSpec: coreClient.OperationSpec = {\n path:\n \"/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/UsageAggregates\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.UsageAggregationListResult\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n queryParameters: [\n Parameters.reportedStartTime,\n Parameters.reportedEndTime,\n Parameters.showDetails,\n Parameters.aggregationGranularity,\n Parameters.continuationToken,\n Parameters.apiVersion\n ],\n urlParameters: [Parameters.$host, Parameters.subscriptionId],\n headerParameters: [Parameters.accept],\n serializer\n};\nconst listNextOperationSpec: coreClient.OperationSpec = {\n path: \"{nextLink}\",\n httpMethod: \"GET\",\n responses: {\n 200: {\n bodyMapper: Mappers.UsageAggregationListResult\n },\n default: {\n bodyMapper: Mappers.ErrorResponse\n }\n },\n queryParameters: [\n Parameters.reportedStartTime,\n Parameters.reportedEndTime,\n Parameters.showDetails,\n Parameters.aggregationGranularity,\n Parameters.continuationToken,\n Parameters.apiVersion\n ],\n urlParameters: [\n Parameters.$host,\n Parameters.subscriptionId,\n Parameters.nextLink\n ],\n headerParameters: [Parameters.accept],\n serializer\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/operationsInterfaces/index.ts"],"names":[],"mappings":"AAQA,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
*/
|
|
8
|
+
export * from "./usageAggregates.js";
|
|
9
|
+
export * from "./rateCard.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/operationsInterfaces/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nexport * from \"./usageAggregates.js\";\nexport * from \"./rateCard.js\";\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RateCardGetOptionalParams, RateCardGetResponse } from "../models/index.js";
|
|
2
|
+
/** Interface representing a RateCard. */
|
|
3
|
+
export interface RateCard {
|
|
4
|
+
/**
|
|
5
|
+
* Enables you to query for the resource/meter metadata and related prices used in a given subscription
|
|
6
|
+
* by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including
|
|
7
|
+
* but not limited to service names, types, resources, units of measure, and regions, is subject to
|
|
8
|
+
* change at any time and without notice. If you intend to use this billing data in an automated
|
|
9
|
+
* fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing
|
|
10
|
+
* meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the
|
|
11
|
+
* change.
|
|
12
|
+
* @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical
|
|
13
|
+
* operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region'
|
|
14
|
+
* are required to be a part of the $filter.
|
|
15
|
+
* @param options The options parameters.
|
|
16
|
+
*/
|
|
17
|
+
get(filter: string, options?: RateCardGetOptionalParams): Promise<RateCardGetResponse>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=rateCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rateCard.d.ts","sourceRoot":"","sources":["../../../src/operationsInterfaces/rateCard.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEpF,yCAAyC;AACzC,MAAM,WAAW,QAAQ;IACvB;;;;;;;;;;;;OAYG;IACH,GAAG,CACD,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACjC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=rateCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rateCard.js","sourceRoot":"","sources":["../../../src/operationsInterfaces/rateCard.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport { RateCardGetOptionalParams, RateCardGetResponse } from \"../models/index.js\";\n\n/** Interface representing a RateCard. */\nexport interface RateCard {\n /**\n * Enables you to query for the resource/meter metadata and related prices used in a given subscription\n * by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including\n * but not limited to service names, types, resources, units of measure, and regions, is subject to\n * change at any time and without notice. If you intend to use this billing data in an automated\n * fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing\n * meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the\n * change.\n * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical\n * operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region'\n * are required to be a part of the $filter.\n * @param options The options parameters.\n */\n get(\n filter: string,\n options?: RateCardGetOptionalParams\n ): Promise<RateCardGetResponse>;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PagedAsyncIterableIterator } from "@azure/core-paging";
|
|
2
|
+
import { UsageAggregation, UsageAggregatesListOptionalParams } from "../models/index.js";
|
|
3
|
+
/** Interface representing a UsageAggregates. */
|
|
4
|
+
export interface UsageAggregates {
|
|
5
|
+
/**
|
|
6
|
+
* Query aggregated Azure subscription consumption data for a date range.
|
|
7
|
+
* @param reportedStartTime The start of the time range to retrieve data for.
|
|
8
|
+
* @param reportedEndTime The end of the time range to retrieve data for.
|
|
9
|
+
* @param options The options parameters.
|
|
10
|
+
*/
|
|
11
|
+
list(reportedStartTime: Date, reportedEndTime: Date, options?: UsageAggregatesListOptionalParams): PagedAsyncIterableIterator<UsageAggregation>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=usageAggregates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usageAggregates.d.ts","sourceRoot":"","sources":["../../../src/operationsInterfaces/usageAggregates.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,iCAAiC,EAAE,MAAM,oBAAoB,CAAC;AAGzF,gDAAgD;AAChD,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,IAAI,CACF,iBAAiB,EAAE,IAAI,EACvB,eAAe,EAAE,IAAI,EACrB,OAAO,CAAC,EAAE,iCAAiC,GAC1C,0BAA0B,CAAC,gBAAgB,CAAC,CAAC;CACjD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=usageAggregates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usageAggregates.js","sourceRoot":"","sources":["../../../src/operationsInterfaces/usageAggregates.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { UsageAggregation, UsageAggregatesListOptionalParams } from \"../models/index.js\";\n\n/// <reference lib=\"esnext.asynciterable\" />\n/** Interface representing a UsageAggregates. */\nexport interface UsageAggregates {\n /**\n * Query aggregated Azure subscription consumption data for a date range.\n * @param reportedStartTime The start of the time range to retrieve data for.\n * @param reportedEndTime The end of the time range to retrieve data for.\n * @param options The options parameters.\n */\n list(\n reportedStartTime: Date,\n reportedEndTime: Date,\n options?: UsageAggregatesListOptionalParams\n ): PagedAsyncIterableIterator<UsageAggregation>;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface PageInfo {
|
|
2
|
+
continuationToken?: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Given a result page from a pageable operation, returns a
|
|
6
|
+
* continuation token that can be used to begin paging from
|
|
7
|
+
* that point later.
|
|
8
|
+
* @param page A result object from calling .byPage() on a paged operation.
|
|
9
|
+
* @returns The continuation token that can be passed into byPage().
|
|
10
|
+
*/
|
|
11
|
+
export declare function getContinuationToken(page: unknown): string | undefined;
|
|
12
|
+
export declare function setContinuationToken(page: unknown, continuationToken: string | undefined): void;
|
|
13
|
+
//# sourceMappingURL=pagingHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagingHelper.d.ts","sourceRoot":"","sources":["../../src/pagingHelper.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,QAAQ;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAID;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAKtE;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,OAAO,EACb,iBAAiB,EAAE,MAAM,GAAG,SAAS,GACpC,IAAI,CAON"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
*/
|
|
8
|
+
const pageMap = new WeakMap();
|
|
9
|
+
/**
|
|
10
|
+
* Given a result page from a pageable operation, returns a
|
|
11
|
+
* continuation token that can be used to begin paging from
|
|
12
|
+
* that point later.
|
|
13
|
+
* @param page A result object from calling .byPage() on a paged operation.
|
|
14
|
+
* @returns The continuation token that can be passed into byPage().
|
|
15
|
+
*/
|
|
16
|
+
export function getContinuationToken(page) {
|
|
17
|
+
var _a;
|
|
18
|
+
if (typeof page !== "object" || page === null) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
return (_a = pageMap.get(page)) === null || _a === void 0 ? void 0 : _a.continuationToken;
|
|
22
|
+
}
|
|
23
|
+
export function setContinuationToken(page, continuationToken) {
|
|
24
|
+
var _a;
|
|
25
|
+
if (typeof page !== "object" || page === null || !continuationToken) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const pageInfo = (_a = pageMap.get(page)) !== null && _a !== void 0 ? _a : {};
|
|
29
|
+
pageInfo.continuationToken = continuationToken;
|
|
30
|
+
pageMap.set(page, pageInfo);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=pagingHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagingHelper.js","sourceRoot":"","sources":["../../src/pagingHelper.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,MAAM,OAAO,GAAG,IAAI,OAAO,EAAoB,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAa;;IAChD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAC9C,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,MAAA,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,0CAAE,iBAAiB,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,IAAa,EACb,iBAAqC;;IAErC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACpE,OAAO;IACT,CAAC;IACD,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC;IACzC,QAAQ,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nexport interface PageInfo {\n continuationToken?: string;\n}\n\nconst pageMap = new WeakMap<object, PageInfo>();\n\n/**\n * Given a result page from a pageable operation, returns a\n * continuation token that can be used to begin paging from\n * that point later.\n * @param page A result object from calling .byPage() on a paged operation.\n * @returns The continuation token that can be passed into byPage().\n */\nexport function getContinuationToken(page: unknown): string | undefined {\n if (typeof page !== \"object\" || page === null) {\n return undefined;\n }\n return pageMap.get(page)?.continuationToken;\n}\n\nexport function setContinuationToken(\n page: unknown,\n continuationToken: string | undefined\n): void {\n if (typeof page !== \"object\" || page === null || !continuationToken) {\n return;\n }\n const pageInfo = pageMap.get(page) ?? {};\n pageInfo.continuationToken = continuationToken;\n pageMap.set(page, pageInfo);\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as coreClient from "@azure/core-client";
|
|
2
|
+
import * as coreAuth from "@azure/core-auth";
|
|
3
|
+
import { UsageAggregates, RateCard } from "./operationsInterfaces/index.js";
|
|
4
|
+
import { UsageManagementClientOptionalParams } from "./models/index.js";
|
|
5
|
+
export declare class UsageManagementClient extends coreClient.ServiceClient {
|
|
6
|
+
$host: string;
|
|
7
|
+
apiVersion: string;
|
|
8
|
+
subscriptionId: string;
|
|
9
|
+
/**
|
|
10
|
+
* Initializes a new instance of the UsageManagementClient class.
|
|
11
|
+
* @param credentials Subscription credentials which uniquely identify client subscription.
|
|
12
|
+
* @param subscriptionId It uniquely identifies Microsoft Azure subscription. The subscription ID forms
|
|
13
|
+
* part of the URI for every service call.
|
|
14
|
+
* @param options The parameter options
|
|
15
|
+
*/
|
|
16
|
+
constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: UsageManagementClientOptionalParams);
|
|
17
|
+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
|
|
18
|
+
private addCustomApiVersionPolicy;
|
|
19
|
+
usageAggregates: UsageAggregates;
|
|
20
|
+
rateCard: RateCard;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=usageManagementClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usageManagementClient.d.ts","sourceRoot":"","sources":["../../src/usageManagementClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAOjD,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,mCAAmC,EAAE,MAAM,mBAAmB,CAAC;AAExE,qBAAa,qBAAsB,SAAQ,UAAU,CAAC,aAAa;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;;;OAMG;gBAED,WAAW,EAAE,QAAQ,CAAC,eAAe,EACrC,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,mCAAmC;IA6E/C,8GAA8G;IAC9G,OAAO,CAAC,yBAAyB;IA2BjC,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,QAAQ,CAAC;CACpB"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
*/
|
|
8
|
+
import * as coreClient from "@azure/core-client";
|
|
9
|
+
import * as coreRestPipeline from "@azure/core-rest-pipeline";
|
|
10
|
+
import { UsageAggregatesImpl, RateCardImpl } from "./operations/index.js";
|
|
11
|
+
export class UsageManagementClient extends coreClient.ServiceClient {
|
|
12
|
+
/**
|
|
13
|
+
* Initializes a new instance of the UsageManagementClient class.
|
|
14
|
+
* @param credentials Subscription credentials which uniquely identify client subscription.
|
|
15
|
+
* @param subscriptionId It uniquely identifies Microsoft Azure subscription. The subscription ID forms
|
|
16
|
+
* part of the URI for every service call.
|
|
17
|
+
* @param options The parameter options
|
|
18
|
+
*/
|
|
19
|
+
constructor(credentials, subscriptionId, options) {
|
|
20
|
+
var _a, _b, _c;
|
|
21
|
+
if (credentials === undefined) {
|
|
22
|
+
throw new Error("'credentials' cannot be null");
|
|
23
|
+
}
|
|
24
|
+
if (subscriptionId === undefined) {
|
|
25
|
+
throw new Error("'subscriptionId' cannot be null");
|
|
26
|
+
}
|
|
27
|
+
// Initializing default values for options
|
|
28
|
+
if (!options) {
|
|
29
|
+
options = {};
|
|
30
|
+
}
|
|
31
|
+
const defaults = {
|
|
32
|
+
requestContentType: "application/json; charset=utf-8",
|
|
33
|
+
credential: credentials
|
|
34
|
+
};
|
|
35
|
+
const packageDetails = `azsdk-js-arm-commerce/4.0.0-beta.4`;
|
|
36
|
+
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
37
|
+
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
38
|
+
: `${packageDetails}`;
|
|
39
|
+
const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
|
|
40
|
+
userAgentPrefix
|
|
41
|
+
}, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "https://management.azure.com" });
|
|
42
|
+
super(optionsWithDefaults);
|
|
43
|
+
let bearerTokenAuthenticationPolicyFound = false;
|
|
44
|
+
if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
|
|
45
|
+
const pipelinePolicies = options.pipeline.getOrderedPolicies();
|
|
46
|
+
bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
|
|
47
|
+
coreRestPipeline.bearerTokenAuthenticationPolicyName);
|
|
48
|
+
}
|
|
49
|
+
if (!options ||
|
|
50
|
+
!options.pipeline ||
|
|
51
|
+
options.pipeline.getOrderedPolicies().length == 0 ||
|
|
52
|
+
!bearerTokenAuthenticationPolicyFound) {
|
|
53
|
+
this.pipeline.removePolicy({
|
|
54
|
+
name: coreRestPipeline.bearerTokenAuthenticationPolicyName
|
|
55
|
+
});
|
|
56
|
+
this.pipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
57
|
+
credential: credentials,
|
|
58
|
+
scopes: (_c = optionsWithDefaults.credentialScopes) !== null && _c !== void 0 ? _c : `${optionsWithDefaults.endpoint}/.default`,
|
|
59
|
+
challengeCallbacks: {
|
|
60
|
+
authorizeRequestOnChallenge: coreClient.authorizeRequestOnClaimChallenge
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
// Parameter assignments
|
|
65
|
+
this.subscriptionId = subscriptionId;
|
|
66
|
+
// Assigning values to Constant parameters
|
|
67
|
+
this.$host = options.$host || "https://management.azure.com";
|
|
68
|
+
this.apiVersion = options.apiVersion || "2015-06-01-preview";
|
|
69
|
+
this.usageAggregates = new UsageAggregatesImpl(this);
|
|
70
|
+
this.rateCard = new RateCardImpl(this);
|
|
71
|
+
this.addCustomApiVersionPolicy(options.apiVersion);
|
|
72
|
+
}
|
|
73
|
+
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
|
|
74
|
+
addCustomApiVersionPolicy(apiVersion) {
|
|
75
|
+
if (!apiVersion) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const apiVersionPolicy = {
|
|
79
|
+
name: "CustomApiVersionPolicy",
|
|
80
|
+
async sendRequest(request, next) {
|
|
81
|
+
const param = request.url.split("?");
|
|
82
|
+
if (param.length > 1) {
|
|
83
|
+
const newParams = param[1].split("&").map((item) => {
|
|
84
|
+
if (item.indexOf("api-version") > -1) {
|
|
85
|
+
return "api-version=" + apiVersion;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
return item;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
request.url = param[0] + "?" + newParams.join("&");
|
|
92
|
+
}
|
|
93
|
+
return next(request);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
this.pipeline.addPolicy(apiVersionPolicy);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=usageManagementClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usageManagementClient.js","sourceRoot":"","sources":["../../src/usageManagementClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,gBAAgB,MAAM,2BAA2B,CAAC;AAO9D,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI1E,MAAM,OAAO,qBAAsB,SAAQ,UAAU,CAAC,aAAa;IAKjE;;;;;;OAMG;IACH,YACE,WAAqC,EACrC,cAAsB,EACtB,OAA6C;;QAE7C,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;QACD,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;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AG,CAAC,CAAC,IAAI,EAAE,EAAE;wBACjD,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;4BACrC,OAAO,cAAc,GAAG,UAAU,CAAC;wBACrC,CAAC;6BAAM,CAAC;4BACN,OAAO,IAAI,CAAC;wBACd,CAAC;oBACH,CAAC,CAAC,CAAC;oBACH,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACrD,CAAC;gBACD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC;CAIF","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport * as coreRestPipeline from \"@azure/core-rest-pipeline\";\nimport {\n PipelineRequest,\n PipelineResponse,\n SendRequest\n} from \"@azure/core-rest-pipeline\";\nimport * as coreAuth from \"@azure/core-auth\";\nimport { UsageAggregatesImpl, RateCardImpl } from \"./operations/index.js\";\nimport { UsageAggregates, RateCard } from \"./operationsInterfaces/index.js\";\nimport { UsageManagementClientOptionalParams } from \"./models/index.js\";\n\nexport class UsageManagementClient extends coreClient.ServiceClient {\n $host: string;\n apiVersion: string;\n subscriptionId: string;\n\n /**\n * Initializes a new instance of the UsageManagementClient class.\n * @param credentials Subscription credentials which uniquely identify client subscription.\n * @param subscriptionId It uniquely identifies Microsoft Azure subscription. The subscription ID forms\n * part of the URI for every service call.\n * @param options The parameter options\n */\n constructor(\n credentials: coreAuth.TokenCredential,\n subscriptionId: string,\n options?: UsageManagementClientOptionalParams\n ) {\n if (credentials === undefined) {\n throw new Error(\"'credentials' cannot be null\");\n }\n if (subscriptionId === undefined) {\n throw new Error(\"'subscriptionId' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: UsageManagementClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\",\n credential: credentials\n };\n\n const packageDetails = `azsdk-js-arm-commerce/4.0.0-beta.4`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n endpoint:\n options.endpoint ?? options.baseUri ?? \"https://management.azure.com\"\n };\n super(optionsWithDefaults);\n\n let bearerTokenAuthenticationPolicyFound: boolean = false;\n if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {\n const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();\n bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(\n (pipelinePolicy) =>\n pipelinePolicy.name ===\n coreRestPipeline.bearerTokenAuthenticationPolicyName\n );\n }\n if (\n !options ||\n !options.pipeline ||\n options.pipeline.getOrderedPolicies().length == 0 ||\n !bearerTokenAuthenticationPolicyFound\n ) {\n this.pipeline.removePolicy({\n name: coreRestPipeline.bearerTokenAuthenticationPolicyName\n });\n this.pipeline.addPolicy(\n coreRestPipeline.bearerTokenAuthenticationPolicy({\n credential: credentials,\n scopes:\n optionsWithDefaults.credentialScopes ??\n `${optionsWithDefaults.endpoint}/.default`,\n challengeCallbacks: {\n authorizeRequestOnChallenge:\n coreClient.authorizeRequestOnClaimChallenge\n }\n })\n );\n }\n // Parameter assignments\n this.subscriptionId = subscriptionId;\n\n // Assigning values to Constant parameters\n this.$host = options.$host || \"https://management.azure.com\";\n this.apiVersion = options.apiVersion || \"2015-06-01-preview\";\n this.usageAggregates = new UsageAggregatesImpl(this);\n this.rateCard = new RateCardImpl(this);\n this.addCustomApiVersionPolicy(options.apiVersion);\n }\n\n /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */\n private addCustomApiVersionPolicy(apiVersion?: string) {\n if (!apiVersion) {\n return;\n }\n const apiVersionPolicy = {\n name: \"CustomApiVersionPolicy\",\n async sendRequest(\n request: PipelineRequest,\n next: SendRequest\n ): Promise<PipelineResponse> {\n const param = request.url.split(\"?\");\n if (param.length > 1) {\n const newParams = param[1].split(\"&\").map((item) => {\n if (item.indexOf(\"api-version\") > -1) {\n return \"api-version=\" + apiVersion;\n } else {\n return item;\n }\n });\n request.url = param[0] + \"?\" + newParams.join(\"&\");\n }\n return next(request);\n }\n };\n this.pipeline.addPolicy(apiVersionPolicy);\n }\n\n usageAggregates: UsageAggregates;\n rateCard: RateCard;\n}\n"]}
|