@azure/arm-frontdoor 5.0.2-alpha.20221128.1 → 5.1.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 (61) hide show
  1. package/CHANGELOG.md +27 -10
  2. package/dist/index.js +424 -88
  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/frontDoorManagementClient.d.ts.map +1 -1
  7. package/dist-esm/src/frontDoorManagementClient.js +20 -18
  8. package/dist-esm/src/frontDoorManagementClient.js.map +1 -1
  9. package/dist-esm/src/index.d.ts +1 -0
  10. package/dist-esm/src/index.d.ts.map +1 -1
  11. package/dist-esm/src/index.js +1 -0
  12. package/dist-esm/src/index.js.map +1 -1
  13. package/dist-esm/src/models/index.d.ts +235 -44
  14. package/dist-esm/src/models/index.d.ts.map +1 -1
  15. package/dist-esm/src/models/index.js +191 -0
  16. package/dist-esm/src/models/index.js.map +1 -1
  17. package/dist-esm/src/operations/experiments.d.ts.map +1 -1
  18. package/dist-esm/src/operations/experiments.js +19 -7
  19. package/dist-esm/src/operations/experiments.js.map +1 -1
  20. package/dist-esm/src/operations/frontDoors.d.ts.map +1 -1
  21. package/dist-esm/src/operations/frontDoors.js +37 -14
  22. package/dist-esm/src/operations/frontDoors.js.map +1 -1
  23. package/dist-esm/src/operations/frontendEndpoints.d.ts.map +1 -1
  24. package/dist-esm/src/operations/frontendEndpoints.js +19 -7
  25. package/dist-esm/src/operations/frontendEndpoints.js.map +1 -1
  26. package/dist-esm/src/operations/managedRuleSets.d.ts.map +1 -1
  27. package/dist-esm/src/operations/managedRuleSets.js +19 -7
  28. package/dist-esm/src/operations/managedRuleSets.js.map +1 -1
  29. package/dist-esm/src/operations/networkExperimentProfiles.d.ts.map +1 -1
  30. package/dist-esm/src/operations/networkExperimentProfiles.js +37 -14
  31. package/dist-esm/src/operations/networkExperimentProfiles.js.map +1 -1
  32. package/dist-esm/src/operations/policies.d.ts.map +1 -1
  33. package/dist-esm/src/operations/policies.js +19 -7
  34. package/dist-esm/src/operations/policies.js.map +1 -1
  35. package/dist-esm/src/operations/preconfiguredEndpoints.d.ts.map +1 -1
  36. package/dist-esm/src/operations/preconfiguredEndpoints.js +19 -7
  37. package/dist-esm/src/operations/preconfiguredEndpoints.js.map +1 -1
  38. package/dist-esm/src/operations/rulesEngines.d.ts.map +1 -1
  39. package/dist-esm/src/operations/rulesEngines.js +19 -7
  40. package/dist-esm/src/operations/rulesEngines.js.map +1 -1
  41. package/dist-esm/src/pagingHelper.d.ts +13 -0
  42. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  43. package/dist-esm/src/pagingHelper.js +32 -0
  44. package/dist-esm/src/pagingHelper.js.map +1 -0
  45. package/dist-esm/test/sampleTest.js +11 -13
  46. package/dist-esm/test/sampleTest.js.map +1 -1
  47. package/package.json +13 -9
  48. package/review/arm-frontdoor.api.md +107 -295
  49. package/src/frontDoorManagementClient.ts +26 -20
  50. package/src/index.ts +1 -0
  51. package/src/models/index.ts +238 -44
  52. package/src/operations/experiments.ts +26 -12
  53. package/src/operations/frontDoors.ts +45 -16
  54. package/src/operations/frontendEndpoints.ts +26 -12
  55. package/src/operations/managedRuleSets.ts +21 -8
  56. package/src/operations/networkExperimentProfiles.ts +45 -16
  57. package/src/operations/policies.ts +21 -8
  58. package/src/operations/preconfiguredEndpoints.ts +26 -8
  59. package/src/operations/rulesEngines.ts +26 -12
  60. package/src/pagingHelper.ts +39 -0
  61. package/types/arm-frontdoor.d.ts +244 -44
@@ -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 { Experiments } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -66,11 +67,15 @@ export class ExperimentsImpl implements Experiments {
66
67
  [Symbol.asyncIterator]() {
67
68
  return this;
68
69
  },
69
- byPage: () => {
70
+ byPage: (settings?: PageSettings) => {
71
+ if (settings?.maxPageSize) {
72
+ throw new Error("maxPageSize is not supported by this operation.");
73
+ }
70
74
  return this.listByProfilePagingPage(
71
75
  resourceGroupName,
72
76
  profileName,
73
- options
77
+ options,
78
+ settings
74
79
  );
75
80
  }
76
81
  };
@@ -79,15 +84,22 @@ export class ExperimentsImpl implements Experiments {
79
84
  private async *listByProfilePagingPage(
80
85
  resourceGroupName: string,
81
86
  profileName: string,
82
- options?: ExperimentsListByProfileOptionalParams
87
+ options?: ExperimentsListByProfileOptionalParams,
88
+ settings?: PageSettings
83
89
  ): AsyncIterableIterator<Experiment[]> {
84
- let result = await this._listByProfile(
85
- resourceGroupName,
86
- profileName,
87
- options
88
- );
89
- yield result.value || [];
90
- let continuationToken = result.nextLink;
90
+ let result: ExperimentsListByProfileResponse;
91
+ let continuationToken = settings?.continuationToken;
92
+ if (!continuationToken) {
93
+ result = await this._listByProfile(
94
+ resourceGroupName,
95
+ profileName,
96
+ options
97
+ );
98
+ let page = result.value || [];
99
+ continuationToken = result.nextLink;
100
+ setContinuationToken(page, continuationToken);
101
+ yield page;
102
+ }
91
103
  while (continuationToken) {
92
104
  result = await this._listByProfileNext(
93
105
  resourceGroupName,
@@ -96,7 +108,9 @@ export class ExperimentsImpl implements Experiments {
96
108
  options
97
109
  );
98
110
  continuationToken = result.nextLink;
99
- yield result.value || [];
111
+ let page = result.value || [];
112
+ setContinuationToken(page, continuationToken);
113
+ yield page;
100
114
  }
101
115
  }
102
116
 
@@ -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 { FrontDoors } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -18,9 +19,9 @@ import {
18
19
  FrontDoor,
19
20
  FrontDoorsListNextOptionalParams,
20
21
  FrontDoorsListOptionalParams,
22
+ FrontDoorsListResponse,
21
23
  FrontDoorsListByResourceGroupNextOptionalParams,
22
24
  FrontDoorsListByResourceGroupOptionalParams,
23
- FrontDoorsListResponse,
24
25
  FrontDoorsListByResourceGroupResponse,
25
26
  FrontDoorsGetOptionalParams,
26
27
  FrontDoorsGetResponse,
@@ -62,22 +63,34 @@ export class FrontDoorsImpl implements FrontDoors {
62
63
  [Symbol.asyncIterator]() {
63
64
  return this;
64
65
  },
65
- byPage: () => {
66
- return this.listPagingPage(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(options, settings);
67
71
  }
68
72
  };
69
73
  }
70
74
 
71
75
  private async *listPagingPage(
72
- options?: FrontDoorsListOptionalParams
76
+ options?: FrontDoorsListOptionalParams,
77
+ settings?: PageSettings
73
78
  ): AsyncIterableIterator<FrontDoor[]> {
74
- let result = await this._list(options);
75
- yield result.value || [];
76
- let continuationToken = result.nextLink;
79
+ let result: FrontDoorsListResponse;
80
+ let continuationToken = settings?.continuationToken;
81
+ if (!continuationToken) {
82
+ result = await this._list(options);
83
+ let page = result.value || [];
84
+ continuationToken = result.nextLink;
85
+ setContinuationToken(page, continuationToken);
86
+ yield page;
87
+ }
77
88
  while (continuationToken) {
78
89
  result = await this._listNext(continuationToken, options);
79
90
  continuationToken = result.nextLink;
80
- yield result.value || [];
91
+ let page = result.value || [];
92
+ setContinuationToken(page, continuationToken);
93
+ yield page;
81
94
  }
82
95
  }
83
96
 
@@ -106,19 +119,33 @@ export class FrontDoorsImpl implements FrontDoors {
106
119
  [Symbol.asyncIterator]() {
107
120
  return this;
108
121
  },
109
- byPage: () => {
110
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
122
+ byPage: (settings?: PageSettings) => {
123
+ if (settings?.maxPageSize) {
124
+ throw new Error("maxPageSize is not supported by this operation.");
125
+ }
126
+ return this.listByResourceGroupPagingPage(
127
+ resourceGroupName,
128
+ options,
129
+ settings
130
+ );
111
131
  }
112
132
  };
113
133
  }
114
134
 
115
135
  private async *listByResourceGroupPagingPage(
116
136
  resourceGroupName: string,
117
- options?: FrontDoorsListByResourceGroupOptionalParams
137
+ options?: FrontDoorsListByResourceGroupOptionalParams,
138
+ settings?: PageSettings
118
139
  ): AsyncIterableIterator<FrontDoor[]> {
119
- let result = await this._listByResourceGroup(resourceGroupName, options);
120
- yield result.value || [];
121
- let continuationToken = result.nextLink;
140
+ let result: FrontDoorsListByResourceGroupResponse;
141
+ let continuationToken = settings?.continuationToken;
142
+ if (!continuationToken) {
143
+ result = await this._listByResourceGroup(resourceGroupName, options);
144
+ let page = result.value || [];
145
+ continuationToken = result.nextLink;
146
+ setContinuationToken(page, continuationToken);
147
+ yield page;
148
+ }
122
149
  while (continuationToken) {
123
150
  result = await this._listByResourceGroupNext(
124
151
  resourceGroupName,
@@ -126,7 +153,9 @@ export class FrontDoorsImpl implements FrontDoors {
126
153
  options
127
154
  );
128
155
  continuationToken = result.nextLink;
129
- yield result.value || [];
156
+ let page = result.value || [];
157
+ setContinuationToken(page, continuationToken);
158
+ yield page;
130
159
  }
131
160
  }
132
161
 
@@ -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 { FrontendEndpoints } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -63,11 +64,15 @@ export class FrontendEndpointsImpl implements FrontendEndpoints {
63
64
  [Symbol.asyncIterator]() {
64
65
  return this;
65
66
  },
66
- byPage: () => {
67
+ byPage: (settings?: PageSettings) => {
68
+ if (settings?.maxPageSize) {
69
+ throw new Error("maxPageSize is not supported by this operation.");
70
+ }
67
71
  return this.listByFrontDoorPagingPage(
68
72
  resourceGroupName,
69
73
  frontDoorName,
70
- options
74
+ options,
75
+ settings
71
76
  );
72
77
  }
73
78
  };
@@ -76,15 +81,22 @@ export class FrontendEndpointsImpl implements FrontendEndpoints {
76
81
  private async *listByFrontDoorPagingPage(
77
82
  resourceGroupName: string,
78
83
  frontDoorName: string,
79
- options?: FrontendEndpointsListByFrontDoorOptionalParams
84
+ options?: FrontendEndpointsListByFrontDoorOptionalParams,
85
+ settings?: PageSettings
80
86
  ): AsyncIterableIterator<FrontendEndpoint[]> {
81
- let result = await this._listByFrontDoor(
82
- resourceGroupName,
83
- frontDoorName,
84
- options
85
- );
86
- yield result.value || [];
87
- let continuationToken = result.nextLink;
87
+ let result: FrontendEndpointsListByFrontDoorResponse;
88
+ let continuationToken = settings?.continuationToken;
89
+ if (!continuationToken) {
90
+ result = await this._listByFrontDoor(
91
+ resourceGroupName,
92
+ frontDoorName,
93
+ options
94
+ );
95
+ let page = result.value || [];
96
+ continuationToken = result.nextLink;
97
+ setContinuationToken(page, continuationToken);
98
+ yield page;
99
+ }
88
100
  while (continuationToken) {
89
101
  result = await this._listByFrontDoorNext(
90
102
  resourceGroupName,
@@ -93,7 +105,9 @@ export class FrontendEndpointsImpl implements FrontendEndpoints {
93
105
  options
94
106
  );
95
107
  continuationToken = result.nextLink;
96
- yield result.value || [];
108
+ let page = result.value || [];
109
+ setContinuationToken(page, continuationToken);
110
+ yield page;
97
111
  }
98
112
  }
99
113
 
@@ -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 { ManagedRuleSets } 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 ManagedRuleSetsImpl implements ManagedRuleSets {
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?: ManagedRuleSetsListOptionalParams
62
+ options?: ManagedRuleSetsListOptionalParams,
63
+ settings?: PageSettings
59
64
  ): AsyncIterableIterator<ManagedRuleSetDefinition[]> {
60
- let result = await this._list(options);
61
- yield result.value || [];
62
- let continuationToken = result.nextLink;
65
+ let result: ManagedRuleSetsListResponse;
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 { NetworkExperimentProfiles } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -18,9 +19,9 @@ import {
18
19
  Profile,
19
20
  NetworkExperimentProfilesListNextOptionalParams,
20
21
  NetworkExperimentProfilesListOptionalParams,
22
+ NetworkExperimentProfilesListResponse,
21
23
  NetworkExperimentProfilesListByResourceGroupNextOptionalParams,
22
24
  NetworkExperimentProfilesListByResourceGroupOptionalParams,
23
- NetworkExperimentProfilesListResponse,
24
25
  NetworkExperimentProfilesListByResourceGroupResponse,
25
26
  NetworkExperimentProfilesGetOptionalParams,
26
27
  NetworkExperimentProfilesGetResponse,
@@ -63,22 +64,34 @@ export class NetworkExperimentProfilesImpl
63
64
  [Symbol.asyncIterator]() {
64
65
  return this;
65
66
  },
66
- byPage: () => {
67
- return this.listPagingPage(options);
67
+ byPage: (settings?: PageSettings) => {
68
+ if (settings?.maxPageSize) {
69
+ throw new Error("maxPageSize is not supported by this operation.");
70
+ }
71
+ return this.listPagingPage(options, settings);
68
72
  }
69
73
  };
70
74
  }
71
75
 
72
76
  private async *listPagingPage(
73
- options?: NetworkExperimentProfilesListOptionalParams
77
+ options?: NetworkExperimentProfilesListOptionalParams,
78
+ settings?: PageSettings
74
79
  ): AsyncIterableIterator<Profile[]> {
75
- let result = await this._list(options);
76
- yield result.value || [];
77
- let continuationToken = result.nextLink;
80
+ let result: NetworkExperimentProfilesListResponse;
81
+ let continuationToken = settings?.continuationToken;
82
+ if (!continuationToken) {
83
+ result = await this._list(options);
84
+ let page = result.value || [];
85
+ continuationToken = result.nextLink;
86
+ setContinuationToken(page, continuationToken);
87
+ yield page;
88
+ }
78
89
  while (continuationToken) {
79
90
  result = await this._listNext(continuationToken, options);
80
91
  continuationToken = result.nextLink;
81
- yield result.value || [];
92
+ let page = result.value || [];
93
+ setContinuationToken(page, continuationToken);
94
+ yield page;
82
95
  }
83
96
  }
84
97
 
@@ -107,19 +120,33 @@ export class NetworkExperimentProfilesImpl
107
120
  [Symbol.asyncIterator]() {
108
121
  return this;
109
122
  },
110
- byPage: () => {
111
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
123
+ byPage: (settings?: PageSettings) => {
124
+ if (settings?.maxPageSize) {
125
+ throw new Error("maxPageSize is not supported by this operation.");
126
+ }
127
+ return this.listByResourceGroupPagingPage(
128
+ resourceGroupName,
129
+ options,
130
+ settings
131
+ );
112
132
  }
113
133
  };
114
134
  }
115
135
 
116
136
  private async *listByResourceGroupPagingPage(
117
137
  resourceGroupName: string,
118
- options?: NetworkExperimentProfilesListByResourceGroupOptionalParams
138
+ options?: NetworkExperimentProfilesListByResourceGroupOptionalParams,
139
+ settings?: PageSettings
119
140
  ): AsyncIterableIterator<Profile[]> {
120
- let result = await this._listByResourceGroup(resourceGroupName, options);
121
- yield result.value || [];
122
- let continuationToken = result.nextLink;
141
+ let result: NetworkExperimentProfilesListByResourceGroupResponse;
142
+ let continuationToken = settings?.continuationToken;
143
+ if (!continuationToken) {
144
+ result = await this._listByResourceGroup(resourceGroupName, options);
145
+ let page = result.value || [];
146
+ continuationToken = result.nextLink;
147
+ setContinuationToken(page, continuationToken);
148
+ yield page;
149
+ }
123
150
  while (continuationToken) {
124
151
  result = await this._listByResourceGroupNext(
125
152
  resourceGroupName,
@@ -127,7 +154,9 @@ export class NetworkExperimentProfilesImpl
127
154
  options
128
155
  );
129
156
  continuationToken = result.nextLink;
130
- yield result.value || [];
157
+ let page = result.value || [];
158
+ setContinuationToken(page, continuationToken);
159
+ yield page;
131
160
  }
132
161
  }
133
162
 
@@ -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 { Policies } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -57,19 +58,29 @@ export class PoliciesImpl implements Policies {
57
58
  [Symbol.asyncIterator]() {
58
59
  return this;
59
60
  },
60
- byPage: () => {
61
- return this.listPagingPage(resourceGroupName, 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(resourceGroupName, options, settings);
62
66
  }
63
67
  };
64
68
  }
65
69
 
66
70
  private async *listPagingPage(
67
71
  resourceGroupName: string,
68
- options?: PoliciesListOptionalParams
72
+ options?: PoliciesListOptionalParams,
73
+ settings?: PageSettings
69
74
  ): AsyncIterableIterator<WebApplicationFirewallPolicy[]> {
70
- let result = await this._list(resourceGroupName, options);
71
- yield result.value || [];
72
- let continuationToken = result.nextLink;
75
+ let result: PoliciesListResponse;
76
+ let continuationToken = settings?.continuationToken;
77
+ if (!continuationToken) {
78
+ result = await this._list(resourceGroupName, options);
79
+ let page = result.value || [];
80
+ continuationToken = result.nextLink;
81
+ setContinuationToken(page, continuationToken);
82
+ yield page;
83
+ }
73
84
  while (continuationToken) {
74
85
  result = await this._listNext(
75
86
  resourceGroupName,
@@ -77,7 +88,9 @@ export class PoliciesImpl implements Policies {
77
88
  options
78
89
  );
79
90
  continuationToken = result.nextLink;
80
- yield result.value || [];
91
+ let page = result.value || [];
92
+ setContinuationToken(page, continuationToken);
93
+ yield page;
81
94
  }
82
95
  }
83
96
 
@@ -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 { PreconfiguredEndpoints } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -52,8 +53,16 @@ export class PreconfiguredEndpointsImpl implements PreconfiguredEndpoints {
52
53
  [Symbol.asyncIterator]() {
53
54
  return this;
54
55
  },
55
- byPage: () => {
56
- return this.listPagingPage(resourceGroupName, profileName, options);
56
+ byPage: (settings?: PageSettings) => {
57
+ if (settings?.maxPageSize) {
58
+ throw new Error("maxPageSize is not supported by this operation.");
59
+ }
60
+ return this.listPagingPage(
61
+ resourceGroupName,
62
+ profileName,
63
+ options,
64
+ settings
65
+ );
57
66
  }
58
67
  };
59
68
  }
@@ -61,11 +70,18 @@ export class PreconfiguredEndpointsImpl implements PreconfiguredEndpoints {
61
70
  private async *listPagingPage(
62
71
  resourceGroupName: string,
63
72
  profileName: string,
64
- options?: PreconfiguredEndpointsListOptionalParams
73
+ options?: PreconfiguredEndpointsListOptionalParams,
74
+ settings?: PageSettings
65
75
  ): AsyncIterableIterator<PreconfiguredEndpoint[]> {
66
- let result = await this._list(resourceGroupName, profileName, options);
67
- yield result.value || [];
68
- let continuationToken = result.nextLink;
76
+ let result: PreconfiguredEndpointsListResponse;
77
+ let continuationToken = settings?.continuationToken;
78
+ if (!continuationToken) {
79
+ result = await this._list(resourceGroupName, profileName, options);
80
+ let page = result.value || [];
81
+ continuationToken = result.nextLink;
82
+ setContinuationToken(page, continuationToken);
83
+ yield page;
84
+ }
69
85
  while (continuationToken) {
70
86
  result = await this._listNext(
71
87
  resourceGroupName,
@@ -74,7 +90,9 @@ export class PreconfiguredEndpointsImpl implements PreconfiguredEndpoints {
74
90
  options
75
91
  );
76
92
  continuationToken = result.nextLink;
77
- yield result.value || [];
93
+ let page = result.value || [];
94
+ setContinuationToken(page, continuationToken);
95
+ yield page;
78
96
  }
79
97
  }
80
98
 
@@ -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 { RulesEngines } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -63,11 +64,15 @@ export class RulesEnginesImpl implements RulesEngines {
63
64
  [Symbol.asyncIterator]() {
64
65
  return this;
65
66
  },
66
- byPage: () => {
67
+ byPage: (settings?: PageSettings) => {
68
+ if (settings?.maxPageSize) {
69
+ throw new Error("maxPageSize is not supported by this operation.");
70
+ }
67
71
  return this.listByFrontDoorPagingPage(
68
72
  resourceGroupName,
69
73
  frontDoorName,
70
- options
74
+ options,
75
+ settings
71
76
  );
72
77
  }
73
78
  };
@@ -76,15 +81,22 @@ export class RulesEnginesImpl implements RulesEngines {
76
81
  private async *listByFrontDoorPagingPage(
77
82
  resourceGroupName: string,
78
83
  frontDoorName: string,
79
- options?: RulesEnginesListByFrontDoorOptionalParams
84
+ options?: RulesEnginesListByFrontDoorOptionalParams,
85
+ settings?: PageSettings
80
86
  ): AsyncIterableIterator<RulesEngine[]> {
81
- let result = await this._listByFrontDoor(
82
- resourceGroupName,
83
- frontDoorName,
84
- options
85
- );
86
- yield result.value || [];
87
- let continuationToken = result.nextLink;
87
+ let result: RulesEnginesListByFrontDoorResponse;
88
+ let continuationToken = settings?.continuationToken;
89
+ if (!continuationToken) {
90
+ result = await this._listByFrontDoor(
91
+ resourceGroupName,
92
+ frontDoorName,
93
+ options
94
+ );
95
+ let page = result.value || [];
96
+ continuationToken = result.nextLink;
97
+ setContinuationToken(page, continuationToken);
98
+ yield page;
99
+ }
88
100
  while (continuationToken) {
89
101
  result = await this._listByFrontDoorNext(
90
102
  resourceGroupName,
@@ -93,7 +105,9 @@ export class RulesEnginesImpl implements RulesEngines {
93
105
  options
94
106
  );
95
107
  continuationToken = result.nextLink;
96
- yield result.value || [];
108
+ let page = result.value || [];
109
+ setContinuationToken(page, continuationToken);
110
+ yield page;
97
111
  }
98
112
  }
99
113
 
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * Code generated by Microsoft (R) AutoRest Code Generator.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ */
8
+
9
+ export interface PageInfo {
10
+ continuationToken?: string;
11
+ }
12
+
13
+ const pageMap = new WeakMap<object, PageInfo>();
14
+
15
+ /**
16
+ * Given a result page from a pageable operation, returns a
17
+ * continuation token that can be used to begin paging from
18
+ * that point later.
19
+ * @param page A result object from calling .byPage() on a paged operation.
20
+ * @returns The continuation token that can be passed into byPage().
21
+ */
22
+ export function getContinuationToken(page: unknown): string | undefined {
23
+ if (typeof page !== "object" || page === null) {
24
+ return undefined;
25
+ }
26
+ return pageMap.get(page)?.continuationToken;
27
+ }
28
+
29
+ export function setContinuationToken(
30
+ page: unknown,
31
+ continuationToken: string | undefined
32
+ ): void {
33
+ if (typeof page !== "object" || page === null || !continuationToken) {
34
+ return;
35
+ }
36
+ const pageInfo = pageMap.get(page) ?? {};
37
+ pageInfo.continuationToken = continuationToken;
38
+ pageMap.set(page, pageInfo);
39
+ }