@azure/arm-azurestack 3.0.0-beta.3 → 3.0.0-beta.5

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 (51) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/index.js +237 -53
  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/azureStackManagementClient.d.ts +2 -0
  7. package/dist-esm/src/azureStackManagementClient.d.ts.map +1 -1
  8. package/dist-esm/src/azureStackManagementClient.js +54 -3
  9. package/dist-esm/src/azureStackManagementClient.js.map +1 -1
  10. package/dist-esm/src/index.d.ts +1 -0
  11. package/dist-esm/src/index.d.ts.map +1 -1
  12. package/dist-esm/src/index.js +1 -0
  13. package/dist-esm/src/index.js.map +1 -1
  14. package/dist-esm/src/models/index.d.ts +35 -11
  15. package/dist-esm/src/models/index.d.ts.map +1 -1
  16. package/dist-esm/src/models/index.js +23 -0
  17. package/dist-esm/src/models/index.js.map +1 -1
  18. package/dist-esm/src/operations/customerSubscriptions.d.ts.map +1 -1
  19. package/dist-esm/src/operations/customerSubscriptions.js +19 -7
  20. package/dist-esm/src/operations/customerSubscriptions.js.map +1 -1
  21. package/dist-esm/src/operations/linkedSubscriptions.d.ts.map +1 -1
  22. package/dist-esm/src/operations/linkedSubscriptions.js +37 -14
  23. package/dist-esm/src/operations/linkedSubscriptions.js.map +1 -1
  24. package/dist-esm/src/operations/operations.d.ts.map +1 -1
  25. package/dist-esm/src/operations/operations.js +19 -7
  26. package/dist-esm/src/operations/operations.js.map +1 -1
  27. package/dist-esm/src/operations/products.d.ts.map +1 -1
  28. package/dist-esm/src/operations/products.js +19 -7
  29. package/dist-esm/src/operations/products.js.map +1 -1
  30. package/dist-esm/src/operations/registrations.d.ts.map +1 -1
  31. package/dist-esm/src/operations/registrations.js +37 -14
  32. package/dist-esm/src/operations/registrations.js.map +1 -1
  33. package/dist-esm/src/pagingHelper.d.ts +13 -0
  34. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  35. package/dist-esm/src/pagingHelper.js +32 -0
  36. package/dist-esm/src/pagingHelper.js.map +1 -0
  37. package/dist-esm/test/sampleTest.js +11 -13
  38. package/dist-esm/test/sampleTest.js.map +1 -1
  39. package/package.json +15 -11
  40. package/review/arm-azurestack.api.md +33 -52
  41. package/src/azureStackManagementClient.ts +69 -2
  42. package/src/index.ts +1 -0
  43. package/src/models/index.ts +36 -12
  44. package/src/operations/customerSubscriptions.ts +26 -8
  45. package/src/operations/linkedSubscriptions.ts +45 -16
  46. package/src/operations/operations.ts +21 -8
  47. package/src/operations/products.ts +26 -8
  48. package/src/operations/registrations.ts +41 -16
  49. package/src/pagingHelper.ts +39 -0
  50. package/types/arm-azurestack.d.ts +46 -11
  51. package/types/tsdoc-metadata.json +1 -1
@@ -7,6 +7,12 @@
7
7
  */
8
8
 
9
9
  import * as coreClient from "@azure/core-client";
10
+ import * as coreRestPipeline from "@azure/core-rest-pipeline";
11
+ import {
12
+ PipelineRequest,
13
+ PipelineResponse,
14
+ SendRequest
15
+ } from "@azure/core-rest-pipeline";
10
16
  import * as coreAuth from "@azure/core-auth";
11
17
  import {
12
18
  OperationsImpl,
@@ -59,7 +65,7 @@ export class AzureStackManagementClient extends coreClient.ServiceClient {
59
65
  credential: credentials
60
66
  };
61
67
 
62
- const packageDetails = `azsdk-js-arm-azurestack/3.0.0-beta.3`;
68
+ const packageDetails = `azsdk-js-arm-azurestack/3.0.0-beta.5`;
63
69
  const userAgentPrefix =
64
70
  options.userAgentOptions && options.userAgentOptions.userAgentPrefix
65
71
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
@@ -71,10 +77,42 @@ export class AzureStackManagementClient extends coreClient.ServiceClient {
71
77
  userAgentOptions: {
72
78
  userAgentPrefix
73
79
  },
74
- baseUri:
80
+ endpoint:
75
81
  options.endpoint ?? options.baseUri ?? "https://management.azure.com"
76
82
  };
77
83
  super(optionsWithDefaults);
84
+
85
+ let bearerTokenAuthenticationPolicyFound: boolean = false;
86
+ if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
87
+ const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
88
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
89
+ (pipelinePolicy) =>
90
+ pipelinePolicy.name ===
91
+ coreRestPipeline.bearerTokenAuthenticationPolicyName
92
+ );
93
+ }
94
+ if (
95
+ !options ||
96
+ !options.pipeline ||
97
+ options.pipeline.getOrderedPolicies().length == 0 ||
98
+ !bearerTokenAuthenticationPolicyFound
99
+ ) {
100
+ this.pipeline.removePolicy({
101
+ name: coreRestPipeline.bearerTokenAuthenticationPolicyName
102
+ });
103
+ this.pipeline.addPolicy(
104
+ coreRestPipeline.bearerTokenAuthenticationPolicy({
105
+ credential: credentials,
106
+ scopes:
107
+ optionsWithDefaults.credentialScopes ??
108
+ `${optionsWithDefaults.endpoint}/.default`,
109
+ challengeCallbacks: {
110
+ authorizeRequestOnChallenge:
111
+ coreClient.authorizeRequestOnClaimChallenge
112
+ }
113
+ })
114
+ );
115
+ }
78
116
  // Parameter assignments
79
117
  this.subscriptionId = subscriptionId;
80
118
 
@@ -87,6 +125,35 @@ export class AzureStackManagementClient extends coreClient.ServiceClient {
87
125
  this.products = new ProductsImpl(this);
88
126
  this.registrations = new RegistrationsImpl(this);
89
127
  this.linkedSubscriptions = new LinkedSubscriptionsImpl(this);
128
+ this.addCustomApiVersionPolicy(options.apiVersion);
129
+ }
130
+
131
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
132
+ private addCustomApiVersionPolicy(apiVersion?: string) {
133
+ if (!apiVersion) {
134
+ return;
135
+ }
136
+ const apiVersionPolicy = {
137
+ name: "CustomApiVersionPolicy",
138
+ async sendRequest(
139
+ request: PipelineRequest,
140
+ next: SendRequest
141
+ ): Promise<PipelineResponse> {
142
+ const param = request.url.split("?");
143
+ if (param.length > 1) {
144
+ const newParams = param[1].split("&").map((item) => {
145
+ if (item.indexOf("api-version") > -1) {
146
+ return "api-version=" + apiVersion;
147
+ } else {
148
+ return item;
149
+ }
150
+ });
151
+ request.url = param[0] + "?" + newParams.join("&");
152
+ }
153
+ return next(request);
154
+ }
155
+ };
156
+ this.pipeline.addPolicy(apiVersionPolicy);
90
157
  }
91
158
 
92
159
  operations: Operations;
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  */
8
8
 
9
9
  /// <reference lib="esnext.asynciterable" />
10
+ export { getContinuationToken } from "./pagingHelper";
10
11
  export * from "./models";
11
12
  export { AzureStackManagementClient } from "./azureStackManagementClient";
12
13
  export * from "./operationsInterfaces";
@@ -499,13 +499,13 @@ export interface LinkedSubscriptionParameter {
499
499
  }
500
500
 
501
501
  /** Cloud specific manifest GET response. */
502
- export type CloudManifestFileResponse = Resource & {
502
+ export interface CloudManifestFileResponse extends Resource {
503
503
  /** Cloud specific manifest data. */
504
504
  properties?: CloudManifestFileProperties;
505
- };
505
+ }
506
506
 
507
507
  /** Customer subscription. */
508
- export type CustomerSubscription = Resource & {
508
+ export interface CustomerSubscription extends Resource {
509
509
  /**
510
510
  * Metadata pertaining to creation and last modification of the resource.
511
511
  * NOTE: This property will not be serialized. It can only be populated by the server.
@@ -513,10 +513,10 @@ export type CustomerSubscription = Resource & {
513
513
  readonly systemData?: SystemData;
514
514
  /** Tenant Id. */
515
515
  tenantId?: string;
516
- };
516
+ }
517
517
 
518
518
  /** Product information. */
519
- export type Product = Resource & {
519
+ export interface Product extends Resource {
520
520
  /**
521
521
  * Metadata pertaining to creation and last modification of the resource.
522
522
  * NOTE: This property will not be serialized. It can only be populated by the server.
@@ -558,24 +558,25 @@ export type Product = Resource & {
558
558
  productProperties?: ProductProperties;
559
559
  /** Product compatibility with current device. */
560
560
  compatibility?: Compatibility;
561
- };
561
+ }
562
562
 
563
563
  /** Product information. */
564
- export type ExtendedProductProperties = VirtualMachineExtensionProductProperties &
565
- VirtualMachineProductProperties & {};
564
+ export interface ExtendedProductProperties
565
+ extends VirtualMachineExtensionProductProperties,
566
+ VirtualMachineProductProperties {}
566
567
 
567
568
  /** Registration information. */
568
- export type Registration = TrackedResource & {
569
+ export interface Registration extends TrackedResource {
569
570
  /** The object identifier associated with the Azure Stack connecting to Azure. */
570
571
  objectId?: string;
571
572
  /** The identifier of the registered Azure Stack. */
572
573
  cloudId?: string;
573
574
  /** Specifies the billing mode for the Azure Stack registration. */
574
575
  billingModel?: string;
575
- };
576
+ }
576
577
 
577
578
  /** Linked Subscription information. */
578
- export type LinkedSubscription = TrackedResource & {
579
+ export interface LinkedSubscription extends TrackedResource {
579
580
  /** The identifier associated with the device subscription. */
580
581
  linkedSubscriptionId?: string;
581
582
  /** The identifier associated with the device registration. */
@@ -605,13 +606,17 @@ export type LinkedSubscription = TrackedResource & {
605
606
  * NOTE: This property will not be serialized. It can only be populated by the server.
606
607
  */
607
608
  readonly deviceConnectionStatus?: string;
608
- };
609
+ }
609
610
 
610
611
  /** Known values of {@link CreatedByType} that the service accepts. */
611
612
  export enum KnownCreatedByType {
613
+ /** User */
612
614
  User = "User",
615
+ /** Application */
613
616
  Application = "Application",
617
+ /** ManagedIdentity */
614
618
  ManagedIdentity = "ManagedIdentity",
619
+ /** Key */
615
620
  Key = "Key"
616
621
  }
617
622
 
@@ -629,15 +634,25 @@ export type CreatedByType = string;
629
634
 
630
635
  /** Known values of {@link CompatibilityIssue} that the service accepts. */
631
636
  export enum KnownCompatibilityIssue {
637
+ /** HigherDeviceVersionRequired */
632
638
  HigherDeviceVersionRequired = "HigherDeviceVersionRequired",
639
+ /** LowerDeviceVersionRequired */
633
640
  LowerDeviceVersionRequired = "LowerDeviceVersionRequired",
641
+ /** CapacityBillingModelRequired */
634
642
  CapacityBillingModelRequired = "CapacityBillingModelRequired",
643
+ /** PayAsYouGoBillingModelRequired */
635
644
  PayAsYouGoBillingModelRequired = "PayAsYouGoBillingModelRequired",
645
+ /** DevelopmentBillingModelRequired */
636
646
  DevelopmentBillingModelRequired = "DevelopmentBillingModelRequired",
647
+ /** AzureADIdentitySystemRequired */
637
648
  AzureADIdentitySystemRequired = "AzureADIdentitySystemRequired",
649
+ /** AdfsIdentitySystemRequired */
638
650
  AdfsIdentitySystemRequired = "ADFSIdentitySystemRequired",
651
+ /** ConnectionToInternetRequired */
639
652
  ConnectionToInternetRequired = "ConnectionToInternetRequired",
653
+ /** ConnectionToAzureRequired */
640
654
  ConnectionToAzureRequired = "ConnectionToAzureRequired",
655
+ /** DisconnectedEnvironmentRequired */
641
656
  DisconnectedEnvironmentRequired = "DisconnectedEnvironmentRequired"
642
657
  }
643
658
 
@@ -661,8 +676,11 @@ export type CompatibilityIssue = string;
661
676
 
662
677
  /** Known values of {@link ComputeRole} that the service accepts. */
663
678
  export enum KnownComputeRole {
679
+ /** None */
664
680
  None = "None",
681
+ /** IaaS */
665
682
  IaaS = "IaaS",
683
+ /** PaaS */
666
684
  PaaS = "PaaS"
667
685
  }
668
686
 
@@ -679,8 +697,11 @@ export type ComputeRole = string;
679
697
 
680
698
  /** Known values of {@link OperatingSystem} that the service accepts. */
681
699
  export enum KnownOperatingSystem {
700
+ /** None */
682
701
  None = "None",
702
+ /** Windows */
683
703
  Windows = "Windows",
704
+ /** Linux */
684
705
  Linux = "Linux"
685
706
  }
686
707
 
@@ -697,7 +718,9 @@ export type OperatingSystem = string;
697
718
 
698
719
  /** Known values of {@link Category} that the service accepts. */
699
720
  export enum KnownCategory {
721
+ /** AzureAD */
700
722
  AzureAD = "AzureAD",
723
+ /** Adfs */
701
724
  Adfs = "ADFS"
702
725
  }
703
726
 
@@ -713,6 +736,7 @@ export type Category = string;
713
736
 
714
737
  /** Known values of {@link Location} that the service accepts. */
715
738
  export enum KnownLocation {
739
+ /** Global */
716
740
  Global = "global"
717
741
  }
718
742
 
@@ -6,7 +6,8 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
 
9
- import { PagedAsyncIterableIterator } from "@azure/core-paging";
9
+ import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
10
+ import { setContinuationToken } from "../pagingHelper";
10
11
  import { CustomerSubscriptions } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -57,8 +58,16 @@ export class CustomerSubscriptionsImpl implements CustomerSubscriptions {
57
58
  [Symbol.asyncIterator]() {
58
59
  return this;
59
60
  },
60
- byPage: () => {
61
- return this.listPagingPage(resourceGroup, registrationName, options);
61
+ byPage: (settings?: PageSettings) => {
62
+ if (settings?.maxPageSize) {
63
+ throw new Error("maxPageSize is not supported by this operation.");
64
+ }
65
+ return this.listPagingPage(
66
+ resourceGroup,
67
+ registrationName,
68
+ options,
69
+ settings
70
+ );
62
71
  }
63
72
  };
64
73
  }
@@ -66,11 +75,18 @@ export class CustomerSubscriptionsImpl implements CustomerSubscriptions {
66
75
  private async *listPagingPage(
67
76
  resourceGroup: string,
68
77
  registrationName: string,
69
- options?: CustomerSubscriptionsListOptionalParams
78
+ options?: CustomerSubscriptionsListOptionalParams,
79
+ settings?: PageSettings
70
80
  ): AsyncIterableIterator<CustomerSubscription[]> {
71
- let result = await this._list(resourceGroup, registrationName, options);
72
- yield result.value || [];
73
- let continuationToken = result.nextLink;
81
+ let result: CustomerSubscriptionsListResponse;
82
+ let continuationToken = settings?.continuationToken;
83
+ if (!continuationToken) {
84
+ result = await this._list(resourceGroup, registrationName, options);
85
+ let page = result.value || [];
86
+ continuationToken = result.nextLink;
87
+ setContinuationToken(page, continuationToken);
88
+ yield page;
89
+ }
74
90
  while (continuationToken) {
75
91
  result = await this._listNext(
76
92
  resourceGroup,
@@ -79,7 +95,9 @@ export class CustomerSubscriptionsImpl implements CustomerSubscriptions {
79
95
  options
80
96
  );
81
97
  continuationToken = result.nextLink;
82
- yield result.value || [];
98
+ let page = result.value || [];
99
+ setContinuationToken(page, continuationToken);
100
+ yield page;
83
101
  }
84
102
  }
85
103
 
@@ -6,7 +6,8 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
 
9
- import { PagedAsyncIterableIterator } from "@azure/core-paging";
9
+ import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
10
+ import { setContinuationToken } from "../pagingHelper";
10
11
  import { LinkedSubscriptions } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -16,9 +17,9 @@ import {
16
17
  LinkedSubscription,
17
18
  LinkedSubscriptionsListByResourceGroupNextOptionalParams,
18
19
  LinkedSubscriptionsListByResourceGroupOptionalParams,
20
+ LinkedSubscriptionsListByResourceGroupResponse,
19
21
  LinkedSubscriptionsListBySubscriptionNextOptionalParams,
20
22
  LinkedSubscriptionsListBySubscriptionOptionalParams,
21
- LinkedSubscriptionsListByResourceGroupResponse,
22
23
  LinkedSubscriptionsListBySubscriptionResponse,
23
24
  LinkedSubscriptionsGetOptionalParams,
24
25
  LinkedSubscriptionsGetResponse,
@@ -62,19 +63,33 @@ export class LinkedSubscriptionsImpl implements LinkedSubscriptions {
62
63
  [Symbol.asyncIterator]() {
63
64
  return this;
64
65
  },
65
- byPage: () => {
66
- return this.listByResourceGroupPagingPage(resourceGroup, options);
66
+ byPage: (settings?: PageSettings) => {
67
+ if (settings?.maxPageSize) {
68
+ throw new Error("maxPageSize is not supported by this operation.");
69
+ }
70
+ return this.listByResourceGroupPagingPage(
71
+ resourceGroup,
72
+ options,
73
+ settings
74
+ );
67
75
  }
68
76
  };
69
77
  }
70
78
 
71
79
  private async *listByResourceGroupPagingPage(
72
80
  resourceGroup: string,
73
- options?: LinkedSubscriptionsListByResourceGroupOptionalParams
81
+ options?: LinkedSubscriptionsListByResourceGroupOptionalParams,
82
+ settings?: PageSettings
74
83
  ): AsyncIterableIterator<LinkedSubscription[]> {
75
- let result = await this._listByResourceGroup(resourceGroup, options);
76
- yield result.value || [];
77
- let continuationToken = result.nextLink;
84
+ let result: LinkedSubscriptionsListByResourceGroupResponse;
85
+ let continuationToken = settings?.continuationToken;
86
+ if (!continuationToken) {
87
+ result = await this._listByResourceGroup(resourceGroup, options);
88
+ let page = result.value || [];
89
+ continuationToken = result.nextLink;
90
+ setContinuationToken(page, continuationToken);
91
+ yield page;
92
+ }
78
93
  while (continuationToken) {
79
94
  result = await this._listByResourceGroupNext(
80
95
  resourceGroup,
@@ -82,7 +97,9 @@ export class LinkedSubscriptionsImpl implements LinkedSubscriptions {
82
97
  options
83
98
  );
84
99
  continuationToken = result.nextLink;
85
- yield result.value || [];
100
+ let page = result.value || [];
101
+ setContinuationToken(page, continuationToken);
102
+ yield page;
86
103
  }
87
104
  }
88
105
 
@@ -113,22 +130,34 @@ export class LinkedSubscriptionsImpl implements LinkedSubscriptions {
113
130
  [Symbol.asyncIterator]() {
114
131
  return this;
115
132
  },
116
- byPage: () => {
117
- return this.listBySubscriptionPagingPage(options);
133
+ byPage: (settings?: PageSettings) => {
134
+ if (settings?.maxPageSize) {
135
+ throw new Error("maxPageSize is not supported by this operation.");
136
+ }
137
+ return this.listBySubscriptionPagingPage(options, settings);
118
138
  }
119
139
  };
120
140
  }
121
141
 
122
142
  private async *listBySubscriptionPagingPage(
123
- options?: LinkedSubscriptionsListBySubscriptionOptionalParams
143
+ options?: LinkedSubscriptionsListBySubscriptionOptionalParams,
144
+ settings?: PageSettings
124
145
  ): AsyncIterableIterator<LinkedSubscription[]> {
125
- let result = await this._listBySubscription(options);
126
- yield result.value || [];
127
- let continuationToken = result.nextLink;
146
+ let result: LinkedSubscriptionsListBySubscriptionResponse;
147
+ let continuationToken = settings?.continuationToken;
148
+ if (!continuationToken) {
149
+ result = await this._listBySubscription(options);
150
+ let page = result.value || [];
151
+ continuationToken = result.nextLink;
152
+ setContinuationToken(page, continuationToken);
153
+ yield page;
154
+ }
128
155
  while (continuationToken) {
129
156
  result = await this._listBySubscriptionNext(continuationToken, options);
130
157
  continuationToken = result.nextLink;
131
- yield result.value || [];
158
+ let page = result.value || [];
159
+ setContinuationToken(page, continuationToken);
160
+ yield page;
132
161
  }
133
162
  }
134
163
 
@@ -6,7 +6,8 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
 
9
- import { PagedAsyncIterableIterator } from "@azure/core-paging";
9
+ import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
10
+ import { setContinuationToken } from "../pagingHelper";
10
11
  import { Operations } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -48,22 +49,34 @@ export class OperationsImpl implements Operations {
48
49
  [Symbol.asyncIterator]() {
49
50
  return this;
50
51
  },
51
- byPage: () => {
52
- return this.listPagingPage(options);
52
+ byPage: (settings?: PageSettings) => {
53
+ if (settings?.maxPageSize) {
54
+ throw new Error("maxPageSize is not supported by this operation.");
55
+ }
56
+ return this.listPagingPage(options, settings);
53
57
  }
54
58
  };
55
59
  }
56
60
 
57
61
  private async *listPagingPage(
58
- options?: OperationsListOptionalParams
62
+ options?: OperationsListOptionalParams,
63
+ settings?: PageSettings
59
64
  ): AsyncIterableIterator<Operation[]> {
60
- let result = await this._list(options);
61
- yield result.value || [];
62
- let continuationToken = result.nextLink;
65
+ let result: OperationsListResponse;
66
+ let continuationToken = settings?.continuationToken;
67
+ if (!continuationToken) {
68
+ result = await this._list(options);
69
+ let page = result.value || [];
70
+ continuationToken = result.nextLink;
71
+ setContinuationToken(page, continuationToken);
72
+ yield page;
73
+ }
63
74
  while (continuationToken) {
64
75
  result = await this._listNext(continuationToken, options);
65
76
  continuationToken = result.nextLink;
66
- yield result.value || [];
77
+ let page = result.value || [];
78
+ setContinuationToken(page, continuationToken);
79
+ yield page;
67
80
  }
68
81
  }
69
82
 
@@ -6,7 +6,8 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
 
9
- import { PagedAsyncIterableIterator } from "@azure/core-paging";
9
+ import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
10
+ import { setContinuationToken } from "../pagingHelper";
10
11
  import { Products } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -62,8 +63,16 @@ export class ProductsImpl implements Products {
62
63
  [Symbol.asyncIterator]() {
63
64
  return this;
64
65
  },
65
- byPage: () => {
66
- return this.listPagingPage(resourceGroup, registrationName, options);
66
+ byPage: (settings?: PageSettings) => {
67
+ if (settings?.maxPageSize) {
68
+ throw new Error("maxPageSize is not supported by this operation.");
69
+ }
70
+ return this.listPagingPage(
71
+ resourceGroup,
72
+ registrationName,
73
+ options,
74
+ settings
75
+ );
67
76
  }
68
77
  };
69
78
  }
@@ -71,11 +80,18 @@ export class ProductsImpl implements Products {
71
80
  private async *listPagingPage(
72
81
  resourceGroup: string,
73
82
  registrationName: string,
74
- options?: ProductsListOptionalParams
83
+ options?: ProductsListOptionalParams,
84
+ settings?: PageSettings
75
85
  ): AsyncIterableIterator<Product[]> {
76
- let result = await this._list(resourceGroup, registrationName, options);
77
- yield result.value || [];
78
- let continuationToken = result.nextLink;
86
+ let result: ProductsListResponse;
87
+ let continuationToken = settings?.continuationToken;
88
+ if (!continuationToken) {
89
+ result = await this._list(resourceGroup, registrationName, options);
90
+ let page = result.value || [];
91
+ continuationToken = result.nextLink;
92
+ setContinuationToken(page, continuationToken);
93
+ yield page;
94
+ }
79
95
  while (continuationToken) {
80
96
  result = await this._listNext(
81
97
  resourceGroup,
@@ -84,7 +100,9 @@ export class ProductsImpl implements Products {
84
100
  options
85
101
  );
86
102
  continuationToken = result.nextLink;
87
- yield result.value || [];
103
+ let page = result.value || [];
104
+ setContinuationToken(page, continuationToken);
105
+ yield page;
88
106
  }
89
107
  }
90
108
 
@@ -6,7 +6,8 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
 
9
- import { PagedAsyncIterableIterator } from "@azure/core-paging";
9
+ import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
10
+ import { setContinuationToken } from "../pagingHelper";
10
11
  import { Registrations } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -16,9 +17,9 @@ import {
16
17
  Registration,
17
18
  RegistrationsListNextOptionalParams,
18
19
  RegistrationsListOptionalParams,
20
+ RegistrationsListResponse,
19
21
  RegistrationsListBySubscriptionNextOptionalParams,
20
22
  RegistrationsListBySubscriptionOptionalParams,
21
- RegistrationsListResponse,
22
23
  RegistrationsListBySubscriptionResponse,
23
24
  RegistrationsGetOptionalParams,
24
25
  RegistrationsGetResponse,
@@ -65,23 +66,35 @@ export class RegistrationsImpl implements Registrations {
65
66
  [Symbol.asyncIterator]() {
66
67
  return this;
67
68
  },
68
- byPage: () => {
69
- return this.listPagingPage(resourceGroup, options);
69
+ byPage: (settings?: PageSettings) => {
70
+ if (settings?.maxPageSize) {
71
+ throw new Error("maxPageSize is not supported by this operation.");
72
+ }
73
+ return this.listPagingPage(resourceGroup, options, settings);
70
74
  }
71
75
  };
72
76
  }
73
77
 
74
78
  private async *listPagingPage(
75
79
  resourceGroup: string,
76
- options?: RegistrationsListOptionalParams
80
+ options?: RegistrationsListOptionalParams,
81
+ settings?: PageSettings
77
82
  ): AsyncIterableIterator<Registration[]> {
78
- let result = await this._list(resourceGroup, options);
79
- yield result.value || [];
80
- let continuationToken = result.nextLink;
83
+ let result: RegistrationsListResponse;
84
+ let continuationToken = settings?.continuationToken;
85
+ if (!continuationToken) {
86
+ result = await this._list(resourceGroup, options);
87
+ let page = result.value || [];
88
+ continuationToken = result.nextLink;
89
+ setContinuationToken(page, continuationToken);
90
+ yield page;
91
+ }
81
92
  while (continuationToken) {
82
93
  result = await this._listNext(resourceGroup, continuationToken, options);
83
94
  continuationToken = result.nextLink;
84
- yield result.value || [];
95
+ let page = result.value || [];
96
+ setContinuationToken(page, continuationToken);
97
+ yield page;
85
98
  }
86
99
  }
87
100
 
@@ -109,22 +122,34 @@ export class RegistrationsImpl implements Registrations {
109
122
  [Symbol.asyncIterator]() {
110
123
  return this;
111
124
  },
112
- byPage: () => {
113
- return this.listBySubscriptionPagingPage(options);
125
+ byPage: (settings?: PageSettings) => {
126
+ if (settings?.maxPageSize) {
127
+ throw new Error("maxPageSize is not supported by this operation.");
128
+ }
129
+ return this.listBySubscriptionPagingPage(options, settings);
114
130
  }
115
131
  };
116
132
  }
117
133
 
118
134
  private async *listBySubscriptionPagingPage(
119
- options?: RegistrationsListBySubscriptionOptionalParams
135
+ options?: RegistrationsListBySubscriptionOptionalParams,
136
+ settings?: PageSettings
120
137
  ): AsyncIterableIterator<Registration[]> {
121
- let result = await this._listBySubscription(options);
122
- yield result.value || [];
123
- let continuationToken = result.nextLink;
138
+ let result: RegistrationsListBySubscriptionResponse;
139
+ let continuationToken = settings?.continuationToken;
140
+ if (!continuationToken) {
141
+ result = await this._listBySubscription(options);
142
+ let page = result.value || [];
143
+ continuationToken = result.nextLink;
144
+ setContinuationToken(page, continuationToken);
145
+ yield page;
146
+ }
124
147
  while (continuationToken) {
125
148
  result = await this._listBySubscriptionNext(continuationToken, options);
126
149
  continuationToken = result.nextLink;
127
- yield result.value || [];
150
+ let page = result.value || [];
151
+ setContinuationToken(page, continuationToken);
152
+ yield page;
128
153
  }
129
154
  }
130
155