@azure/arm-commerce 2.1.1 → 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.
Files changed (125) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +21 -0
  3. package/README.md +73 -81
  4. package/dist/index.js +822 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.min.js +1 -0
  7. package/dist/index.min.js.map +1 -0
  8. package/dist-esm/samples-dev/getRateCard.d.ts +2 -0
  9. package/dist-esm/samples-dev/getRateCard.d.ts.map +1 -0
  10. package/dist-esm/samples-dev/getRateCard.js +30 -0
  11. package/dist-esm/samples-dev/getRateCard.js.map +1 -0
  12. package/dist-esm/src/index.d.ts +5 -0
  13. package/dist-esm/src/index.d.ts.map +1 -0
  14. package/dist-esm/src/index.js +12 -0
  15. package/dist-esm/src/index.js.map +1 -0
  16. package/dist-esm/src/models/index.d.ts +178 -0
  17. package/dist-esm/src/models/index.d.ts.map +1 -0
  18. package/dist-esm/src/models/index.js +9 -0
  19. package/dist-esm/src/models/index.js.map +1 -0
  20. package/dist-esm/src/models/mappers.d.ts +19 -0
  21. package/dist-esm/src/models/mappers.d.ts.map +1 -0
  22. package/{esm → dist-esm/src}/models/mappers.js +132 -149
  23. package/dist-esm/src/models/mappers.js.map +1 -0
  24. package/dist-esm/src/models/parameters.d.ts +13 -0
  25. package/dist-esm/src/models/parameters.d.ts.map +1 -0
  26. package/{esm → dist-esm/src}/models/parameters.js +62 -63
  27. package/dist-esm/src/models/parameters.js.map +1 -0
  28. package/{esm → dist-esm/src}/operations/index.d.ts +0 -0
  29. package/dist-esm/src/operations/index.d.ts.map +1 -0
  30. package/dist-esm/src/operations/index.js +10 -0
  31. package/dist-esm/src/operations/index.js.map +1 -0
  32. package/dist-esm/src/operations/rateCard.d.ts +27 -0
  33. package/dist-esm/src/operations/rateCard.d.ts.map +1 -0
  34. package/dist-esm/src/operations/rateCard.js +55 -0
  35. package/dist-esm/src/operations/rateCard.js.map +1 -0
  36. package/dist-esm/src/operations/usageAggregates.d.ts +38 -0
  37. package/dist-esm/src/operations/usageAggregates.d.ts.map +1 -0
  38. package/dist-esm/src/operations/usageAggregates.js +144 -0
  39. package/dist-esm/src/operations/usageAggregates.js.map +1 -0
  40. package/dist-esm/src/operationsInterfaces/index.d.ts +3 -0
  41. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
  42. package/dist-esm/src/operationsInterfaces/index.js +10 -0
  43. package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
  44. package/dist-esm/src/operationsInterfaces/rateCard.d.ts +19 -0
  45. package/dist-esm/src/operationsInterfaces/rateCard.d.ts.map +1 -0
  46. package/dist-esm/src/operationsInterfaces/rateCard.js +9 -0
  47. package/dist-esm/src/operationsInterfaces/rateCard.js.map +1 -0
  48. package/dist-esm/src/operationsInterfaces/usageAggregates.d.ts +13 -0
  49. package/dist-esm/src/operationsInterfaces/usageAggregates.d.ts.map +1 -0
  50. package/dist-esm/src/operationsInterfaces/usageAggregates.js +9 -0
  51. package/dist-esm/src/operationsInterfaces/usageAggregates.js.map +1 -0
  52. package/dist-esm/src/usageManagementClient.d.ts +20 -0
  53. package/dist-esm/src/usageManagementClient.d.ts.map +1 -0
  54. package/dist-esm/src/usageManagementClient.js +53 -0
  55. package/dist-esm/src/usageManagementClient.js.map +1 -0
  56. package/dist-esm/test/commerce_examples.d.ts +4 -0
  57. package/dist-esm/test/commerce_examples.d.ts.map +1 -0
  58. package/dist-esm/test/commerce_examples.js +58 -0
  59. package/dist-esm/test/commerce_examples.js.map +1 -0
  60. package/package.json +77 -34
  61. package/review/arm-commerce.api.md +178 -0
  62. package/rollup.config.js +181 -30
  63. package/src/index.ts +12 -0
  64. package/src/models/index.ts +210 -0
  65. package/{lib → src}/models/mappers.ts +138 -152
  66. package/src/models/parameters.ts +137 -0
  67. package/{lib → src}/operations/index.ts +3 -5
  68. package/src/operations/rateCard.ts +69 -0
  69. package/src/operations/usageAggregates.ts +188 -0
  70. package/src/operationsInterfaces/index.ts +10 -0
  71. package/src/operationsInterfaces/rateCard.ts +30 -0
  72. package/src/operationsInterfaces/usageAggregates.ts +26 -0
  73. package/src/usageManagementClient.ts +78 -0
  74. package/tsconfig.json +6 -5
  75. package/types/arm-commerce.d.ts +247 -0
  76. package/types/tsdoc-metadata.json +11 -0
  77. package/dist/arm-commerce.js +0 -930
  78. package/dist/arm-commerce.js.map +0 -1
  79. package/dist/arm-commerce.min.js +0 -1
  80. package/dist/arm-commerce.min.js.map +0 -1
  81. package/esm/models/index.d.ts +0 -453
  82. package/esm/models/index.d.ts.map +0 -1
  83. package/esm/models/index.js +0 -10
  84. package/esm/models/index.js.map +0 -1
  85. package/esm/models/mappers.d.ts +0 -21
  86. package/esm/models/mappers.d.ts.map +0 -1
  87. package/esm/models/mappers.js.map +0 -1
  88. package/esm/models/parameters.d.ts +0 -12
  89. package/esm/models/parameters.d.ts.map +0 -1
  90. package/esm/models/parameters.js.map +0 -1
  91. package/esm/models/rateCardMappers.d.ts +0 -2
  92. package/esm/models/rateCardMappers.d.ts.map +0 -1
  93. package/esm/models/rateCardMappers.js +0 -11
  94. package/esm/models/rateCardMappers.js.map +0 -1
  95. package/esm/models/usageAggregatesMappers.d.ts +0 -2
  96. package/esm/models/usageAggregatesMappers.d.ts.map +0 -1
  97. package/esm/models/usageAggregatesMappers.js +0 -11
  98. package/esm/models/usageAggregatesMappers.js.map +0 -1
  99. package/esm/operations/index.d.ts.map +0 -1
  100. package/esm/operations/index.js +0 -12
  101. package/esm/operations/index.js.map +0 -1
  102. package/esm/operations/rateCard.d.ts +0 -43
  103. package/esm/operations/rateCard.d.ts.map +0 -1
  104. package/esm/operations/rateCard.js +0 -56
  105. package/esm/operations/rateCard.js.map +0 -1
  106. package/esm/operations/usageAggregates.d.ts +0 -52
  107. package/esm/operations/usageAggregates.d.ts.map +0 -1
  108. package/esm/operations/usageAggregates.js +0 -87
  109. package/esm/operations/usageAggregates.js.map +0 -1
  110. package/esm/usageManagementClient.d.ts +0 -20
  111. package/esm/usageManagementClient.d.ts.map +0 -1
  112. package/esm/usageManagementClient.js +0 -35
  113. package/esm/usageManagementClient.js.map +0 -1
  114. package/esm/usageManagementClientContext.d.ts +0 -17
  115. package/esm/usageManagementClientContext.d.ts.map +0 -1
  116. package/esm/usageManagementClientContext.js +0 -57
  117. package/esm/usageManagementClientContext.js.map +0 -1
  118. package/lib/models/index.ts +0 -479
  119. package/lib/models/parameters.ts +0 -124
  120. package/lib/models/rateCardMappers.ts +0 -21
  121. package/lib/models/usageAggregatesMappers.ts +0 -18
  122. package/lib/operations/rateCard.ts +0 -94
  123. package/lib/operations/usageAggregates.ts +0 -139
  124. package/lib/usageManagementClient.ts +0 -45
  125. package/lib/usageManagementClientContext.ts +0 -63
@@ -0,0 +1,137 @@
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 {
10
+ OperationParameter,
11
+ OperationURLParameter,
12
+ OperationQueryParameter
13
+ } from "@azure/core-client";
14
+
15
+ export const accept: OperationParameter = {
16
+ parameterPath: "accept",
17
+ mapper: {
18
+ defaultValue: "application/json, text/json",
19
+ isConstant: true,
20
+ serializedName: "Accept",
21
+ type: {
22
+ name: "String"
23
+ }
24
+ }
25
+ };
26
+
27
+ export const $host: OperationURLParameter = {
28
+ parameterPath: "$host",
29
+ mapper: {
30
+ serializedName: "$host",
31
+ required: true,
32
+ type: {
33
+ name: "String"
34
+ }
35
+ },
36
+ skipEncoding: true
37
+ };
38
+
39
+ export const reportedStartTime: OperationQueryParameter = {
40
+ parameterPath: "reportedStartTime",
41
+ mapper: {
42
+ serializedName: "reportedStartTime",
43
+ required: true,
44
+ type: {
45
+ name: "DateTime"
46
+ }
47
+ }
48
+ };
49
+
50
+ export const reportedEndTime: OperationQueryParameter = {
51
+ parameterPath: "reportedEndTime",
52
+ mapper: {
53
+ serializedName: "reportedEndTime",
54
+ required: true,
55
+ type: {
56
+ name: "DateTime"
57
+ }
58
+ }
59
+ };
60
+
61
+ export const showDetails: OperationQueryParameter = {
62
+ parameterPath: ["options", "showDetails"],
63
+ mapper: {
64
+ serializedName: "showDetails",
65
+ type: {
66
+ name: "Boolean"
67
+ }
68
+ }
69
+ };
70
+
71
+ export const aggregationGranularity: OperationQueryParameter = {
72
+ parameterPath: ["options", "aggregationGranularity"],
73
+ mapper: {
74
+ defaultValue: "Daily",
75
+ serializedName: "aggregationGranularity",
76
+ type: {
77
+ name: "Enum",
78
+ allowedValues: ["Daily", "Hourly"]
79
+ }
80
+ }
81
+ };
82
+
83
+ export const continuationToken: OperationQueryParameter = {
84
+ parameterPath: ["options", "continuationToken"],
85
+ mapper: {
86
+ serializedName: "continuationToken",
87
+ type: {
88
+ name: "String"
89
+ }
90
+ }
91
+ };
92
+
93
+ export const apiVersion: OperationQueryParameter = {
94
+ parameterPath: "apiVersion",
95
+ mapper: {
96
+ defaultValue: "2015-06-01-preview",
97
+ isConstant: true,
98
+ serializedName: "api-version",
99
+ type: {
100
+ name: "String"
101
+ }
102
+ }
103
+ };
104
+
105
+ export const subscriptionId: OperationURLParameter = {
106
+ parameterPath: "subscriptionId",
107
+ mapper: {
108
+ serializedName: "subscriptionId",
109
+ required: true,
110
+ type: {
111
+ name: "String"
112
+ }
113
+ }
114
+ };
115
+
116
+ export const nextLink: OperationURLParameter = {
117
+ parameterPath: "nextLink",
118
+ mapper: {
119
+ serializedName: "nextLink",
120
+ required: true,
121
+ type: {
122
+ name: "String"
123
+ }
124
+ },
125
+ skipEncoding: true
126
+ };
127
+
128
+ export const filter: OperationQueryParameter = {
129
+ parameterPath: "filter",
130
+ mapper: {
131
+ serializedName: "$filter",
132
+ required: true,
133
+ type: {
134
+ name: "String"
135
+ }
136
+ }
137
+ };
@@ -1,11 +1,9 @@
1
1
  /*
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for
4
- * license information.
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
5
4
  *
6
5
  * Code generated by Microsoft (R) AutoRest Code Generator.
7
- * Changes may cause incorrect behavior and will be lost if the code is
8
- * regenerated.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
9
7
  */
10
8
 
11
9
  export * from "./usageAggregates";
@@ -0,0 +1,69 @@
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 { RateCard } from "../operationsInterfaces";
10
+ import * as coreClient from "@azure/core-client";
11
+ import * as Mappers from "../models/mappers";
12
+ import * as Parameters from "../models/parameters";
13
+ import { UsageManagementClient } from "../usageManagementClient";
14
+ import { RateCardGetOptionalParams, RateCardGetResponse } from "../models";
15
+
16
+ /** Class containing RateCard operations. */
17
+ export class RateCardImpl implements RateCard {
18
+ private readonly client: UsageManagementClient;
19
+
20
+ /**
21
+ * Initialize a new instance of the class RateCard class.
22
+ * @param client Reference to the service client
23
+ */
24
+ constructor(client: UsageManagementClient) {
25
+ this.client = client;
26
+ }
27
+
28
+ /**
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
+ * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical
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.
40
+ */
41
+ get(
42
+ filter: string,
43
+ options?: RateCardGetOptionalParams
44
+ ): Promise<RateCardGetResponse> {
45
+ return this.client.sendOperationRequest(
46
+ { filter, options },
47
+ getOperationSpec
48
+ );
49
+ }
50
+ }
51
+ // Operation Specifications
52
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
53
+
54
+ const getOperationSpec: coreClient.OperationSpec = {
55
+ path: "/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/RateCard",
56
+ httpMethod: "GET",
57
+ responses: {
58
+ 200: {
59
+ bodyMapper: Mappers.ResourceRateCardInfo
60
+ },
61
+ default: {
62
+ bodyMapper: Mappers.ErrorResponse
63
+ }
64
+ },
65
+ queryParameters: [Parameters.apiVersion, Parameters.filter],
66
+ urlParameters: [Parameters.$host, Parameters.subscriptionId],
67
+ headerParameters: [Parameters.accept],
68
+ serializer
69
+ };
@@ -0,0 +1,188 @@
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 { UsageAggregates } from "../operationsInterfaces";
11
+ import * as coreClient from "@azure/core-client";
12
+ import * as Mappers from "../models/mappers";
13
+ import * as Parameters from "../models/parameters";
14
+ import { UsageManagementClient } from "../usageManagementClient";
15
+ import {
16
+ UsageAggregation,
17
+ UsageAggregatesListNextOptionalParams,
18
+ UsageAggregatesListOptionalParams,
19
+ UsageAggregatesListResponse,
20
+ UsageAggregatesListNextResponse
21
+ } from "../models";
22
+
23
+ /// <reference lib="esnext.asynciterable" />
24
+ /** Class containing UsageAggregates operations. */
25
+ export class UsageAggregatesImpl implements UsageAggregates {
26
+ private readonly client: UsageManagementClient;
27
+
28
+ /**
29
+ * Initialize a new instance of the class UsageAggregates class.
30
+ * @param client Reference to the service client
31
+ */
32
+ constructor(client: UsageManagementClient) {
33
+ this.client = client;
34
+ }
35
+
36
+ /**
37
+ * Query aggregated Azure subscription consumption data for a date range.
38
+ * @param reportedStartTime The start of the time range to retrieve data for.
39
+ * @param reportedEndTime The end of the time range to retrieve data for.
40
+ * @param options The options parameters.
41
+ */
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(
75
+ reportedStartTime,
76
+ reportedEndTime,
77
+ continuationToken,
78
+ options
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
+ }
97
+ }
98
+
99
+ /**
100
+ * Query aggregated Azure subscription consumption data for a date range.
101
+ * @param reportedStartTime The start of the time range to retrieve data for.
102
+ * @param reportedEndTime The end of the time range to retrieve data for.
103
+ * @param options The options parameters.
104
+ */
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
+
116
+ /**
117
+ * ListNext
118
+ * @param reportedStartTime The start of the time range to retrieve data for.
119
+ * @param reportedEndTime The end of the time range to retrieve data for.
120
+ * @param nextLink The nextLink from the previous successful call to the List method.
121
+ * @param options The options parameters.
122
+ */
123
+ private _listNext(
124
+ reportedStartTime: Date,
125
+ reportedEndTime: Date,
126
+ nextLink: string,
127
+ options?: UsageAggregatesListNextOptionalParams
128
+ ): Promise<UsageAggregatesListNextResponse> {
129
+ return this.client.sendOperationRequest(
130
+ { reportedStartTime, reportedEndTime, nextLink, options },
131
+ listNextOperationSpec
132
+ );
133
+ }
134
+ }
135
+ // Operation Specifications
136
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
137
+
138
+ const listOperationSpec: coreClient.OperationSpec = {
139
+ path:
140
+ "/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/UsageAggregates",
141
+ httpMethod: "GET",
142
+ responses: {
143
+ 200: {
144
+ bodyMapper: Mappers.UsageAggregationListResult
145
+ },
146
+ default: {
147
+ bodyMapper: Mappers.ErrorResponse
148
+ }
149
+ },
150
+ queryParameters: [
151
+ Parameters.reportedStartTime,
152
+ Parameters.reportedEndTime,
153
+ Parameters.showDetails,
154
+ Parameters.aggregationGranularity,
155
+ Parameters.continuationToken,
156
+ Parameters.apiVersion
157
+ ],
158
+ urlParameters: [Parameters.$host, Parameters.subscriptionId],
159
+ headerParameters: [Parameters.accept],
160
+ serializer
161
+ };
162
+ const listNextOperationSpec: coreClient.OperationSpec = {
163
+ path: "{nextLink}",
164
+ httpMethod: "GET",
165
+ responses: {
166
+ 200: {
167
+ bodyMapper: Mappers.UsageAggregationListResult
168
+ },
169
+ default: {
170
+ bodyMapper: Mappers.ErrorResponse
171
+ }
172
+ },
173
+ queryParameters: [
174
+ Parameters.reportedStartTime,
175
+ Parameters.reportedEndTime,
176
+ Parameters.showDetails,
177
+ Parameters.aggregationGranularity,
178
+ Parameters.continuationToken,
179
+ Parameters.apiVersion
180
+ ],
181
+ urlParameters: [
182
+ Parameters.$host,
183
+ Parameters.subscriptionId,
184
+ Parameters.nextLink
185
+ ],
186
+ headerParameters: [Parameters.accept],
187
+ serializer
188
+ };
@@ -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
+
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
+ }
@@ -0,0 +1,78 @@
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 * 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";
14
+
15
+ export class UsageManagementClient extends coreClient.ServiceClient {
16
+ $host: string;
17
+ apiVersion: string;
18
+ subscriptionId: string;
19
+
20
+ /**
21
+ * Initializes a new instance of the UsageManagementClient class.
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
26
+ */
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
+ };
47
+
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}`;
53
+
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,17 +3,18 @@
3
3
  "module": "es6",
4
4
  "moduleResolution": "node",
5
5
  "strict": true,
6
- "target": "es5",
6
+ "target": "es6",
7
7
  "sourceMap": true,
8
8
  "declarationMap": true,
9
9
  "esModuleInterop": true,
10
10
  "allowSyntheticDefaultImports": true,
11
11
  "forceConsistentCasingInFileNames": true,
12
- "lib": ["es6"],
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": ["./lib/**/*.ts"],
18
+ "include": ["./src/**/*.ts", "./test/**/*.ts", "samples-dev/**/*.ts"],
18
19
  "exclude": ["node_modules"]
19
20
  }