@azure/arm-reservations 8.0.1-alpha.20230303.1 → 9.0.0

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 (72) hide show
  1. package/CHANGELOG.md +11 -8
  2. package/dist/index.js +133 -91
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.min.js +1 -1
  5. package/dist/index.min.js.map +1 -1
  6. package/dist-esm/src/azureReservationAPI.js +1 -1
  7. package/dist-esm/src/lroImpl.d.ts +6 -11
  8. package/dist-esm/src/lroImpl.d.ts.map +1 -1
  9. package/dist-esm/src/lroImpl.js +12 -20
  10. package/dist-esm/src/lroImpl.js.map +1 -1
  11. package/dist-esm/src/models/index.d.ts +7 -3
  12. package/dist-esm/src/models/index.d.ts.map +1 -1
  13. package/dist-esm/src/models/index.js.map +1 -1
  14. package/dist-esm/src/models/mappers.d.ts.map +1 -1
  15. package/dist-esm/src/models/mappers.js +14 -0
  16. package/dist-esm/src/models/mappers.js.map +1 -1
  17. package/dist-esm/src/operations/calculateExchange.d.ts +2 -2
  18. package/dist-esm/src/operations/calculateExchange.d.ts.map +1 -1
  19. package/dist-esm/src/operations/calculateExchange.js +11 -7
  20. package/dist-esm/src/operations/calculateExchange.js.map +1 -1
  21. package/dist-esm/src/operations/exchange.d.ts +2 -2
  22. package/dist-esm/src/operations/exchange.d.ts.map +1 -1
  23. package/dist-esm/src/operations/exchange.js +11 -7
  24. package/dist-esm/src/operations/exchange.js.map +1 -1
  25. package/dist-esm/src/operations/quota.d.ts +3 -3
  26. package/dist-esm/src/operations/quota.d.ts.map +1 -1
  27. package/dist-esm/src/operations/quota.js +34 -26
  28. package/dist-esm/src/operations/quota.js.map +1 -1
  29. package/dist-esm/src/operations/reservation.d.ts +5 -5
  30. package/dist-esm/src/operations/reservation.d.ts.map +1 -1
  31. package/dist-esm/src/operations/reservation.js +37 -21
  32. package/dist-esm/src/operations/reservation.js.map +1 -1
  33. package/dist-esm/src/operations/reservationOrder.d.ts +2 -2
  34. package/dist-esm/src/operations/reservationOrder.d.ts.map +1 -1
  35. package/dist-esm/src/operations/reservationOrder.js +11 -7
  36. package/dist-esm/src/operations/reservationOrder.js.map +1 -1
  37. package/dist-esm/src/operations/return.d.ts +2 -2
  38. package/dist-esm/src/operations/return.d.ts.map +1 -1
  39. package/dist-esm/src/operations/return.js +15 -15
  40. package/dist-esm/src/operations/return.js.map +1 -1
  41. package/dist-esm/src/operationsInterfaces/calculateExchange.d.ts +2 -2
  42. package/dist-esm/src/operationsInterfaces/calculateExchange.d.ts.map +1 -1
  43. package/dist-esm/src/operationsInterfaces/exchange.d.ts +2 -2
  44. package/dist-esm/src/operationsInterfaces/exchange.d.ts.map +1 -1
  45. package/dist-esm/src/operationsInterfaces/quota.d.ts +3 -3
  46. package/dist-esm/src/operationsInterfaces/quota.d.ts.map +1 -1
  47. package/dist-esm/src/operationsInterfaces/reservation.d.ts +5 -5
  48. package/dist-esm/src/operationsInterfaces/reservation.d.ts.map +1 -1
  49. package/dist-esm/src/operationsInterfaces/reservationOrder.d.ts +2 -2
  50. package/dist-esm/src/operationsInterfaces/reservationOrder.d.ts.map +1 -1
  51. package/dist-esm/src/operationsInterfaces/return.d.ts +2 -2
  52. package/dist-esm/src/operationsInterfaces/return.d.ts.map +1 -1
  53. package/dist-esm/test/reservations_examples.spec.js +1 -1
  54. package/package.json +7 -7
  55. package/review/arm-reservations.api.md +15 -13
  56. package/src/azureReservationAPI.ts +1 -1
  57. package/src/lroImpl.ts +31 -23
  58. package/src/models/index.ts +7 -3
  59. package/src/models/mappers.ts +14 -0
  60. package/src/operations/calculateExchange.ts +20 -13
  61. package/src/operations/exchange.ts +19 -12
  62. package/src/operations/quota.ts +33 -23
  63. package/src/operations/reservation.ts +61 -45
  64. package/src/operations/reservationOrder.ts +20 -13
  65. package/src/operations/return.ts +23 -20
  66. package/src/operationsInterfaces/calculateExchange.ts +3 -3
  67. package/src/operationsInterfaces/exchange.ts +2 -2
  68. package/src/operationsInterfaces/quota.ts +4 -4
  69. package/src/operationsInterfaces/reservation.ts +9 -9
  70. package/src/operationsInterfaces/reservationOrder.ts +3 -3
  71. package/src/operationsInterfaces/return.ts +2 -2
  72. package/types/arm-reservations.d.ts +19 -15
package/src/lroImpl.ts CHANGED
@@ -6,29 +6,37 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
 
9
+ // Copyright (c) Microsoft Corporation.
10
+ // Licensed under the MIT license.
11
+
12
+ import { AbortSignalLike } from "@azure/abort-controller";
9
13
  import { LongRunningOperation, LroResponse } from "@azure/core-lro";
10
14
 
11
- export class LroImpl<T> implements LongRunningOperation<T> {
12
- constructor(
13
- private sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>,
14
- private args: Record<string, unknown>,
15
- private spec: {
16
- readonly requestBody?: unknown;
17
- readonly path?: string;
18
- readonly httpMethod: string;
19
- } & Record<string, any>,
20
- public requestPath: string = spec.path!,
21
- public requestMethod: string = spec.httpMethod
22
- ) {}
23
- public async sendInitialRequest(): Promise<LroResponse<T>> {
24
- return this.sendOperationFn(this.args, this.spec);
25
- }
26
- public async sendPollRequest(path: string): Promise<LroResponse<T>> {
27
- const { requestBody, ...restSpec } = this.spec;
28
- return this.sendOperationFn(this.args, {
29
- ...restSpec,
30
- path,
31
- httpMethod: "GET"
32
- });
33
- }
15
+ export function createLroSpec<T>(inputs: {
16
+ sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>;
17
+ args: Record<string, unknown>;
18
+ spec: {
19
+ readonly requestBody?: unknown;
20
+ readonly path?: string;
21
+ readonly httpMethod: string;
22
+ } & Record<string, any>;
23
+ }): LongRunningOperation<T> {
24
+ const { args, spec, sendOperationFn } = inputs;
25
+ return {
26
+ requestMethod: spec.httpMethod,
27
+ requestPath: spec.path!,
28
+ sendInitialRequest: () => sendOperationFn(args, spec),
29
+ sendPollRequest: (
30
+ path: string,
31
+ options?: { abortSignal?: AbortSignalLike }
32
+ ) => {
33
+ const { requestBody, ...restSpec } = spec;
34
+ return sendOperationFn(args, {
35
+ ...restSpec,
36
+ httpMethod: "GET",
37
+ path,
38
+ abortSignal: options?.abortSignal
39
+ });
40
+ }
41
+ };
34
42
  }
@@ -121,6 +121,10 @@ export interface SkuProperty {
121
121
  export interface CatalogMsrp {
122
122
  /** Amount in pricing currency. Tax not included. */
123
123
  p1Y?: Price;
124
+ /** Amount in pricing currency. Tax not included. */
125
+ p3Y?: Price;
126
+ /** Amount in pricing currency. Tax not included. */
127
+ p5Y?: Price;
124
128
  }
125
129
 
126
130
  /** Pricing information containing the amount and the currency code */
@@ -196,7 +200,7 @@ export interface PurchaseRequest {
196
200
  displayName?: string;
197
201
  /** Type of the Applied Scope. */
198
202
  appliedScopeType?: AppliedScopeType;
199
- /** List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. */
203
+ /** List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. This property will be deprecated and replaced by appliedScopeProperties instead for Single AppliedScopeType. */
200
204
  appliedScopes?: string[];
201
205
  /** Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup */
202
206
  appliedScopeProperties?: AppliedScopeProperties;
@@ -610,7 +614,7 @@ export interface ReservationList {
610
614
  export interface Patch {
611
615
  /** Type of the Applied Scope. */
612
616
  appliedScopeType?: AppliedScopeType;
613
- /** List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. */
617
+ /** List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. This property will be deprecated and replaced by appliedScopeProperties instead for Single AppliedScopeType. */
614
618
  appliedScopes?: string[];
615
619
  /** Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup */
616
620
  appliedScopeProperties?: AppliedScopeProperties;
@@ -2621,7 +2625,7 @@ export interface ReturnPostOptionalParams extends coreClient.OperationOptions {
2621
2625
  }
2622
2626
 
2623
2627
  /** Contains response data for the post operation. */
2624
- export type ReturnPostResponse = ReturnPostHeaders & RefundResponse;
2628
+ export type ReturnPostResponse = ReservationOrderResponse;
2625
2629
 
2626
2630
  /** Optional parameters. */
2627
2631
  export interface CalculateExchangePostOptionalParams
@@ -322,6 +322,20 @@ export const CatalogMsrp: coreClient.CompositeMapper = {
322
322
  name: "Composite",
323
323
  className: "Price"
324
324
  }
325
+ },
326
+ p3Y: {
327
+ serializedName: "p3Y",
328
+ type: {
329
+ name: "Composite",
330
+ className: "Price"
331
+ }
332
+ },
333
+ p5Y: {
334
+ serializedName: "p5Y",
335
+ type: {
336
+ name: "Composite",
337
+ className: "Price"
338
+ }
325
339
  }
326
340
  }
327
341
  }
@@ -11,8 +11,12 @@ import * as coreClient from "@azure/core-client";
11
11
  import * as Mappers from "../models/mappers";
12
12
  import * as Parameters from "../models/parameters";
13
13
  import { AzureReservationAPI } from "../azureReservationAPI";
14
- import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
15
- import { LroImpl } from "../lroImpl";
14
+ import {
15
+ SimplePollerLike,
16
+ OperationState,
17
+ createHttpPoller
18
+ } from "@azure/core-lro";
19
+ import { createLroSpec } from "../lroImpl";
16
20
  import {
17
21
  CalculateExchangeRequest,
18
22
  CalculateExchangePostOptionalParams,
@@ -41,8 +45,8 @@ export class CalculateExchangeImpl implements CalculateExchange {
41
45
  body: CalculateExchangeRequest,
42
46
  options?: CalculateExchangePostOptionalParams
43
47
  ): Promise<
44
- PollerLike<
45
- PollOperationState<CalculateExchangePostResponse>,
48
+ SimplePollerLike<
49
+ OperationState<CalculateExchangePostResponse>,
46
50
  CalculateExchangePostResponse
47
51
  >
48
52
  > {
@@ -52,7 +56,7 @@ export class CalculateExchangeImpl implements CalculateExchange {
52
56
  ): Promise<CalculateExchangePostResponse> => {
53
57
  return this.client.sendOperationRequest(args, spec);
54
58
  };
55
- const sendOperation = async (
59
+ const sendOperationFn = async (
56
60
  args: coreClient.OperationArguments,
57
61
  spec: coreClient.OperationSpec
58
62
  ) => {
@@ -85,15 +89,18 @@ export class CalculateExchangeImpl implements CalculateExchange {
85
89
  };
86
90
  };
87
91
 
88
- const lro = new LroImpl(
89
- sendOperation,
90
- { body, options },
91
- postOperationSpec
92
- );
93
- const poller = new LroEngine(lro, {
94
- resumeFrom: options?.resumeFrom,
92
+ const lro = createLroSpec({
93
+ sendOperationFn,
94
+ args: { body, options },
95
+ spec: postOperationSpec
96
+ });
97
+ const poller = await createHttpPoller<
98
+ CalculateExchangePostResponse,
99
+ OperationState<CalculateExchangePostResponse>
100
+ >(lro, {
101
+ restoreFrom: options?.resumeFrom,
95
102
  intervalInMs: options?.updateIntervalInMs,
96
- lroResourceLocationConfig: "azure-async-operation"
103
+ resourceLocationConfig: "azure-async-operation"
97
104
  });
98
105
  await poller.poll();
99
106
  return poller;
@@ -11,8 +11,12 @@ import * as coreClient from "@azure/core-client";
11
11
  import * as Mappers from "../models/mappers";
12
12
  import * as Parameters from "../models/parameters";
13
13
  import { AzureReservationAPI } from "../azureReservationAPI";
14
- import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
15
- import { LroImpl } from "../lroImpl";
14
+ import {
15
+ SimplePollerLike,
16
+ OperationState,
17
+ createHttpPoller
18
+ } from "@azure/core-lro";
19
+ import { createLroSpec } from "../lroImpl";
16
20
  import {
17
21
  ExchangeRequest,
18
22
  ExchangePostOptionalParams,
@@ -41,7 +45,7 @@ export class ExchangeImpl implements Exchange {
41
45
  body: ExchangeRequest,
42
46
  options?: ExchangePostOptionalParams
43
47
  ): Promise<
44
- PollerLike<PollOperationState<ExchangePostResponse>, ExchangePostResponse>
48
+ SimplePollerLike<OperationState<ExchangePostResponse>, ExchangePostResponse>
45
49
  > {
46
50
  const directSendOperation = async (
47
51
  args: coreClient.OperationArguments,
@@ -49,7 +53,7 @@ export class ExchangeImpl implements Exchange {
49
53
  ): Promise<ExchangePostResponse> => {
50
54
  return this.client.sendOperationRequest(args, spec);
51
55
  };
52
- const sendOperation = async (
56
+ const sendOperationFn = async (
53
57
  args: coreClient.OperationArguments,
54
58
  spec: coreClient.OperationSpec
55
59
  ) => {
@@ -82,15 +86,18 @@ export class ExchangeImpl implements Exchange {
82
86
  };
83
87
  };
84
88
 
85
- const lro = new LroImpl(
86
- sendOperation,
87
- { body, options },
88
- postOperationSpec
89
- );
90
- const poller = new LroEngine(lro, {
91
- resumeFrom: options?.resumeFrom,
89
+ const lro = createLroSpec({
90
+ sendOperationFn,
91
+ args: { body, options },
92
+ spec: postOperationSpec
93
+ });
94
+ const poller = await createHttpPoller<
95
+ ExchangePostResponse,
96
+ OperationState<ExchangePostResponse>
97
+ >(lro, {
98
+ restoreFrom: options?.resumeFrom,
92
99
  intervalInMs: options?.updateIntervalInMs,
93
- lroResourceLocationConfig: "azure-async-operation"
100
+ resourceLocationConfig: "azure-async-operation"
94
101
  });
95
102
  await poller.poll();
96
103
  return poller;
@@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client";
13
13
  import * as Mappers from "../models/mappers";
14
14
  import * as Parameters from "../models/parameters";
15
15
  import { AzureReservationAPI } from "../azureReservationAPI";
16
- import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
17
- import { LroImpl } from "../lroImpl";
16
+ import {
17
+ SimplePollerLike,
18
+ OperationState,
19
+ createHttpPoller
20
+ } from "@azure/core-lro";
21
+ import { createLroSpec } from "../lroImpl";
18
22
  import {
19
23
  CurrentQuotaLimitBase,
20
24
  QuotaListNextOptionalParams,
@@ -178,8 +182,8 @@ export class QuotaImpl implements Quota {
178
182
  createQuotaRequest: CurrentQuotaLimitBase,
179
183
  options?: QuotaCreateOrUpdateOptionalParams
180
184
  ): Promise<
181
- PollerLike<
182
- PollOperationState<QuotaCreateOrUpdateResponse>,
185
+ SimplePollerLike<
186
+ OperationState<QuotaCreateOrUpdateResponse>,
183
187
  QuotaCreateOrUpdateResponse
184
188
  >
185
189
  > {
@@ -189,7 +193,7 @@ export class QuotaImpl implements Quota {
189
193
  ): Promise<QuotaCreateOrUpdateResponse> => {
190
194
  return this.client.sendOperationRequest(args, spec);
191
195
  };
192
- const sendOperation = async (
196
+ const sendOperationFn = async (
193
197
  args: coreClient.OperationArguments,
194
198
  spec: coreClient.OperationSpec
195
199
  ) => {
@@ -222,9 +226,9 @@ export class QuotaImpl implements Quota {
222
226
  };
223
227
  };
224
228
 
225
- const lro = new LroImpl(
226
- sendOperation,
227
- {
229
+ const lro = createLroSpec({
230
+ sendOperationFn,
231
+ args: {
228
232
  subscriptionId,
229
233
  providerId,
230
234
  location,
@@ -232,12 +236,15 @@ export class QuotaImpl implements Quota {
232
236
  createQuotaRequest,
233
237
  options
234
238
  },
235
- createOrUpdateOperationSpec
236
- );
237
- const poller = new LroEngine(lro, {
238
- resumeFrom: options?.resumeFrom,
239
+ spec: createOrUpdateOperationSpec
240
+ });
241
+ const poller = await createHttpPoller<
242
+ QuotaCreateOrUpdateResponse,
243
+ OperationState<QuotaCreateOrUpdateResponse>
244
+ >(lro, {
245
+ restoreFrom: options?.resumeFrom,
239
246
  intervalInMs: options?.updateIntervalInMs,
240
- lroResourceLocationConfig: "original-uri"
247
+ resourceLocationConfig: "original-uri"
241
248
  });
242
249
  await poller.poll();
243
250
  return poller;
@@ -301,7 +308,7 @@ export class QuotaImpl implements Quota {
301
308
  createQuotaRequest: CurrentQuotaLimitBase,
302
309
  options?: QuotaUpdateOptionalParams
303
310
  ): Promise<
304
- PollerLike<PollOperationState<QuotaUpdateResponse>, QuotaUpdateResponse>
311
+ SimplePollerLike<OperationState<QuotaUpdateResponse>, QuotaUpdateResponse>
305
312
  > {
306
313
  const directSendOperation = async (
307
314
  args: coreClient.OperationArguments,
@@ -309,7 +316,7 @@ export class QuotaImpl implements Quota {
309
316
  ): Promise<QuotaUpdateResponse> => {
310
317
  return this.client.sendOperationRequest(args, spec);
311
318
  };
312
- const sendOperation = async (
319
+ const sendOperationFn = async (
313
320
  args: coreClient.OperationArguments,
314
321
  spec: coreClient.OperationSpec
315
322
  ) => {
@@ -342,9 +349,9 @@ export class QuotaImpl implements Quota {
342
349
  };
343
350
  };
344
351
 
345
- const lro = new LroImpl(
346
- sendOperation,
347
- {
352
+ const lro = createLroSpec({
353
+ sendOperationFn,
354
+ args: {
348
355
  subscriptionId,
349
356
  providerId,
350
357
  location,
@@ -352,12 +359,15 @@ export class QuotaImpl implements Quota {
352
359
  createQuotaRequest,
353
360
  options
354
361
  },
355
- updateOperationSpec
356
- );
357
- const poller = new LroEngine(lro, {
358
- resumeFrom: options?.resumeFrom,
362
+ spec: updateOperationSpec
363
+ });
364
+ const poller = await createHttpPoller<
365
+ QuotaUpdateResponse,
366
+ OperationState<QuotaUpdateResponse>
367
+ >(lro, {
368
+ restoreFrom: options?.resumeFrom,
359
369
  intervalInMs: options?.updateIntervalInMs,
360
- lroResourceLocationConfig: "original-uri"
370
+ resourceLocationConfig: "original-uri"
361
371
  });
362
372
  await poller.poll();
363
373
  return poller;
@@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client";
13
13
  import * as Mappers from "../models/mappers";
14
14
  import * as Parameters from "../models/parameters";
15
15
  import { AzureReservationAPI } from "../azureReservationAPI";
16
- import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
17
- import { LroImpl } from "../lroImpl";
16
+ import {
17
+ SimplePollerLike,
18
+ OperationState,
19
+ createHttpPoller
20
+ } from "@azure/core-lro";
21
+ import { createLroSpec } from "../lroImpl";
18
22
  import {
19
23
  ReservationResponse,
20
24
  ReservationListNextOptionalParams,
@@ -275,8 +279,8 @@ export class ReservationImpl implements Reservation {
275
279
  body: AvailableScopeRequest,
276
280
  options?: ReservationAvailableScopesOptionalParams
277
281
  ): Promise<
278
- PollerLike<
279
- PollOperationState<ReservationAvailableScopesResponse>,
282
+ SimplePollerLike<
283
+ OperationState<ReservationAvailableScopesResponse>,
280
284
  ReservationAvailableScopesResponse
281
285
  >
282
286
  > {
@@ -286,7 +290,7 @@ export class ReservationImpl implements Reservation {
286
290
  ): Promise<ReservationAvailableScopesResponse> => {
287
291
  return this.client.sendOperationRequest(args, spec);
288
292
  };
289
- const sendOperation = async (
293
+ const sendOperationFn = async (
290
294
  args: coreClient.OperationArguments,
291
295
  spec: coreClient.OperationSpec
292
296
  ) => {
@@ -319,13 +323,16 @@ export class ReservationImpl implements Reservation {
319
323
  };
320
324
  };
321
325
 
322
- const lro = new LroImpl(
323
- sendOperation,
324
- { reservationOrderId, reservationId, body, options },
325
- availableScopesOperationSpec
326
- );
327
- const poller = new LroEngine(lro, {
328
- resumeFrom: options?.resumeFrom,
326
+ const lro = createLroSpec({
327
+ sendOperationFn,
328
+ args: { reservationOrderId, reservationId, body, options },
329
+ spec: availableScopesOperationSpec
330
+ });
331
+ const poller = await createHttpPoller<
332
+ ReservationAvailableScopesResponse,
333
+ OperationState<ReservationAvailableScopesResponse>
334
+ >(lro, {
335
+ restoreFrom: options?.resumeFrom,
329
336
  intervalInMs: options?.updateIntervalInMs
330
337
  });
331
338
  await poller.poll();
@@ -366,8 +373,8 @@ export class ReservationImpl implements Reservation {
366
373
  body: SplitRequest,
367
374
  options?: ReservationSplitOptionalParams
368
375
  ): Promise<
369
- PollerLike<
370
- PollOperationState<ReservationSplitResponse>,
376
+ SimplePollerLike<
377
+ OperationState<ReservationSplitResponse>,
371
378
  ReservationSplitResponse
372
379
  >
373
380
  > {
@@ -377,7 +384,7 @@ export class ReservationImpl implements Reservation {
377
384
  ): Promise<ReservationSplitResponse> => {
378
385
  return this.client.sendOperationRequest(args, spec);
379
386
  };
380
- const sendOperation = async (
387
+ const sendOperationFn = async (
381
388
  args: coreClient.OperationArguments,
382
389
  spec: coreClient.OperationSpec
383
390
  ) => {
@@ -410,15 +417,18 @@ export class ReservationImpl implements Reservation {
410
417
  };
411
418
  };
412
419
 
413
- const lro = new LroImpl(
414
- sendOperation,
415
- { reservationOrderId, body, options },
416
- splitOperationSpec
417
- );
418
- const poller = new LroEngine(lro, {
419
- resumeFrom: options?.resumeFrom,
420
+ const lro = createLroSpec({
421
+ sendOperationFn,
422
+ args: { reservationOrderId, body, options },
423
+ spec: splitOperationSpec
424
+ });
425
+ const poller = await createHttpPoller<
426
+ ReservationSplitResponse,
427
+ OperationState<ReservationSplitResponse>
428
+ >(lro, {
429
+ restoreFrom: options?.resumeFrom,
420
430
  intervalInMs: options?.updateIntervalInMs,
421
- lroResourceLocationConfig: "location"
431
+ resourceLocationConfig: "location"
422
432
  });
423
433
  await poller.poll();
424
434
  return poller;
@@ -451,8 +461,8 @@ export class ReservationImpl implements Reservation {
451
461
  body: MergeRequest,
452
462
  options?: ReservationMergeOptionalParams
453
463
  ): Promise<
454
- PollerLike<
455
- PollOperationState<ReservationMergeResponse>,
464
+ SimplePollerLike<
465
+ OperationState<ReservationMergeResponse>,
456
466
  ReservationMergeResponse
457
467
  >
458
468
  > {
@@ -462,7 +472,7 @@ export class ReservationImpl implements Reservation {
462
472
  ): Promise<ReservationMergeResponse> => {
463
473
  return this.client.sendOperationRequest(args, spec);
464
474
  };
465
- const sendOperation = async (
475
+ const sendOperationFn = async (
466
476
  args: coreClient.OperationArguments,
467
477
  spec: coreClient.OperationSpec
468
478
  ) => {
@@ -495,15 +505,18 @@ export class ReservationImpl implements Reservation {
495
505
  };
496
506
  };
497
507
 
498
- const lro = new LroImpl(
499
- sendOperation,
500
- { reservationOrderId, body, options },
501
- mergeOperationSpec
502
- );
503
- const poller = new LroEngine(lro, {
504
- resumeFrom: options?.resumeFrom,
508
+ const lro = createLroSpec({
509
+ sendOperationFn,
510
+ args: { reservationOrderId, body, options },
511
+ spec: mergeOperationSpec
512
+ });
513
+ const poller = await createHttpPoller<
514
+ ReservationMergeResponse,
515
+ OperationState<ReservationMergeResponse>
516
+ >(lro, {
517
+ restoreFrom: options?.resumeFrom,
505
518
  intervalInMs: options?.updateIntervalInMs,
506
- lroResourceLocationConfig: "location"
519
+ resourceLocationConfig: "location"
507
520
  });
508
521
  await poller.poll();
509
522
  return poller;
@@ -570,8 +583,8 @@ export class ReservationImpl implements Reservation {
570
583
  parameters: Patch,
571
584
  options?: ReservationUpdateOptionalParams
572
585
  ): Promise<
573
- PollerLike<
574
- PollOperationState<ReservationUpdateResponse>,
586
+ SimplePollerLike<
587
+ OperationState<ReservationUpdateResponse>,
575
588
  ReservationUpdateResponse
576
589
  >
577
590
  > {
@@ -581,7 +594,7 @@ export class ReservationImpl implements Reservation {
581
594
  ): Promise<ReservationUpdateResponse> => {
582
595
  return this.client.sendOperationRequest(args, spec);
583
596
  };
584
- const sendOperation = async (
597
+ const sendOperationFn = async (
585
598
  args: coreClient.OperationArguments,
586
599
  spec: coreClient.OperationSpec
587
600
  ) => {
@@ -614,15 +627,18 @@ export class ReservationImpl implements Reservation {
614
627
  };
615
628
  };
616
629
 
617
- const lro = new LroImpl(
618
- sendOperation,
619
- { reservationOrderId, reservationId, parameters, options },
620
- updateOperationSpec
621
- );
622
- const poller = new LroEngine(lro, {
623
- resumeFrom: options?.resumeFrom,
630
+ const lro = createLroSpec({
631
+ sendOperationFn,
632
+ args: { reservationOrderId, reservationId, parameters, options },
633
+ spec: updateOperationSpec
634
+ });
635
+ const poller = await createHttpPoller<
636
+ ReservationUpdateResponse,
637
+ OperationState<ReservationUpdateResponse>
638
+ >(lro, {
639
+ restoreFrom: options?.resumeFrom,
624
640
  intervalInMs: options?.updateIntervalInMs,
625
- lroResourceLocationConfig: "azure-async-operation"
641
+ resourceLocationConfig: "azure-async-operation"
626
642
  });
627
643
  await poller.poll();
628
644
  return poller;
@@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client";
13
13
  import * as Mappers from "../models/mappers";
14
14
  import * as Parameters from "../models/parameters";
15
15
  import { AzureReservationAPI } from "../azureReservationAPI";
16
- import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
17
- import { LroImpl } from "../lroImpl";
16
+ import {
17
+ SimplePollerLike,
18
+ OperationState,
19
+ createHttpPoller
20
+ } from "@azure/core-lro";
21
+ import { createLroSpec } from "../lroImpl";
18
22
  import {
19
23
  ReservationOrderResponse,
20
24
  ReservationOrderListNextOptionalParams,
@@ -136,8 +140,8 @@ export class ReservationOrderImpl implements ReservationOrder {
136
140
  body: PurchaseRequest,
137
141
  options?: ReservationOrderPurchaseOptionalParams
138
142
  ): Promise<
139
- PollerLike<
140
- PollOperationState<ReservationOrderPurchaseResponse>,
143
+ SimplePollerLike<
144
+ OperationState<ReservationOrderPurchaseResponse>,
141
145
  ReservationOrderPurchaseResponse
142
146
  >
143
147
  > {
@@ -147,7 +151,7 @@ export class ReservationOrderImpl implements ReservationOrder {
147
151
  ): Promise<ReservationOrderPurchaseResponse> => {
148
152
  return this.client.sendOperationRequest(args, spec);
149
153
  };
150
- const sendOperation = async (
154
+ const sendOperationFn = async (
151
155
  args: coreClient.OperationArguments,
152
156
  spec: coreClient.OperationSpec
153
157
  ) => {
@@ -180,15 +184,18 @@ export class ReservationOrderImpl implements ReservationOrder {
180
184
  };
181
185
  };
182
186
 
183
- const lro = new LroImpl(
184
- sendOperation,
185
- { reservationOrderId, body, options },
186
- purchaseOperationSpec
187
- );
188
- const poller = new LroEngine(lro, {
189
- resumeFrom: options?.resumeFrom,
187
+ const lro = createLroSpec({
188
+ sendOperationFn,
189
+ args: { reservationOrderId, body, options },
190
+ spec: purchaseOperationSpec
191
+ });
192
+ const poller = await createHttpPoller<
193
+ ReservationOrderPurchaseResponse,
194
+ OperationState<ReservationOrderPurchaseResponse>
195
+ >(lro, {
196
+ restoreFrom: options?.resumeFrom,
190
197
  intervalInMs: options?.updateIntervalInMs,
191
- lroResourceLocationConfig: "location"
198
+ resourceLocationConfig: "location"
192
199
  });
193
200
  await poller.poll();
194
201
  return poller;