@azure/arm-commerce 3.0.0 → 4.0.0-beta.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/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/LICENSE.txt +1 -1
- package/README.md +70 -88
- package/dist/index.js +822 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +1 -0
- package/dist/index.min.js.map +1 -0
- package/dist-esm/samples-dev/getRateCard.d.ts +2 -0
- package/dist-esm/samples-dev/getRateCard.d.ts.map +1 -0
- package/dist-esm/samples-dev/getRateCard.js +30 -0
- package/dist-esm/samples-dev/getRateCard.js.map +1 -0
- package/dist-esm/src/index.d.ts +5 -0
- package/dist-esm/src/index.d.ts.map +1 -0
- package/dist-esm/src/index.js +12 -0
- package/dist-esm/src/index.js.map +1 -0
- package/dist-esm/src/models/index.d.ts +178 -0
- package/dist-esm/src/models/index.d.ts.map +1 -0
- package/{esm → dist-esm/src}/models/index.js +1 -0
- package/dist-esm/src/models/index.js.map +1 -0
- package/dist-esm/src/models/mappers.d.ts +19 -0
- package/dist-esm/src/models/mappers.d.ts.map +1 -0
- package/{esm → dist-esm/src}/models/mappers.js +129 -144
- package/dist-esm/src/models/mappers.js.map +1 -0
- package/dist-esm/src/models/parameters.d.ts +13 -0
- package/dist-esm/src/models/parameters.d.ts.map +1 -0
- package/{esm → dist-esm/src}/models/parameters.js +60 -60
- package/dist-esm/src/models/parameters.js.map +1 -0
- package/{esm → dist-esm/src}/operations/index.d.ts +0 -0
- package/dist-esm/src/operations/index.d.ts.map +1 -0
- package/{esm → dist-esm/src}/operations/index.js +1 -2
- package/dist-esm/src/operations/index.js.map +1 -0
- package/dist-esm/src/operations/rateCard.d.ts +27 -0
- package/dist-esm/src/operations/rateCard.d.ts.map +1 -0
- package/dist-esm/src/operations/rateCard.js +55 -0
- package/dist-esm/src/operations/rateCard.js.map +1 -0
- package/dist-esm/src/operations/usageAggregates.d.ts +38 -0
- package/dist-esm/src/operations/usageAggregates.d.ts.map +1 -0
- package/dist-esm/src/operations/usageAggregates.js +144 -0
- package/dist-esm/src/operations/usageAggregates.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/index.d.ts +3 -0
- package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
- package/{esm/models/usageAggregatesMappers.js → dist-esm/src/operationsInterfaces/index.js} +3 -2
- package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/rateCard.d.ts +19 -0
- package/dist-esm/src/operationsInterfaces/rateCard.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/rateCard.js +9 -0
- package/dist-esm/src/operationsInterfaces/rateCard.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/usageAggregates.d.ts +13 -0
- package/dist-esm/src/operationsInterfaces/usageAggregates.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/usageAggregates.js +9 -0
- package/dist-esm/src/operationsInterfaces/usageAggregates.js.map +1 -0
- package/dist-esm/src/usageManagementClient.d.ts +20 -0
- package/dist-esm/src/usageManagementClient.d.ts.map +1 -0
- package/dist-esm/src/usageManagementClient.js +53 -0
- package/dist-esm/src/usageManagementClient.js.map +1 -0
- package/dist-esm/test/commerce_examples.d.ts +4 -0
- package/dist-esm/test/commerce_examples.d.ts.map +1 -0
- package/dist-esm/test/commerce_examples.js +58 -0
- package/dist-esm/test/commerce_examples.js.map +1 -0
- package/package.json +75 -33
- package/review/arm-commerce.api.md +178 -0
- package/rollup.config.js +181 -30
- package/src/{models/rateCardMappers.ts → index.ts} +4 -10
- package/src/models/index.ts +140 -353
- package/src/models/mappers.ts +135 -148
- package/src/models/parameters.ts +75 -61
- package/src/operations/index.ts +1 -2
- package/src/operations/rateCard.ts +36 -60
- package/src/operations/usageAggregates.ts +122 -88
- package/src/{models/usageAggregatesMappers.ts → operationsInterfaces/index.ts} +2 -7
- package/src/operationsInterfaces/rateCard.ts +30 -0
- package/src/operationsInterfaces/usageAggregates.ts +26 -0
- package/src/usageManagementClient.ts +64 -36
- package/tsconfig.json +5 -4
- package/types/arm-commerce.d.ts +247 -0
- package/types/tsdoc-metadata.json +11 -0
- package/dist/arm-commerce.js +0 -930
- package/dist/arm-commerce.js.map +0 -1
- package/dist/arm-commerce.min.js +0 -1
- package/dist/arm-commerce.min.js.map +0 -1
- package/esm/models/index.d.ts +0 -397
- package/esm/models/index.d.ts.map +0 -1
- package/esm/models/index.js.map +0 -1
- package/esm/models/mappers.d.ts +0 -21
- package/esm/models/mappers.d.ts.map +0 -1
- package/esm/models/mappers.js.map +0 -1
- package/esm/models/parameters.d.ts +0 -12
- package/esm/models/parameters.d.ts.map +0 -1
- package/esm/models/parameters.js.map +0 -1
- package/esm/models/rateCardMappers.d.ts +0 -2
- package/esm/models/rateCardMappers.d.ts.map +0 -1
- package/esm/models/rateCardMappers.js +0 -9
- package/esm/models/rateCardMappers.js.map +0 -1
- package/esm/models/usageAggregatesMappers.d.ts +0 -2
- package/esm/models/usageAggregatesMappers.d.ts.map +0 -1
- package/esm/models/usageAggregatesMappers.js.map +0 -1
- package/esm/operations/index.d.ts.map +0 -1
- package/esm/operations/index.js.map +0 -1
- package/esm/operations/rateCard.d.ts +0 -43
- package/esm/operations/rateCard.d.ts.map +0 -1
- package/esm/operations/rateCard.js +0 -55
- package/esm/operations/rateCard.js.map +0 -1
- package/esm/operations/usageAggregates.d.ts +0 -58
- package/esm/operations/usageAggregates.d.ts.map +0 -1
- package/esm/operations/usageAggregates.js +0 -96
- package/esm/operations/usageAggregates.js.map +0 -1
- package/esm/usageManagementClient.d.ts +0 -26
- package/esm/usageManagementClient.d.ts.map +0 -1
- package/esm/usageManagementClient.js +0 -39
- package/esm/usageManagementClient.js.map +0 -1
- package/esm/usageManagementClientContext.d.ts +0 -23
- package/esm/usageManagementClientContext.d.ts.map +0 -1
- package/esm/usageManagementClientContext.js +0 -61
- package/esm/usageManagementClientContext.js.map +0 -1
- package/src/usageManagementClientContext.ts +0 -68
|
@@ -3,84 +3,57 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*
|
|
5
5
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
-
* Changes may cause incorrect behavior and will be lost if the code is
|
|
7
|
-
* regenerated.
|
|
6
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
import
|
|
11
|
-
import * as
|
|
12
|
-
import * as Mappers from "../models/
|
|
9
|
+
import { RateCard } from "../operationsInterfaces";
|
|
10
|
+
import * as coreClient from "@azure/core-client";
|
|
11
|
+
import * as Mappers from "../models/mappers";
|
|
13
12
|
import * as Parameters from "../models/parameters";
|
|
14
|
-
import {
|
|
13
|
+
import { UsageManagementClient } from "../usageManagementClient";
|
|
14
|
+
import { RateCardGetOptionalParams, RateCardGetResponse } from "../models";
|
|
15
15
|
|
|
16
|
-
/** Class
|
|
17
|
-
export class RateCard {
|
|
18
|
-
private readonly client:
|
|
16
|
+
/** Class containing RateCard operations. */
|
|
17
|
+
export class RateCardImpl implements RateCard {
|
|
18
|
+
private readonly client: UsageManagementClient;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
* @param
|
|
21
|
+
* Initialize a new instance of the class RateCard class.
|
|
22
|
+
* @param client Reference to the service client
|
|
23
23
|
*/
|
|
24
|
-
constructor(client:
|
|
24
|
+
constructor(client: UsageManagementClient) {
|
|
25
25
|
this.client = client;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Enables you to query for the resource/meter metadata and related prices used in a given
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
29
|
+
* Enables you to query for the resource/meter metadata and related prices used in a given subscription
|
|
30
|
+
* by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including
|
|
31
|
+
* but not limited to service names, types, resources, units of measure, and regions, is subject to
|
|
32
|
+
* change at any time and without notice. If you intend to use this billing data in an automated
|
|
33
|
+
* fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing
|
|
34
|
+
* meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the
|
|
35
|
+
* change.
|
|
36
36
|
* @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @param
|
|
40
|
-
* @returns Promise<Models.RateCardGetResponse>
|
|
37
|
+
* operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region'
|
|
38
|
+
* are required to be a part of the $filter.
|
|
39
|
+
* @param options The options parameters.
|
|
41
40
|
*/
|
|
42
|
-
get(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
* 'Region' are required to be a part of the $filter.
|
|
47
|
-
* @param callback The callback
|
|
48
|
-
*/
|
|
49
|
-
get(filter: string, callback: msRest.ServiceCallback<Models.ResourceRateCardInfo>): void;
|
|
50
|
-
/**
|
|
51
|
-
* @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical
|
|
52
|
-
* operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale',
|
|
53
|
-
* 'Region' are required to be a part of the $filter.
|
|
54
|
-
* @param options The optional parameters
|
|
55
|
-
* @param callback The callback
|
|
56
|
-
*/
|
|
57
|
-
get(filter: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.ResourceRateCardInfo>): void;
|
|
58
|
-
get(filter: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.ResourceRateCardInfo>, callback?: msRest.ServiceCallback<Models.ResourceRateCardInfo>): Promise<Models.RateCardGetResponse> {
|
|
41
|
+
get(
|
|
42
|
+
filter: string,
|
|
43
|
+
options?: RateCardGetOptionalParams
|
|
44
|
+
): Promise<RateCardGetResponse> {
|
|
59
45
|
return this.client.sendOperationRequest(
|
|
60
|
-
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
getOperationSpec,
|
|
65
|
-
callback) as Promise<Models.RateCardGetResponse>;
|
|
46
|
+
{ filter, options },
|
|
47
|
+
getOperationSpec
|
|
48
|
+
);
|
|
66
49
|
}
|
|
67
50
|
}
|
|
68
|
-
|
|
69
51
|
// Operation Specifications
|
|
70
|
-
const serializer =
|
|
71
|
-
|
|
52
|
+
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
|
|
53
|
+
|
|
54
|
+
const getOperationSpec: coreClient.OperationSpec = {
|
|
55
|
+
path: "/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/RateCard",
|
|
72
56
|
httpMethod: "GET",
|
|
73
|
-
path: "subscriptions/{subscriptionId}/providers/Microsoft.Commerce/RateCard",
|
|
74
|
-
urlParameters: [
|
|
75
|
-
Parameters.subscriptionId
|
|
76
|
-
],
|
|
77
|
-
queryParameters: [
|
|
78
|
-
Parameters.filter,
|
|
79
|
-
Parameters.apiVersion
|
|
80
|
-
],
|
|
81
|
-
headerParameters: [
|
|
82
|
-
Parameters.acceptLanguage
|
|
83
|
-
],
|
|
84
57
|
responses: {
|
|
85
58
|
200: {
|
|
86
59
|
bodyMapper: Mappers.ResourceRateCardInfo
|
|
@@ -89,5 +62,8 @@ const getOperationSpec: msRest.OperationSpec = {
|
|
|
89
62
|
bodyMapper: Mappers.ErrorResponse
|
|
90
63
|
}
|
|
91
64
|
},
|
|
65
|
+
queryParameters: [Parameters.apiVersion, Parameters.filter],
|
|
66
|
+
urlParameters: [Parameters.$host, Parameters.subscriptionId],
|
|
67
|
+
headerParameters: [Parameters.accept],
|
|
92
68
|
serializer
|
|
93
69
|
};
|
|
@@ -3,25 +3,33 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*
|
|
5
5
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
-
* Changes may cause incorrect behavior and will be lost if the code is
|
|
7
|
-
* regenerated.
|
|
6
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import * as
|
|
9
|
+
import { PagedAsyncIterableIterator } from "@azure/core-paging";
|
|
10
|
+
import { UsageAggregates } from "../operationsInterfaces";
|
|
11
|
+
import * as coreClient from "@azure/core-client";
|
|
12
|
+
import * as Mappers from "../models/mappers";
|
|
13
13
|
import * as Parameters from "../models/parameters";
|
|
14
|
-
import {
|
|
14
|
+
import { UsageManagementClient } from "../usageManagementClient";
|
|
15
|
+
import {
|
|
16
|
+
UsageAggregation,
|
|
17
|
+
UsageAggregatesListNextOptionalParams,
|
|
18
|
+
UsageAggregatesListOptionalParams,
|
|
19
|
+
UsageAggregatesListResponse,
|
|
20
|
+
UsageAggregatesListNextResponse
|
|
21
|
+
} from "../models";
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
/// <reference lib="esnext.asynciterable" />
|
|
24
|
+
/** Class containing UsageAggregates operations. */
|
|
25
|
+
export class UsageAggregatesImpl implements UsageAggregates {
|
|
26
|
+
private readonly client: UsageManagementClient;
|
|
19
27
|
|
|
20
28
|
/**
|
|
21
|
-
*
|
|
22
|
-
* @param
|
|
29
|
+
* Initialize a new instance of the class UsageAggregates class.
|
|
30
|
+
* @param client Reference to the service client
|
|
23
31
|
*/
|
|
24
|
-
constructor(client:
|
|
32
|
+
constructor(client: UsageManagementClient) {
|
|
25
33
|
this.client = client;
|
|
26
34
|
}
|
|
27
35
|
|
|
@@ -29,79 +37,116 @@ export class UsageAggregates {
|
|
|
29
37
|
* Query aggregated Azure subscription consumption data for a date range.
|
|
30
38
|
* @param reportedStartTime The start of the time range to retrieve data for.
|
|
31
39
|
* @param reportedEndTime The end of the time range to retrieve data for.
|
|
32
|
-
* @param
|
|
33
|
-
* @returns Promise<Models.UsageAggregatesListResponse>
|
|
40
|
+
* @param options The options parameters.
|
|
34
41
|
*/
|
|
35
|
-
list(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
public list(
|
|
43
|
+
reportedStartTime: Date,
|
|
44
|
+
reportedEndTime: Date,
|
|
45
|
+
options?: UsageAggregatesListOptionalParams
|
|
46
|
+
): PagedAsyncIterableIterator<UsageAggregation> {
|
|
47
|
+
const iter = this.listPagingAll(
|
|
48
|
+
reportedStartTime,
|
|
49
|
+
reportedEndTime,
|
|
50
|
+
options
|
|
51
|
+
);
|
|
52
|
+
return {
|
|
53
|
+
next() {
|
|
54
|
+
return iter.next();
|
|
55
|
+
},
|
|
56
|
+
[Symbol.asyncIterator]() {
|
|
57
|
+
return this;
|
|
58
|
+
},
|
|
59
|
+
byPage: () => {
|
|
60
|
+
return this.listPagingPage(reportedStartTime, reportedEndTime, options);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private async *listPagingPage(
|
|
66
|
+
reportedStartTime: Date,
|
|
67
|
+
reportedEndTime: Date,
|
|
68
|
+
options?: UsageAggregatesListOptionalParams
|
|
69
|
+
): AsyncIterableIterator<UsageAggregation[]> {
|
|
70
|
+
let result = await this._list(reportedStartTime, reportedEndTime, options);
|
|
71
|
+
yield result.value || [];
|
|
72
|
+
let continuationToken = result.nextLink;
|
|
73
|
+
while (continuationToken) {
|
|
74
|
+
result = await this._listNext(
|
|
52
75
|
reportedStartTime,
|
|
53
76
|
reportedEndTime,
|
|
77
|
+
continuationToken,
|
|
54
78
|
options
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
79
|
+
);
|
|
80
|
+
continuationToken = result.nextLink;
|
|
81
|
+
yield result.value || [];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private async *listPagingAll(
|
|
86
|
+
reportedStartTime: Date,
|
|
87
|
+
reportedEndTime: Date,
|
|
88
|
+
options?: UsageAggregatesListOptionalParams
|
|
89
|
+
): AsyncIterableIterator<UsageAggregation> {
|
|
90
|
+
for await (const page of this.listPagingPage(
|
|
91
|
+
reportedStartTime,
|
|
92
|
+
reportedEndTime,
|
|
93
|
+
options
|
|
94
|
+
)) {
|
|
95
|
+
yield* page;
|
|
96
|
+
}
|
|
58
97
|
}
|
|
59
98
|
|
|
60
99
|
/**
|
|
61
100
|
* Query aggregated Azure subscription consumption data for a date range.
|
|
62
|
-
* @param nextPageLink The NextLink from the previous successful call to List operation.
|
|
63
|
-
* @param reportedStartTime The start of the time range to retrieve data for.
|
|
64
|
-
* @param reportedEndTime The end of the time range to retrieve data for.
|
|
65
|
-
* @param [options] The optional parameters
|
|
66
|
-
* @returns Promise<Models.UsageAggregatesListNextResponse>
|
|
67
|
-
*/
|
|
68
|
-
listNext(nextPageLink: string, reportedStartTime: Date | string, reportedEndTime: Date | string, options?: Models.UsageAggregatesListNextOptionalParams): Promise<Models.UsageAggregatesListNextResponse>;
|
|
69
|
-
/**
|
|
70
|
-
* @param nextPageLink The NextLink from the previous successful call to List operation.
|
|
71
101
|
* @param reportedStartTime The start of the time range to retrieve data for.
|
|
72
102
|
* @param reportedEndTime The end of the time range to retrieve data for.
|
|
73
|
-
* @param
|
|
103
|
+
* @param options The options parameters.
|
|
74
104
|
*/
|
|
75
|
-
|
|
105
|
+
private _list(
|
|
106
|
+
reportedStartTime: Date,
|
|
107
|
+
reportedEndTime: Date,
|
|
108
|
+
options?: UsageAggregatesListOptionalParams
|
|
109
|
+
): Promise<UsageAggregatesListResponse> {
|
|
110
|
+
return this.client.sendOperationRequest(
|
|
111
|
+
{ reportedStartTime, reportedEndTime, options },
|
|
112
|
+
listOperationSpec
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
76
116
|
/**
|
|
77
|
-
*
|
|
117
|
+
* ListNext
|
|
78
118
|
* @param reportedStartTime The start of the time range to retrieve data for.
|
|
79
119
|
* @param reportedEndTime The end of the time range to retrieve data for.
|
|
80
|
-
* @param
|
|
81
|
-
* @param
|
|
120
|
+
* @param nextLink The nextLink from the previous successful call to the List method.
|
|
121
|
+
* @param options The options parameters.
|
|
82
122
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
123
|
+
private _listNext(
|
|
124
|
+
reportedStartTime: Date,
|
|
125
|
+
reportedEndTime: Date,
|
|
126
|
+
nextLink: string,
|
|
127
|
+
options?: UsageAggregatesListNextOptionalParams
|
|
128
|
+
): Promise<UsageAggregatesListNextResponse> {
|
|
85
129
|
return this.client.sendOperationRequest(
|
|
86
|
-
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
reportedEndTime,
|
|
90
|
-
options
|
|
91
|
-
},
|
|
92
|
-
listNextOperationSpec,
|
|
93
|
-
callback) as Promise<Models.UsageAggregatesListNextResponse>;
|
|
130
|
+
{ reportedStartTime, reportedEndTime, nextLink, options },
|
|
131
|
+
listNextOperationSpec
|
|
132
|
+
);
|
|
94
133
|
}
|
|
95
134
|
}
|
|
96
|
-
|
|
97
135
|
// Operation Specifications
|
|
98
|
-
const serializer =
|
|
99
|
-
|
|
136
|
+
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
|
|
137
|
+
|
|
138
|
+
const listOperationSpec: coreClient.OperationSpec = {
|
|
139
|
+
path:
|
|
140
|
+
"/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/UsageAggregates",
|
|
100
141
|
httpMethod: "GET",
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
142
|
+
responses: {
|
|
143
|
+
200: {
|
|
144
|
+
bodyMapper: Mappers.UsageAggregationListResult
|
|
145
|
+
},
|
|
146
|
+
default: {
|
|
147
|
+
bodyMapper: Mappers.ErrorResponse
|
|
148
|
+
}
|
|
149
|
+
},
|
|
105
150
|
queryParameters: [
|
|
106
151
|
Parameters.reportedStartTime,
|
|
107
152
|
Parameters.reportedEndTime,
|
|
@@ -110,9 +155,13 @@ const listOperationSpec: msRest.OperationSpec = {
|
|
|
110
155
|
Parameters.continuationToken,
|
|
111
156
|
Parameters.apiVersion
|
|
112
157
|
],
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
158
|
+
urlParameters: [Parameters.$host, Parameters.subscriptionId],
|
|
159
|
+
headerParameters: [Parameters.accept],
|
|
160
|
+
serializer
|
|
161
|
+
};
|
|
162
|
+
const listNextOperationSpec: coreClient.OperationSpec = {
|
|
163
|
+
path: "{nextLink}",
|
|
164
|
+
httpMethod: "GET",
|
|
116
165
|
responses: {
|
|
117
166
|
200: {
|
|
118
167
|
bodyMapper: Mappers.UsageAggregationListResult
|
|
@@ -121,16 +170,6 @@ const listOperationSpec: msRest.OperationSpec = {
|
|
|
121
170
|
bodyMapper: Mappers.ErrorResponse
|
|
122
171
|
}
|
|
123
172
|
},
|
|
124
|
-
serializer
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const listNextOperationSpec: msRest.OperationSpec = {
|
|
128
|
-
httpMethod: "GET",
|
|
129
|
-
baseUrl: "https://management.azure.com",
|
|
130
|
-
path: "{nextLink}",
|
|
131
|
-
urlParameters: [
|
|
132
|
-
Parameters.nextPageLink
|
|
133
|
-
],
|
|
134
173
|
queryParameters: [
|
|
135
174
|
Parameters.reportedStartTime,
|
|
136
175
|
Parameters.reportedEndTime,
|
|
@@ -139,16 +178,11 @@ const listNextOperationSpec: msRest.OperationSpec = {
|
|
|
139
178
|
Parameters.continuationToken,
|
|
140
179
|
Parameters.apiVersion
|
|
141
180
|
],
|
|
142
|
-
|
|
143
|
-
Parameters
|
|
181
|
+
urlParameters: [
|
|
182
|
+
Parameters.$host,
|
|
183
|
+
Parameters.subscriptionId,
|
|
184
|
+
Parameters.nextLink
|
|
144
185
|
],
|
|
145
|
-
|
|
146
|
-
200: {
|
|
147
|
-
bodyMapper: Mappers.UsageAggregationListResult
|
|
148
|
-
},
|
|
149
|
-
default: {
|
|
150
|
-
bodyMapper: Mappers.ErrorResponse
|
|
151
|
-
}
|
|
152
|
-
},
|
|
186
|
+
headerParameters: [Parameters.accept],
|
|
153
187
|
serializer
|
|
154
188
|
};
|
|
@@ -6,10 +6,5 @@
|
|
|
6
6
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
ErrorResponse,
|
|
12
|
-
InfoField,
|
|
13
|
-
UsageAggregation,
|
|
14
|
-
UsageAggregationListResult
|
|
15
|
-
} from "../models/mappers";
|
|
9
|
+
export * from "./usageAggregates";
|
|
10
|
+
export * from "./rateCard";
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
|
|
9
|
+
import { RateCardGetOptionalParams, RateCardGetResponse } from "../models";
|
|
10
|
+
|
|
11
|
+
/** Interface representing a RateCard. */
|
|
12
|
+
export interface RateCard {
|
|
13
|
+
/**
|
|
14
|
+
* Enables you to query for the resource/meter metadata and related prices used in a given subscription
|
|
15
|
+
* by Offer ID, Currency, Locale and Region. The metadata associated with the billing meters, including
|
|
16
|
+
* but not limited to service names, types, resources, units of measure, and regions, is subject to
|
|
17
|
+
* change at any time and without notice. If you intend to use this billing data in an automated
|
|
18
|
+
* fashion, please use the billing meter GUID to uniquely identify each billable item. If the billing
|
|
19
|
+
* meter GUID is scheduled to change due to a new billing model, you will be notified in advance of the
|
|
20
|
+
* change.
|
|
21
|
+
* @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical
|
|
22
|
+
* operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale', 'Region'
|
|
23
|
+
* are required to be a part of the $filter.
|
|
24
|
+
* @param options The options parameters.
|
|
25
|
+
*/
|
|
26
|
+
get(
|
|
27
|
+
filter: string,
|
|
28
|
+
options?: RateCardGetOptionalParams
|
|
29
|
+
): Promise<RateCardGetResponse>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
|
|
9
|
+
import { PagedAsyncIterableIterator } from "@azure/core-paging";
|
|
10
|
+
import { UsageAggregation, UsageAggregatesListOptionalParams } from "../models";
|
|
11
|
+
|
|
12
|
+
/// <reference lib="esnext.asynciterable" />
|
|
13
|
+
/** Interface representing a UsageAggregates. */
|
|
14
|
+
export interface UsageAggregates {
|
|
15
|
+
/**
|
|
16
|
+
* Query aggregated Azure subscription consumption data for a date range.
|
|
17
|
+
* @param reportedStartTime The start of the time range to retrieve data for.
|
|
18
|
+
* @param reportedEndTime The end of the time range to retrieve data for.
|
|
19
|
+
* @param options The options parameters.
|
|
20
|
+
*/
|
|
21
|
+
list(
|
|
22
|
+
reportedStartTime: Date,
|
|
23
|
+
reportedEndTime: Date,
|
|
24
|
+
options?: UsageAggregatesListOptionalParams
|
|
25
|
+
): PagedAsyncIterableIterator<UsageAggregation>;
|
|
26
|
+
}
|
|
@@ -3,48 +3,76 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*
|
|
5
5
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
-
* Changes may cause incorrect behavior and will be lost if the code is
|
|
7
|
-
* regenerated.
|
|
6
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
import * as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { UsageManagementClientContext } from "./usageManagementClientContext";
|
|
9
|
+
import * as coreClient from "@azure/core-client";
|
|
10
|
+
import * as coreAuth from "@azure/core-auth";
|
|
11
|
+
import { UsageAggregatesImpl, RateCardImpl } from "./operations";
|
|
12
|
+
import { UsageAggregates, RateCard } from "./operationsInterfaces";
|
|
13
|
+
import { UsageManagementClientOptionalParams } from "./models";
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
rateCard: operations.RateCard;
|
|
15
|
+
export class UsageManagementClient extends coreClient.ServiceClient {
|
|
16
|
+
$host: string;
|
|
17
|
+
apiVersion: string;
|
|
18
|
+
subscriptionId: string;
|
|
22
19
|
|
|
23
20
|
/**
|
|
24
21
|
* Initializes a new instance of the UsageManagementClient class.
|
|
25
|
-
* @param credentials
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
|
|
30
|
-
* @azure/ms-rest-browserauth are also supported.
|
|
31
|
-
* @param subscriptionId It uniquely identifies Microsoft Azure subscription. The subscription ID
|
|
32
|
-
* forms part of the URI for every service call.
|
|
33
|
-
* @param [options] The parameter options
|
|
22
|
+
* @param credentials Subscription credentials which uniquely identify client subscription.
|
|
23
|
+
* @param subscriptionId It uniquely identifies Microsoft Azure subscription. The subscription ID forms
|
|
24
|
+
* part of the URI for every service call.
|
|
25
|
+
* @param options The parameter options
|
|
34
26
|
*/
|
|
35
|
-
constructor(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
constructor(
|
|
28
|
+
credentials: coreAuth.TokenCredential,
|
|
29
|
+
subscriptionId: string,
|
|
30
|
+
options?: UsageManagementClientOptionalParams
|
|
31
|
+
) {
|
|
32
|
+
if (credentials === undefined) {
|
|
33
|
+
throw new Error("'credentials' cannot be null");
|
|
34
|
+
}
|
|
35
|
+
if (subscriptionId === undefined) {
|
|
36
|
+
throw new Error("'subscriptionId' cannot be null");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Initializing default values for options
|
|
40
|
+
if (!options) {
|
|
41
|
+
options = {};
|
|
42
|
+
}
|
|
43
|
+
const defaults: UsageManagementClientOptionalParams = {
|
|
44
|
+
requestContentType: "application/json; charset=utf-8",
|
|
45
|
+
credential: credentials
|
|
46
|
+
};
|
|
41
47
|
|
|
42
|
-
|
|
48
|
+
const packageDetails = `azsdk-js-arm-commerce/4.0.0-beta.1`;
|
|
49
|
+
const userAgentPrefix =
|
|
50
|
+
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
51
|
+
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
52
|
+
: `${packageDetails}`;
|
|
43
53
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
if (!options.credentialScopes) {
|
|
55
|
+
options.credentialScopes = ["https://management.azure.com/.default"];
|
|
56
|
+
}
|
|
57
|
+
const optionsWithDefaults = {
|
|
58
|
+
...defaults,
|
|
59
|
+
...options,
|
|
60
|
+
userAgentOptions: {
|
|
61
|
+
userAgentPrefix
|
|
62
|
+
},
|
|
63
|
+
baseUri: options.endpoint || "https://management.azure.com"
|
|
64
|
+
};
|
|
65
|
+
super(optionsWithDefaults);
|
|
66
|
+
// Parameter assignments
|
|
67
|
+
this.subscriptionId = subscriptionId;
|
|
68
|
+
|
|
69
|
+
// Assigning values to Constant parameters
|
|
70
|
+
this.$host = options.$host || "https://management.azure.com";
|
|
71
|
+
this.apiVersion = options.apiVersion || "2015-06-01-preview";
|
|
72
|
+
this.usageAggregates = new UsageAggregatesImpl(this);
|
|
73
|
+
this.rateCard = new RateCardImpl(this);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
usageAggregates: UsageAggregates;
|
|
77
|
+
rateCard: RateCard;
|
|
78
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"module": "es6",
|
|
4
4
|
"moduleResolution": "node",
|
|
5
5
|
"strict": true,
|
|
6
|
-
"target": "
|
|
6
|
+
"target": "es6",
|
|
7
7
|
"sourceMap": true,
|
|
8
8
|
"declarationMap": true,
|
|
9
9
|
"esModuleInterop": true,
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
"forceConsistentCasingInFileNames": true,
|
|
12
12
|
"lib": ["es6", "dom"],
|
|
13
13
|
"declaration": true,
|
|
14
|
-
"outDir": "./esm",
|
|
15
|
-
"importHelpers": true
|
|
14
|
+
"outDir": "./dist-esm",
|
|
15
|
+
"importHelpers": true,
|
|
16
|
+
"paths": { "@azure/arm-commerce": ["./src/index"] }
|
|
16
17
|
},
|
|
17
|
-
"include": ["./src/**/*.ts"],
|
|
18
|
+
"include": ["./src/**/*.ts", "./test/**/*.ts", "samples-dev/**/*.ts"],
|
|
18
19
|
"exclude": ["node_modules"]
|
|
19
20
|
}
|