@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.
Files changed (116) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +21 -0
  3. package/LICENSE.txt +1 -1
  4. package/README.md +70 -88
  5. package/dist/index.js +822 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.min.js +1 -0
  8. package/dist/index.min.js.map +1 -0
  9. package/dist-esm/samples-dev/getRateCard.d.ts +2 -0
  10. package/dist-esm/samples-dev/getRateCard.d.ts.map +1 -0
  11. package/dist-esm/samples-dev/getRateCard.js +30 -0
  12. package/dist-esm/samples-dev/getRateCard.js.map +1 -0
  13. package/dist-esm/src/index.d.ts +5 -0
  14. package/dist-esm/src/index.d.ts.map +1 -0
  15. package/dist-esm/src/index.js +12 -0
  16. package/dist-esm/src/index.js.map +1 -0
  17. package/dist-esm/src/models/index.d.ts +178 -0
  18. package/dist-esm/src/models/index.d.ts.map +1 -0
  19. package/{esm → dist-esm/src}/models/index.js +1 -0
  20. package/dist-esm/src/models/index.js.map +1 -0
  21. package/dist-esm/src/models/mappers.d.ts +19 -0
  22. package/dist-esm/src/models/mappers.d.ts.map +1 -0
  23. package/{esm → dist-esm/src}/models/mappers.js +129 -144
  24. package/dist-esm/src/models/mappers.js.map +1 -0
  25. package/dist-esm/src/models/parameters.d.ts +13 -0
  26. package/dist-esm/src/models/parameters.d.ts.map +1 -0
  27. package/{esm → dist-esm/src}/models/parameters.js +60 -60
  28. package/dist-esm/src/models/parameters.js.map +1 -0
  29. package/{esm → dist-esm/src}/operations/index.d.ts +0 -0
  30. package/dist-esm/src/operations/index.d.ts.map +1 -0
  31. package/{esm → dist-esm/src}/operations/index.js +1 -2
  32. package/dist-esm/src/operations/index.js.map +1 -0
  33. package/dist-esm/src/operations/rateCard.d.ts +27 -0
  34. package/dist-esm/src/operations/rateCard.d.ts.map +1 -0
  35. package/dist-esm/src/operations/rateCard.js +55 -0
  36. package/dist-esm/src/operations/rateCard.js.map +1 -0
  37. package/dist-esm/src/operations/usageAggregates.d.ts +38 -0
  38. package/dist-esm/src/operations/usageAggregates.d.ts.map +1 -0
  39. package/dist-esm/src/operations/usageAggregates.js +144 -0
  40. package/dist-esm/src/operations/usageAggregates.js.map +1 -0
  41. package/dist-esm/src/operationsInterfaces/index.d.ts +3 -0
  42. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
  43. package/{esm/models/usageAggregatesMappers.js → dist-esm/src/operationsInterfaces/index.js} +3 -2
  44. package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
  45. package/dist-esm/src/operationsInterfaces/rateCard.d.ts +19 -0
  46. package/dist-esm/src/operationsInterfaces/rateCard.d.ts.map +1 -0
  47. package/dist-esm/src/operationsInterfaces/rateCard.js +9 -0
  48. package/dist-esm/src/operationsInterfaces/rateCard.js.map +1 -0
  49. package/dist-esm/src/operationsInterfaces/usageAggregates.d.ts +13 -0
  50. package/dist-esm/src/operationsInterfaces/usageAggregates.d.ts.map +1 -0
  51. package/dist-esm/src/operationsInterfaces/usageAggregates.js +9 -0
  52. package/dist-esm/src/operationsInterfaces/usageAggregates.js.map +1 -0
  53. package/dist-esm/src/usageManagementClient.d.ts +20 -0
  54. package/dist-esm/src/usageManagementClient.d.ts.map +1 -0
  55. package/dist-esm/src/usageManagementClient.js +53 -0
  56. package/dist-esm/src/usageManagementClient.js.map +1 -0
  57. package/dist-esm/test/commerce_examples.d.ts +4 -0
  58. package/dist-esm/test/commerce_examples.d.ts.map +1 -0
  59. package/dist-esm/test/commerce_examples.js +58 -0
  60. package/dist-esm/test/commerce_examples.js.map +1 -0
  61. package/package.json +75 -33
  62. package/review/arm-commerce.api.md +178 -0
  63. package/rollup.config.js +181 -30
  64. package/src/{models/rateCardMappers.ts → index.ts} +4 -10
  65. package/src/models/index.ts +140 -353
  66. package/src/models/mappers.ts +135 -148
  67. package/src/models/parameters.ts +75 -61
  68. package/src/operations/index.ts +1 -2
  69. package/src/operations/rateCard.ts +36 -60
  70. package/src/operations/usageAggregates.ts +122 -88
  71. package/src/{models/usageAggregatesMappers.ts → operationsInterfaces/index.ts} +2 -7
  72. package/src/operationsInterfaces/rateCard.ts +30 -0
  73. package/src/operationsInterfaces/usageAggregates.ts +26 -0
  74. package/src/usageManagementClient.ts +64 -36
  75. package/tsconfig.json +5 -4
  76. package/types/arm-commerce.d.ts +247 -0
  77. package/types/tsdoc-metadata.json +11 -0
  78. package/dist/arm-commerce.js +0 -930
  79. package/dist/arm-commerce.js.map +0 -1
  80. package/dist/arm-commerce.min.js +0 -1
  81. package/dist/arm-commerce.min.js.map +0 -1
  82. package/esm/models/index.d.ts +0 -397
  83. package/esm/models/index.d.ts.map +0 -1
  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 -9
  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.map +0 -1
  98. package/esm/operations/index.d.ts.map +0 -1
  99. package/esm/operations/index.js.map +0 -1
  100. package/esm/operations/rateCard.d.ts +0 -43
  101. package/esm/operations/rateCard.d.ts.map +0 -1
  102. package/esm/operations/rateCard.js +0 -55
  103. package/esm/operations/rateCard.js.map +0 -1
  104. package/esm/operations/usageAggregates.d.ts +0 -58
  105. package/esm/operations/usageAggregates.d.ts.map +0 -1
  106. package/esm/operations/usageAggregates.js +0 -96
  107. package/esm/operations/usageAggregates.js.map +0 -1
  108. package/esm/usageManagementClient.d.ts +0 -26
  109. package/esm/usageManagementClient.d.ts.map +0 -1
  110. package/esm/usageManagementClient.js +0 -39
  111. package/esm/usageManagementClient.js.map +0 -1
  112. package/esm/usageManagementClientContext.d.ts +0 -23
  113. package/esm/usageManagementClientContext.d.ts.map +0 -1
  114. package/esm/usageManagementClientContext.js +0 -61
  115. package/esm/usageManagementClientContext.js.map +0 -1
  116. 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 * as msRest from "@azure/ms-rest-js";
11
- import * as Models from "../models";
12
- import * as Mappers from "../models/rateCardMappers";
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 { UsageManagementClientContext } from "../usageManagementClientContext";
13
+ import { UsageManagementClient } from "../usageManagementClient";
14
+ import { RateCardGetOptionalParams, RateCardGetResponse } from "../models";
15
15
 
16
- /** Class representing a RateCard. */
17
- export class RateCard {
18
- private readonly client: UsageManagementClientContext;
16
+ /** Class containing RateCard operations. */
17
+ export class RateCardImpl implements RateCard {
18
+ private readonly client: UsageManagementClient;
19
19
 
20
20
  /**
21
- * Create a RateCard.
22
- * @param {UsageManagementClientContext} client Reference to the service client.
21
+ * Initialize a new instance of the class RateCard class.
22
+ * @param client Reference to the service client
23
23
  */
24
- constructor(client: UsageManagementClientContext) {
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
- * subscription by Offer ID, Currency, Locale and Region. The metadata associated with the billing
31
- * meters, including but not limited to service names, types, resources, units of measure, and
32
- * regions, is subject to change at any time and without notice. If you intend to use this billing
33
- * data in an automated fashion, please use the billing meter GUID to uniquely identify each
34
- * billable item. If the billing meter GUID is scheduled to change due to a new billing model, you
35
- * will be notified in advance of the change.
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
- * operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale',
38
- * 'Region' are required to be a part of the $filter.
39
- * @param [options] The optional parameters
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(filter: string, options?: msRest.RequestOptionsBase): Promise<Models.RateCardGetResponse>;
43
- /**
44
- * @param filter The filter to apply on the operation. It ONLY supports the 'eq' and 'and' logical
45
- * operators at this time. All the 4 query parameters 'OfferDurableId', 'Currency', 'Locale',
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
- filter,
62
- options
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 = new msRest.Serializer(Mappers);
71
- const getOperationSpec: msRest.OperationSpec = {
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 * as msRest from "@azure/ms-rest-js";
11
- import * as Models from "../models";
12
- import * as Mappers from "../models/usageAggregatesMappers";
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 { UsageManagementClientContext } from "../usageManagementClientContext";
14
+ import { UsageManagementClient } from "../usageManagementClient";
15
+ import {
16
+ UsageAggregation,
17
+ UsageAggregatesListNextOptionalParams,
18
+ UsageAggregatesListOptionalParams,
19
+ UsageAggregatesListResponse,
20
+ UsageAggregatesListNextResponse
21
+ } from "../models";
15
22
 
16
- /** Class representing a UsageAggregates. */
17
- export class UsageAggregates {
18
- private readonly client: UsageManagementClientContext;
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
- * Create a UsageAggregates.
22
- * @param {UsageManagementClientContext} client Reference to the service client.
29
+ * Initialize a new instance of the class UsageAggregates class.
30
+ * @param client Reference to the service client
23
31
  */
24
- constructor(client: UsageManagementClientContext) {
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 [options] The optional parameters
33
- * @returns Promise<Models.UsageAggregatesListResponse>
40
+ * @param options The options parameters.
34
41
  */
35
- list(reportedStartTime: Date | string, reportedEndTime: Date | string, options?: Models.UsageAggregatesListOptionalParams): Promise<Models.UsageAggregatesListResponse>;
36
- /**
37
- * @param reportedStartTime The start of the time range to retrieve data for.
38
- * @param reportedEndTime The end of the time range to retrieve data for.
39
- * @param callback The callback
40
- */
41
- list(reportedStartTime: Date | string, reportedEndTime: Date | string, callback: msRest.ServiceCallback<Models.UsageAggregationListResult>): void;
42
- /**
43
- * @param reportedStartTime The start of the time range to retrieve data for.
44
- * @param reportedEndTime The end of the time range to retrieve data for.
45
- * @param options The optional parameters
46
- * @param callback The callback
47
- */
48
- list(reportedStartTime: Date | string, reportedEndTime: Date | string, options: Models.UsageAggregatesListOptionalParams, callback: msRest.ServiceCallback<Models.UsageAggregationListResult>): void;
49
- list(reportedStartTime: Date | string, reportedEndTime: Date | string, options?: Models.UsageAggregatesListOptionalParams | msRest.ServiceCallback<Models.UsageAggregationListResult>, callback?: msRest.ServiceCallback<Models.UsageAggregationListResult>): Promise<Models.UsageAggregatesListResponse> {
50
- return this.client.sendOperationRequest(
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
- listOperationSpec,
57
- callback) as Promise<Models.UsageAggregatesListResponse>;
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 callback The callback
103
+ * @param options The options parameters.
74
104
  */
75
- listNext(nextPageLink: string, reportedStartTime: Date | string, reportedEndTime: Date | string, callback: msRest.ServiceCallback<Models.UsageAggregationListResult>): void;
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
- * @param nextPageLink The NextLink from the previous successful call to List operation.
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 options The optional parameters
81
- * @param callback The callback
120
+ * @param nextLink The nextLink from the previous successful call to the List method.
121
+ * @param options The options parameters.
82
122
  */
83
- listNext(nextPageLink: string, reportedStartTime: Date | string, reportedEndTime: Date | string, options: Models.UsageAggregatesListNextOptionalParams, callback: msRest.ServiceCallback<Models.UsageAggregationListResult>): void;
84
- listNext(nextPageLink: string, reportedStartTime: Date | string, reportedEndTime: Date | string, options?: Models.UsageAggregatesListNextOptionalParams | msRest.ServiceCallback<Models.UsageAggregationListResult>, callback?: msRest.ServiceCallback<Models.UsageAggregationListResult>): Promise<Models.UsageAggregatesListNextResponse> {
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
- nextPageLink,
88
- reportedStartTime,
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 = new msRest.Serializer(Mappers);
99
- const listOperationSpec: msRest.OperationSpec = {
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
- path: "subscriptions/{subscriptionId}/providers/Microsoft.Commerce/UsageAggregates",
102
- urlParameters: [
103
- Parameters.subscriptionId
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
- headerParameters: [
114
- Parameters.acceptLanguage
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
- headerParameters: [
143
- Parameters.acceptLanguage
181
+ urlParameters: [
182
+ Parameters.$host,
183
+ Parameters.subscriptionId,
184
+ Parameters.nextLink
144
185
  ],
145
- responses: {
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
- discriminators,
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 msRest from "@azure/ms-rest-js";
11
- import { TokenCredential } from "@azure/core-auth";
12
- import * as Models from "./models";
13
- import * as Mappers from "./models/mappers";
14
- import * as operations from "./operations";
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
- class UsageManagementClient extends UsageManagementClientContext {
19
- // Operation groups
20
- usageAggregates: operations.UsageAggregates;
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 Credentials needed for the client to connect to Azure. Credentials
26
- * implementing the TokenCredential interface from the @azure/identity package are recommended. For
27
- * more information about these credentials, see
28
- * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
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(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.UsageManagementClientOptions) {
36
- super(credentials, subscriptionId, options);
37
- this.usageAggregates = new operations.UsageAggregates(this);
38
- this.rateCard = new operations.RateCard(this);
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
- // Operation Specifications
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
- export {
45
- UsageManagementClient,
46
- UsageManagementClientContext,
47
- Models as UsageManagementModels,
48
- Mappers as UsageManagementMappers
49
- };
50
- export * from "./operations";
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": "es5",
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
  }