@azure/arm-reservations 7.2.1-alpha.20230202.1 → 8.0.0-alpha.20230210.2
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 +71 -8
- package/LICENSE +1 -1
- package/dist/index.js +942 -224
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist-esm/samples-dev/calculateExchangePostSample.js +22 -2
- package/dist-esm/samples-dev/calculateExchangePostSample.js.map +1 -1
- package/dist-esm/samples-dev/calculateRefundPostSample.js +10 -3
- package/dist-esm/samples-dev/calculateRefundPostSample.js.map +1 -1
- package/dist-esm/samples-dev/exchangePostSample.js +9 -2
- package/dist-esm/samples-dev/exchangePostSample.js.map +1 -1
- package/dist-esm/samples-dev/getAppliedReservationListSample.js +9 -2
- package/dist-esm/samples-dev/getAppliedReservationListSample.js.map +1 -1
- package/dist-esm/samples-dev/getCatalogSample.js +26 -5
- package/dist-esm/samples-dev/getCatalogSample.js.map +1 -1
- package/dist-esm/samples-dev/operationListSample.js +9 -2
- package/dist-esm/samples-dev/operationListSample.js.map +1 -1
- package/dist-esm/samples-dev/quotaCreateOrUpdateSample.js +10 -3
- package/dist-esm/samples-dev/quotaCreateOrUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/quotaGetSample.js +8 -1
- package/dist-esm/samples-dev/quotaGetSample.js.map +1 -1
- package/dist-esm/samples-dev/quotaListSample.js +9 -2
- package/dist-esm/samples-dev/quotaListSample.js.map +1 -1
- package/dist-esm/samples-dev/quotaRequestStatusGetSample.js +10 -3
- package/dist-esm/samples-dev/quotaRequestStatusGetSample.js.map +1 -1
- package/dist-esm/samples-dev/quotaRequestStatusListSample.js +8 -1
- package/dist-esm/samples-dev/quotaRequestStatusListSample.js.map +1 -1
- package/dist-esm/samples-dev/quotaUpdateSample.js +8 -1
- package/dist-esm/samples-dev/quotaUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/reservationArchiveSample.js +9 -2
- package/dist-esm/samples-dev/reservationArchiveSample.js.map +1 -1
- package/dist-esm/samples-dev/reservationAvailableScopesSample.js +11 -4
- package/dist-esm/samples-dev/reservationAvailableScopesSample.js.map +1 -1
- package/dist-esm/samples-dev/reservationGetSample.js +11 -4
- package/dist-esm/samples-dev/reservationGetSample.js.map +1 -1
- package/dist-esm/samples-dev/reservationListAllSample.js +10 -3
- package/dist-esm/samples-dev/reservationListAllSample.js.map +1 -1
- package/dist-esm/samples-dev/reservationListRevisionsSample.js +11 -4
- package/dist-esm/samples-dev/reservationListRevisionsSample.js.map +1 -1
- package/dist-esm/samples-dev/reservationListSample.js +9 -2
- package/dist-esm/samples-dev/reservationListSample.js.map +1 -1
- package/dist-esm/samples-dev/reservationMergeSample.js +9 -2
- package/dist-esm/samples-dev/reservationMergeSample.js.map +1 -1
- package/dist-esm/samples-dev/reservationOrderCalculateSample.js +10 -3
- package/dist-esm/samples-dev/reservationOrderCalculateSample.js.map +1 -1
- package/dist-esm/samples-dev/reservationOrderChangeDirectorySample.js +9 -2
- package/dist-esm/samples-dev/reservationOrderChangeDirectorySample.js.map +1 -1
- package/dist-esm/samples-dev/reservationOrderGetSample.js +12 -5
- package/dist-esm/samples-dev/reservationOrderGetSample.js.map +1 -1
- package/dist-esm/samples-dev/reservationOrderListSample.js +9 -2
- package/dist-esm/samples-dev/reservationOrderListSample.js.map +1 -1
- package/dist-esm/samples-dev/reservationOrderPurchaseSample.js +9 -2
- package/dist-esm/samples-dev/reservationOrderPurchaseSample.js.map +1 -1
- package/dist-esm/samples-dev/reservationSplitSample.js +9 -2
- package/dist-esm/samples-dev/reservationSplitSample.js.map +1 -1
- package/dist-esm/samples-dev/reservationUnarchiveSample.js +11 -4
- package/dist-esm/samples-dev/reservationUnarchiveSample.js.map +1 -1
- package/dist-esm/samples-dev/reservationUpdateSample.js +9 -2
- package/dist-esm/samples-dev/reservationUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/returnPostSample.js +14 -7
- package/dist-esm/samples-dev/returnPostSample.js.map +1 -1
- package/dist-esm/src/azureReservationAPI.d.ts +18 -2
- package/dist-esm/src/azureReservationAPI.d.ts.map +1 -1
- package/dist-esm/src/azureReservationAPI.js +101 -15
- package/dist-esm/src/azureReservationAPI.js.map +1 -1
- package/dist-esm/src/index.d.ts +1 -0
- package/dist-esm/src/index.d.ts.map +1 -1
- package/dist-esm/src/index.js +1 -0
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/models/index.d.ts +372 -101
- package/dist-esm/src/models/index.d.ts.map +1 -1
- package/dist-esm/src/models/index.js +26 -0
- package/dist-esm/src/models/index.js.map +1 -1
- package/dist-esm/src/models/mappers.d.ts +14 -1
- package/dist-esm/src/models/mappers.d.ts.map +1 -1
- package/dist-esm/src/models/mappers.js +510 -70
- package/dist-esm/src/models/mappers.js.map +1 -1
- package/dist-esm/src/models/parameters.d.ts +2 -1
- package/dist-esm/src/models/parameters.d.ts.map +1 -1
- package/dist-esm/src/models/parameters.js +18 -9
- package/dist-esm/src/models/parameters.js.map +1 -1
- package/dist-esm/src/operations/operation.d.ts.map +1 -1
- package/dist-esm/src/operations/operation.js +19 -8
- package/dist-esm/src/operations/operation.js.map +1 -1
- package/dist-esm/src/operations/quota.d.ts.map +1 -1
- package/dist-esm/src/operations/quota.js +19 -8
- package/dist-esm/src/operations/quota.js.map +1 -1
- package/dist-esm/src/operations/quotaRequestStatus.d.ts.map +1 -1
- package/dist-esm/src/operations/quotaRequestStatus.js +19 -13
- package/dist-esm/src/operations/quotaRequestStatus.js.map +1 -1
- package/dist-esm/src/operations/reservation.d.ts +17 -17
- package/dist-esm/src/operations/reservation.d.ts.map +1 -1
- package/dist-esm/src/operations/reservation.js +83 -59
- package/dist-esm/src/operations/reservation.js.map +1 -1
- package/dist-esm/src/operations/reservationOrder.d.ts.map +1 -1
- package/dist-esm/src/operations/reservationOrder.js +20 -9
- package/dist-esm/src/operations/reservationOrder.js.map +1 -1
- package/dist-esm/src/operations/return.d.ts +10 -2
- package/dist-esm/src/operations/return.d.ts.map +1 -1
- package/dist-esm/src/operations/return.js +61 -3
- package/dist-esm/src/operations/return.js.map +1 -1
- package/dist-esm/src/operationsInterfaces/reservation.d.ts +15 -15
- package/dist-esm/src/operationsInterfaces/reservation.d.ts.map +1 -1
- package/dist-esm/src/operationsInterfaces/return.d.ts +10 -2
- package/dist-esm/src/operationsInterfaces/return.d.ts.map +1 -1
- package/dist-esm/src/pagingHelper.d.ts +13 -0
- package/dist-esm/src/pagingHelper.d.ts.map +1 -0
- package/dist-esm/src/pagingHelper.js +32 -0
- package/dist-esm/src/pagingHelper.js.map +1 -0
- package/package.json +6 -4
- package/review/arm-reservations.api.md +194 -94
- package/src/azureReservationAPI.ts +119 -15
- package/src/index.ts +1 -0
- package/src/models/index.ts +397 -107
- package/src/models/mappers.ts +536 -71
- package/src/models/parameters.ts +19 -9
- package/src/operations/operation.ts +21 -9
- package/src/operations/quota.ts +23 -15
- package/src/operations/quotaRequestStatus.ts +23 -20
- package/src/operations/reservation.ts +97 -69
- package/src/operations/reservationOrder.ts +23 -11
- package/src/operations/return.ts +82 -4
- package/src/operationsInterfaces/reservation.ts +15 -15
- package/src/operationsInterfaces/return.ts +16 -2
- package/src/pagingHelper.ts +39 -0
- package/types/arm-reservations.d.ts +432 -109
- package/types/tsdoc-metadata.json +1 -1
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
import * as coreClient from "@azure/core-client";
|
|
10
10
|
import * as coreRestPipeline from "@azure/core-rest-pipeline";
|
|
11
11
|
import * as coreAuth from "@azure/core-auth";
|
|
12
|
+
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
|
|
13
|
+
import { setContinuationToken } from "./pagingHelper";
|
|
12
14
|
import {
|
|
13
15
|
ReservationImpl,
|
|
14
16
|
ReservationOrderImpl,
|
|
@@ -35,12 +37,16 @@ import * as Parameters from "./models/parameters";
|
|
|
35
37
|
import * as Mappers from "./models/mappers";
|
|
36
38
|
import {
|
|
37
39
|
AzureReservationAPIOptionalParams,
|
|
40
|
+
Catalog,
|
|
41
|
+
GetCatalogNextOptionalParams,
|
|
38
42
|
GetCatalogOptionalParams,
|
|
39
43
|
GetCatalogResponse,
|
|
40
44
|
GetAppliedReservationListOptionalParams,
|
|
41
|
-
GetAppliedReservationListResponse
|
|
45
|
+
GetAppliedReservationListResponse,
|
|
46
|
+
GetCatalogNextResponse
|
|
42
47
|
} from "./models";
|
|
43
48
|
|
|
49
|
+
/// <reference lib="esnext.asynciterable" />
|
|
44
50
|
export class AzureReservationAPI extends coreClient.ServiceClient {
|
|
45
51
|
$host: string;
|
|
46
52
|
|
|
@@ -66,22 +72,19 @@ export class AzureReservationAPI extends coreClient.ServiceClient {
|
|
|
66
72
|
credential: credentials
|
|
67
73
|
};
|
|
68
74
|
|
|
69
|
-
const packageDetails = `azsdk-js-arm-reservations/
|
|
75
|
+
const packageDetails = `azsdk-js-arm-reservations/8.0.0`;
|
|
70
76
|
const userAgentPrefix =
|
|
71
77
|
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
72
78
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
73
79
|
: `${packageDetails}`;
|
|
74
80
|
|
|
75
|
-
if (!options.credentialScopes) {
|
|
76
|
-
options.credentialScopes = ["https://management.azure.com/.default"];
|
|
77
|
-
}
|
|
78
81
|
const optionsWithDefaults = {
|
|
79
82
|
...defaults,
|
|
80
83
|
...options,
|
|
81
84
|
userAgentOptions: {
|
|
82
85
|
userAgentPrefix
|
|
83
86
|
},
|
|
84
|
-
|
|
87
|
+
endpoint:
|
|
85
88
|
options.endpoint ?? options.baseUri ?? "https://management.azure.com"
|
|
86
89
|
};
|
|
87
90
|
super(optionsWithDefaults);
|
|
@@ -107,7 +110,9 @@ export class AzureReservationAPI extends coreClient.ServiceClient {
|
|
|
107
110
|
this.pipeline.addPolicy(
|
|
108
111
|
coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
109
112
|
credential: credentials,
|
|
110
|
-
scopes:
|
|
113
|
+
scopes:
|
|
114
|
+
optionsWithDefaults.credentialScopes ??
|
|
115
|
+
`${optionsWithDefaults.endpoint}/.default`,
|
|
111
116
|
challengeCallbacks: {
|
|
112
117
|
authorizeRequestOnChallenge:
|
|
113
118
|
coreClient.authorizeRequestOnClaimChallenge
|
|
@@ -134,7 +139,72 @@ export class AzureReservationAPI extends coreClient.ServiceClient {
|
|
|
134
139
|
* @param subscriptionId Id of the subscription
|
|
135
140
|
* @param options The options parameters.
|
|
136
141
|
*/
|
|
137
|
-
|
|
142
|
+
public listCatalog(
|
|
143
|
+
subscriptionId: string,
|
|
144
|
+
options?: GetCatalogOptionalParams
|
|
145
|
+
): PagedAsyncIterableIterator<Catalog> {
|
|
146
|
+
const iter = this.getCatalogPagingAll(subscriptionId, options);
|
|
147
|
+
return {
|
|
148
|
+
next() {
|
|
149
|
+
return iter.next();
|
|
150
|
+
},
|
|
151
|
+
[Symbol.asyncIterator]() {
|
|
152
|
+
return this;
|
|
153
|
+
},
|
|
154
|
+
byPage: (settings?: PageSettings) => {
|
|
155
|
+
if (settings?.maxPageSize) {
|
|
156
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
157
|
+
}
|
|
158
|
+
return this.getCatalogPagingPage(subscriptionId, options, settings);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
private async *getCatalogPagingPage(
|
|
164
|
+
subscriptionId: string,
|
|
165
|
+
options?: GetCatalogOptionalParams,
|
|
166
|
+
settings?: PageSettings
|
|
167
|
+
): AsyncIterableIterator<Catalog[]> {
|
|
168
|
+
let result: GetCatalogResponse;
|
|
169
|
+
let continuationToken = settings?.continuationToken;
|
|
170
|
+
if (!continuationToken) {
|
|
171
|
+
result = await this._getCatalog(subscriptionId, options);
|
|
172
|
+
let page = result.value || [];
|
|
173
|
+
continuationToken = result.nextLink;
|
|
174
|
+
setContinuationToken(page, continuationToken);
|
|
175
|
+
yield page;
|
|
176
|
+
}
|
|
177
|
+
while (continuationToken) {
|
|
178
|
+
result = await this._getCatalogNext(
|
|
179
|
+
subscriptionId,
|
|
180
|
+
continuationToken,
|
|
181
|
+
options
|
|
182
|
+
);
|
|
183
|
+
continuationToken = result.nextLink;
|
|
184
|
+
let page = result.value || [];
|
|
185
|
+
setContinuationToken(page, continuationToken);
|
|
186
|
+
yield page;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
private async *getCatalogPagingAll(
|
|
191
|
+
subscriptionId: string,
|
|
192
|
+
options?: GetCatalogOptionalParams
|
|
193
|
+
): AsyncIterableIterator<Catalog> {
|
|
194
|
+
for await (const page of this.getCatalogPagingPage(
|
|
195
|
+
subscriptionId,
|
|
196
|
+
options
|
|
197
|
+
)) {
|
|
198
|
+
yield* page;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Get the regions and skus that are available for RI purchase for the specified Azure subscription.
|
|
204
|
+
* @param subscriptionId Id of the subscription
|
|
205
|
+
* @param options The options parameters.
|
|
206
|
+
*/
|
|
207
|
+
private _getCatalog(
|
|
138
208
|
subscriptionId: string,
|
|
139
209
|
options?: GetCatalogOptionalParams
|
|
140
210
|
): Promise<GetCatalogResponse> {
|
|
@@ -160,6 +230,23 @@ export class AzureReservationAPI extends coreClient.ServiceClient {
|
|
|
160
230
|
);
|
|
161
231
|
}
|
|
162
232
|
|
|
233
|
+
/**
|
|
234
|
+
* GetCatalogNext
|
|
235
|
+
* @param subscriptionId Id of the subscription
|
|
236
|
+
* @param nextLink The nextLink from the previous successful call to the GetCatalog method.
|
|
237
|
+
* @param options The options parameters.
|
|
238
|
+
*/
|
|
239
|
+
private _getCatalogNext(
|
|
240
|
+
subscriptionId: string,
|
|
241
|
+
nextLink: string,
|
|
242
|
+
options?: GetCatalogNextOptionalParams
|
|
243
|
+
): Promise<GetCatalogNextResponse> {
|
|
244
|
+
return this.sendOperationRequest(
|
|
245
|
+
{ subscriptionId, nextLink, options },
|
|
246
|
+
getCatalogNextOperationSpec
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
163
250
|
reservation: Reservation;
|
|
164
251
|
reservationOrder: ReservationOrder;
|
|
165
252
|
operation: Operation;
|
|
@@ -178,12 +265,7 @@ const getCatalogOperationSpec: coreClient.OperationSpec = {
|
|
|
178
265
|
httpMethod: "GET",
|
|
179
266
|
responses: {
|
|
180
267
|
200: {
|
|
181
|
-
bodyMapper:
|
|
182
|
-
type: {
|
|
183
|
-
name: "Sequence",
|
|
184
|
-
element: { type: { name: "Composite", className: "Catalog" } }
|
|
185
|
-
}
|
|
186
|
-
}
|
|
268
|
+
bodyMapper: Mappers.CatalogsResult
|
|
187
269
|
},
|
|
188
270
|
default: {
|
|
189
271
|
bodyMapper: Mappers.ErrorModel
|
|
@@ -191,11 +273,14 @@ const getCatalogOperationSpec: coreClient.OperationSpec = {
|
|
|
191
273
|
},
|
|
192
274
|
queryParameters: [
|
|
193
275
|
Parameters.apiVersion,
|
|
276
|
+
Parameters.filter,
|
|
194
277
|
Parameters.reservedResourceType,
|
|
195
278
|
Parameters.location,
|
|
196
279
|
Parameters.publisherId,
|
|
197
280
|
Parameters.offerId,
|
|
198
|
-
Parameters.planId
|
|
281
|
+
Parameters.planId,
|
|
282
|
+
Parameters.skip,
|
|
283
|
+
Parameters.take1
|
|
199
284
|
],
|
|
200
285
|
urlParameters: [Parameters.$host, Parameters.subscriptionId],
|
|
201
286
|
headerParameters: [Parameters.accept],
|
|
@@ -218,3 +303,22 @@ const getAppliedReservationListOperationSpec: coreClient.OperationSpec = {
|
|
|
218
303
|
headerParameters: [Parameters.accept],
|
|
219
304
|
serializer
|
|
220
305
|
};
|
|
306
|
+
const getCatalogNextOperationSpec: coreClient.OperationSpec = {
|
|
307
|
+
path: "{nextLink}",
|
|
308
|
+
httpMethod: "GET",
|
|
309
|
+
responses: {
|
|
310
|
+
200: {
|
|
311
|
+
bodyMapper: Mappers.CatalogsResult
|
|
312
|
+
},
|
|
313
|
+
default: {
|
|
314
|
+
bodyMapper: Mappers.ErrorModel
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
urlParameters: [
|
|
318
|
+
Parameters.$host,
|
|
319
|
+
Parameters.nextLink,
|
|
320
|
+
Parameters.subscriptionId
|
|
321
|
+
],
|
|
322
|
+
headerParameters: [Parameters.accept],
|
|
323
|
+
serializer
|
|
324
|
+
};
|
package/src/index.ts
CHANGED