@azure/arm-advisor 3.0.4-alpha.20221026.1 → 3.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 (51) hide show
  1. package/CHANGELOG.md +9 -11
  2. package/dist/index.js +205 -46
  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/advisorManagementClient.d.ts +2 -0
  7. package/dist-esm/src/advisorManagementClient.d.ts.map +1 -1
  8. package/dist-esm/src/advisorManagementClient.js +54 -6
  9. package/dist-esm/src/advisorManagementClient.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 +25 -6
  15. package/dist-esm/src/models/index.d.ts.map +1 -1
  16. package/dist-esm/src/models/index.js +19 -0
  17. package/dist-esm/src/models/index.js.map +1 -1
  18. package/dist-esm/src/operations/configurations.d.ts.map +1 -1
  19. package/dist-esm/src/operations/configurations.js +27 -11
  20. package/dist-esm/src/operations/configurations.js.map +1 -1
  21. package/dist-esm/src/operations/operations.d.ts.map +1 -1
  22. package/dist-esm/src/operations/operations.js +19 -7
  23. package/dist-esm/src/operations/operations.js.map +1 -1
  24. package/dist-esm/src/operations/recommendationMetadata.d.ts.map +1 -1
  25. package/dist-esm/src/operations/recommendationMetadata.js +19 -7
  26. package/dist-esm/src/operations/recommendationMetadata.js.map +1 -1
  27. package/dist-esm/src/operations/recommendations.d.ts.map +1 -1
  28. package/dist-esm/src/operations/recommendations.js +19 -7
  29. package/dist-esm/src/operations/recommendations.js.map +1 -1
  30. package/dist-esm/src/operations/suppressions.d.ts.map +1 -1
  31. package/dist-esm/src/operations/suppressions.js +19 -7
  32. package/dist-esm/src/operations/suppressions.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 +14 -10
  40. package/review/arm-advisor.api.md +28 -44
  41. package/src/advisorManagementClient.ts +69 -6
  42. package/src/index.ts +1 -0
  43. package/src/models/index.ts +25 -6
  44. package/src/operations/configurations.ts +36 -14
  45. package/src/operations/operations.ts +21 -8
  46. package/src/operations/recommendationMetadata.ts +22 -9
  47. package/src/operations/recommendations.ts +22 -9
  48. package/src/operations/suppressions.ts +22 -9
  49. package/src/pagingHelper.ts +39 -0
  50. package/types/arm-advisor.d.ts +36 -6
  51. package/types/tsdoc-metadata.json +1 -1
package/package.json CHANGED
@@ -3,15 +3,15 @@
3
3
  "sdk-type": "mgmt",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "A generated SDK for AdvisorManagementClient.",
6
- "version": "3.0.4-alpha.20221026.1",
6
+ "version": "3.1.0",
7
7
  "engines": {
8
8
  "node": ">=14.0.0"
9
9
  },
10
10
  "dependencies": {
11
11
  "@azure/core-paging": "^1.2.0",
12
- "@azure/core-client": "^1.0.0",
12
+ "@azure/core-client": "^1.6.1",
13
13
  "@azure/core-auth": "^1.3.0",
14
- "@azure/core-rest-pipeline": "^1.1.0",
14
+ "@azure/core-rest-pipeline": "^1.8.0",
15
15
  "tslib": "^2.2.0"
16
16
  },
17
17
  "keywords": [
@@ -34,13 +34,18 @@
34
34
  "mkdirp": "^1.0.4",
35
35
  "rollup": "^2.66.1",
36
36
  "rollup-plugin-sourcemaps": "^0.6.3",
37
- "typescript": "~4.2.0",
37
+ "typescript": "~4.8.0",
38
38
  "uglify-js": "^3.4.9",
39
39
  "rimraf": "^3.0.0",
40
40
  "@azure/identity": "^2.0.1",
41
- "@azure-tools/test-recorder": "^1.0.0",
41
+ "@azure-tools/test-recorder": "^2.0.0",
42
+ "@azure-tools/test-credential": "^1.0.0",
42
43
  "mocha": "^7.1.1",
43
- "cross-env": "^7.0.2"
44
+ "@types/chai": "^4.2.8",
45
+ "chai": "^4.2.0",
46
+ "cross-env": "^7.0.2",
47
+ "@types/node": "^14.0.0",
48
+ "@azure/dev-tool": "^1.0.0"
44
49
  },
45
50
  "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/advisor/arm-advisor",
46
51
  "repository": {
@@ -91,9 +96,8 @@
91
96
  "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node",
92
97
  "unit-test:browser": "echo skipped",
93
98
  "integration-test": "npm run integration-test:node && npm run integration-test:browser",
94
- "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js",
95
- "integration-test:browser": "echo skipped",
96
- "docs": "echo skipped"
99
+ "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'",
100
+ "integration-test:browser": "echo skipped"
97
101
  },
98
102
  "sideEffects": false,
99
103
  "//metadata": {
@@ -113,4 +117,4 @@
113
117
  "disableDocsMs": true,
114
118
  "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-advisor?view=azure-node-preview"
115
119
  }
116
- }
120
+ }
@@ -51,11 +51,11 @@ export interface ARMErrorResponseBody {
51
51
  export type Category = string;
52
52
 
53
53
  // @public
54
- export type ConfigData = Resource & {
54
+ export interface ConfigData extends Resource {
55
+ digests?: DigestConfig[];
55
56
  exclude?: boolean;
56
57
  lowCpuThreshold?: CpuThreshold;
57
- digests?: DigestConfig[];
58
- };
58
+ }
59
59
 
60
60
  // @public
61
61
  export interface ConfigurationListResult {
@@ -125,72 +125,56 @@ export interface DigestConfig {
125
125
  // @public
126
126
  export type DigestConfigState = string;
127
127
 
128
+ // @public
129
+ export function getContinuationToken(page: unknown): string | undefined;
130
+
128
131
  // @public
129
132
  export type Impact = string;
130
133
 
131
134
  // @public
132
135
  export enum KnownCategory {
133
- // (undocumented)
134
136
  Cost = "Cost",
135
- // (undocumented)
136
137
  HighAvailability = "HighAvailability",
137
- // (undocumented)
138
138
  OperationalExcellence = "OperationalExcellence",
139
- // (undocumented)
140
139
  Performance = "Performance",
141
- // (undocumented)
142
140
  Security = "Security"
143
141
  }
144
142
 
145
143
  // @public
146
144
  export enum KnownConfigurationName {
147
- // (undocumented)
148
145
  Default = "default"
149
146
  }
150
147
 
151
148
  // @public
152
149
  export enum KnownCpuThreshold {
153
- // (undocumented)
154
150
  Fifteen = "15",
155
- // (undocumented)
156
151
  Five = "5",
157
- // (undocumented)
158
152
  Ten = "10",
159
- // (undocumented)
160
153
  Twenty = "20"
161
154
  }
162
155
 
163
156
  // @public
164
157
  export enum KnownDigestConfigState {
165
- // (undocumented)
166
158
  Active = "Active",
167
- // (undocumented)
168
159
  Disabled = "Disabled"
169
160
  }
170
161
 
171
162
  // @public
172
163
  export enum KnownImpact {
173
- // (undocumented)
174
164
  High = "High",
175
- // (undocumented)
176
165
  Low = "Low",
177
- // (undocumented)
178
166
  Medium = "Medium"
179
167
  }
180
168
 
181
169
  // @public
182
170
  export enum KnownRisk {
183
- // (undocumented)
184
171
  Error = "Error",
185
- // (undocumented)
186
172
  None = "None",
187
- // (undocumented)
188
173
  Warning = "Warning"
189
174
  }
190
175
 
191
176
  // @public
192
177
  export enum KnownScenario {
193
- // (undocumented)
194
178
  Alerts = "Alerts"
195
179
  }
196
180
 
@@ -354,37 +338,37 @@ export interface ResourceMetadata {
354
338
  }
355
339
 
356
340
  // @public
357
- export type ResourceRecommendationBase = Resource & {
341
+ export interface ResourceRecommendationBase extends Resource {
342
+ actions?: {
343
+ [propertyName: string]: Record<string, unknown>;
344
+ }[];
358
345
  category?: Category;
359
- impact?: Impact;
360
- impactedField?: string;
361
- impactedValue?: string;
362
- lastUpdated?: Date;
363
- metadata?: {
346
+ description?: string;
347
+ exposedMetadataProperties?: {
364
348
  [propertyName: string]: Record<string, unknown>;
365
349
  };
366
- recommendationTypeId?: string;
367
- risk?: Risk;
368
- shortDescription?: ShortDescription;
369
- suppressionIds?: string[];
370
350
  extendedProperties?: {
371
351
  [propertyName: string]: string;
372
352
  };
373
- resourceMetadata?: ResourceMetadata;
374
- description?: string;
353
+ impact?: Impact;
354
+ impactedField?: string;
355
+ impactedValue?: string;
375
356
  label?: string;
357
+ lastUpdated?: Date;
376
358
  learnMoreLink?: string;
377
- potentialBenefits?: string;
378
- actions?: {
379
- [propertyName: string]: Record<string, unknown>;
380
- }[];
381
- remediation?: {
359
+ metadata?: {
382
360
  [propertyName: string]: Record<string, unknown>;
383
361
  };
384
- exposedMetadataProperties?: {
362
+ potentialBenefits?: string;
363
+ recommendationTypeId?: string;
364
+ remediation?: {
385
365
  [propertyName: string]: Record<string, unknown>;
386
366
  };
387
- };
367
+ resourceMetadata?: ResourceMetadata;
368
+ risk?: Risk;
369
+ shortDescription?: ShortDescription;
370
+ suppressionIds?: string[];
371
+ }
388
372
 
389
373
  // @public
390
374
  export interface ResourceRecommendationBaseListResult {
@@ -405,11 +389,11 @@ export interface ShortDescription {
405
389
  }
406
390
 
407
391
  // @public
408
- export type SuppressionContract = Resource & {
392
+ export interface SuppressionContract extends Resource {
393
+ readonly expirationTimeStamp?: Date;
409
394
  suppressionId?: string;
410
395
  ttl?: string;
411
- readonly expirationTimeStamp?: Date;
412
- };
396
+ }
413
397
 
414
398
  // @public
415
399
  export interface SuppressionContractListResult {
@@ -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
  RecommendationMetadataImpl,
@@ -56,26 +62,54 @@ export class AdvisorManagementClient extends coreClient.ServiceClient {
56
62
  credential: credentials
57
63
  };
58
64
 
59
- const packageDetails = `azsdk-js-arm-advisor/3.0.4`;
65
+ const packageDetails = `azsdk-js-arm-advisor/3.1.0`;
60
66
  const userAgentPrefix =
61
67
  options.userAgentOptions && options.userAgentOptions.userAgentPrefix
62
68
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
63
69
  : `${packageDetails}`;
64
70
 
65
- if (!options.credentialScopes) {
66
- options.credentialScopes = ["https://management.azure.com/.default"];
67
- }
68
-
69
71
  const optionsWithDefaults = {
70
72
  ...defaults,
71
73
  ...options,
72
74
  userAgentOptions: {
73
75
  userAgentPrefix
74
76
  },
75
- baseUri:
77
+ endpoint:
76
78
  options.endpoint ?? options.baseUri ?? "https://management.azure.com"
77
79
  };
78
80
  super(optionsWithDefaults);
81
+
82
+ let bearerTokenAuthenticationPolicyFound: boolean = false;
83
+ if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
84
+ const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies();
85
+ bearerTokenAuthenticationPolicyFound = pipelinePolicies.some(
86
+ (pipelinePolicy) =>
87
+ pipelinePolicy.name ===
88
+ coreRestPipeline.bearerTokenAuthenticationPolicyName
89
+ );
90
+ }
91
+ if (
92
+ !options ||
93
+ !options.pipeline ||
94
+ options.pipeline.getOrderedPolicies().length == 0 ||
95
+ !bearerTokenAuthenticationPolicyFound
96
+ ) {
97
+ this.pipeline.removePolicy({
98
+ name: coreRestPipeline.bearerTokenAuthenticationPolicyName
99
+ });
100
+ this.pipeline.addPolicy(
101
+ coreRestPipeline.bearerTokenAuthenticationPolicy({
102
+ credential: credentials,
103
+ scopes:
104
+ optionsWithDefaults.credentialScopes ??
105
+ `${optionsWithDefaults.endpoint}/.default`,
106
+ challengeCallbacks: {
107
+ authorizeRequestOnChallenge:
108
+ coreClient.authorizeRequestOnClaimChallenge
109
+ }
110
+ })
111
+ );
112
+ }
79
113
  // Parameter assignments
80
114
  this.subscriptionId = subscriptionId;
81
115
 
@@ -87,6 +121,35 @@ export class AdvisorManagementClient extends coreClient.ServiceClient {
87
121
  this.recommendations = new RecommendationsImpl(this);
88
122
  this.operations = new OperationsImpl(this);
89
123
  this.suppressions = new SuppressionsImpl(this);
124
+ this.addCustomApiVersionPolicy(options.apiVersion);
125
+ }
126
+
127
+ /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
128
+ private addCustomApiVersionPolicy(apiVersion?: string) {
129
+ if (!apiVersion) {
130
+ return;
131
+ }
132
+ const apiVersionPolicy = {
133
+ name: "CustomApiVersionPolicy",
134
+ async sendRequest(
135
+ request: PipelineRequest,
136
+ next: SendRequest
137
+ ): Promise<PipelineResponse> {
138
+ const param = request.url.split("?");
139
+ if (param.length > 1) {
140
+ const newParams = param[1].split("&").map((item) => {
141
+ if (item.indexOf("api-version") > -1) {
142
+ return "api-version=" + apiVersion;
143
+ } else {
144
+ return item;
145
+ }
146
+ });
147
+ request.url = param[0] + "?" + newParams.join("&");
148
+ }
149
+ return next(request);
150
+ }
151
+ };
152
+ this.pipeline.addPolicy(apiVersionPolicy);
90
153
  }
91
154
 
92
155
  recommendationMetadata: RecommendationMetadata;
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 { AdvisorManagementClient } from "./advisorManagementClient";
12
13
  export * from "./operationsInterfaces";
@@ -165,17 +165,17 @@ export interface SuppressionContractListResult {
165
165
  }
166
166
 
167
167
  /** The Advisor configuration data structure. */
168
- export type ConfigData = Resource & {
168
+ export interface ConfigData extends Resource {
169
169
  /** Exclude the resource from Advisor evaluations. Valid values: False (default) or True. */
170
170
  exclude?: boolean;
171
171
  /** Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 (default), 10, 15 or 20. */
172
172
  lowCpuThreshold?: CpuThreshold;
173
173
  /** Advisor digest configuration. Valid only for subscriptions */
174
174
  digests?: DigestConfig[];
175
- };
175
+ }
176
176
 
177
177
  /** Advisor Recommendation. */
178
- export type ResourceRecommendationBase = Resource & {
178
+ export interface ResourceRecommendationBase extends Resource {
179
179
  /** The category of the recommendation. */
180
180
  category?: Category;
181
181
  /** The business impact of the recommendation. */
@@ -216,10 +216,10 @@ export type ResourceRecommendationBase = Resource & {
216
216
  exposedMetadataProperties?: {
217
217
  [propertyName: string]: Record<string, unknown>;
218
218
  };
219
- };
219
+ }
220
220
 
221
221
  /** The details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with the rule. */
222
- export type SuppressionContract = Resource & {
222
+ export interface SuppressionContract extends Resource {
223
223
  /** The GUID of the suppression. */
224
224
  suppressionId?: string;
225
225
  /** The duration for which the suppression is valid. */
@@ -229,7 +229,7 @@ export type SuppressionContract = Resource & {
229
229
  * NOTE: This property will not be serialized. It can only be populated by the server.
230
230
  */
231
231
  readonly expirationTimeStamp?: Date;
232
- };
232
+ }
233
233
 
234
234
  /** Defines headers for Recommendations_generate operation. */
235
235
  export interface RecommendationsGenerateHeaders {
@@ -241,6 +241,7 @@ export interface RecommendationsGenerateHeaders {
241
241
 
242
242
  /** Known values of {@link Scenario} that the service accepts. */
243
243
  export enum KnownScenario {
244
+ /** Alerts */
244
245
  Alerts = "Alerts"
245
246
  }
246
247
 
@@ -255,9 +256,13 @@ export type Scenario = string;
255
256
 
256
257
  /** Known values of {@link CpuThreshold} that the service accepts. */
257
258
  export enum KnownCpuThreshold {
259
+ /** Five */
258
260
  Five = "5",
261
+ /** Ten */
259
262
  Ten = "10",
263
+ /** Fifteen */
260
264
  Fifteen = "15",
265
+ /** Twenty */
261
266
  Twenty = "20"
262
267
  }
263
268
 
@@ -275,10 +280,15 @@ export type CpuThreshold = string;
275
280
 
276
281
  /** Known values of {@link Category} that the service accepts. */
277
282
  export enum KnownCategory {
283
+ /** HighAvailability */
278
284
  HighAvailability = "HighAvailability",
285
+ /** Security */
279
286
  Security = "Security",
287
+ /** Performance */
280
288
  Performance = "Performance",
289
+ /** Cost */
281
290
  Cost = "Cost",
291
+ /** OperationalExcellence */
282
292
  OperationalExcellence = "OperationalExcellence"
283
293
  }
284
294
 
@@ -297,7 +307,9 @@ export type Category = string;
297
307
 
298
308
  /** Known values of {@link DigestConfigState} that the service accepts. */
299
309
  export enum KnownDigestConfigState {
310
+ /** Active */
300
311
  Active = "Active",
312
+ /** Disabled */
301
313
  Disabled = "Disabled"
302
314
  }
303
315
 
@@ -313,6 +325,7 @@ export type DigestConfigState = string;
313
325
 
314
326
  /** Known values of {@link ConfigurationName} that the service accepts. */
315
327
  export enum KnownConfigurationName {
328
+ /** Default */
316
329
  Default = "default"
317
330
  }
318
331
 
@@ -327,8 +340,11 @@ export type ConfigurationName = string;
327
340
 
328
341
  /** Known values of {@link Impact} that the service accepts. */
329
342
  export enum KnownImpact {
343
+ /** High */
330
344
  High = "High",
345
+ /** Medium */
331
346
  Medium = "Medium",
347
+ /** Low */
332
348
  Low = "Low"
333
349
  }
334
350
 
@@ -345,8 +361,11 @@ export type Impact = string;
345
361
 
346
362
  /** Known values of {@link Risk} that the service accepts. */
347
363
  export enum KnownRisk {
364
+ /** Error */
348
365
  Error = "Error",
366
+ /** Warning */
349
367
  Warning = "Warning",
368
+ /** None */
350
369
  None = "None"
351
370
  }
352
371
 
@@ -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 { Configurations } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -16,12 +17,12 @@ import {
16
17
  ConfigData,
17
18
  ConfigurationsListBySubscriptionNextOptionalParams,
18
19
  ConfigurationsListBySubscriptionOptionalParams,
19
- ConfigurationsListByResourceGroupOptionalParams,
20
20
  ConfigurationsListBySubscriptionResponse,
21
+ ConfigurationsListByResourceGroupOptionalParams,
22
+ ConfigurationsListByResourceGroupResponse,
21
23
  ConfigurationName,
22
24
  ConfigurationsCreateInSubscriptionOptionalParams,
23
25
  ConfigurationsCreateInSubscriptionResponse,
24
- ConfigurationsListByResourceGroupResponse,
25
26
  ConfigurationsCreateInResourceGroupOptionalParams,
26
27
  ConfigurationsCreateInResourceGroupResponse,
27
28
  ConfigurationsListBySubscriptionNextResponse
@@ -55,22 +56,34 @@ export class ConfigurationsImpl implements Configurations {
55
56
  [Symbol.asyncIterator]() {
56
57
  return this;
57
58
  },
58
- byPage: () => {
59
- return this.listBySubscriptionPagingPage(options);
59
+ byPage: (settings?: PageSettings) => {
60
+ if (settings?.maxPageSize) {
61
+ throw new Error("maxPageSize is not supported by this operation.");
62
+ }
63
+ return this.listBySubscriptionPagingPage(options, settings);
60
64
  }
61
65
  };
62
66
  }
63
67
 
64
68
  private async *listBySubscriptionPagingPage(
65
- options?: ConfigurationsListBySubscriptionOptionalParams
69
+ options?: ConfigurationsListBySubscriptionOptionalParams,
70
+ settings?: PageSettings
66
71
  ): AsyncIterableIterator<ConfigData[]> {
67
- let result = await this._listBySubscription(options);
68
- yield result.value || [];
69
- let continuationToken = result.nextLink;
72
+ let result: ConfigurationsListBySubscriptionResponse;
73
+ let continuationToken = settings?.continuationToken;
74
+ if (!continuationToken) {
75
+ result = await this._listBySubscription(options);
76
+ let page = result.value || [];
77
+ continuationToken = result.nextLink;
78
+ setContinuationToken(page, continuationToken);
79
+ yield page;
80
+ }
70
81
  while (continuationToken) {
71
82
  result = await this._listBySubscriptionNext(continuationToken, options);
72
83
  continuationToken = result.nextLink;
73
- yield result.value || [];
84
+ let page = result.value || [];
85
+ setContinuationToken(page, continuationToken);
86
+ yield page;
74
87
  }
75
88
  }
76
89
 
@@ -99,17 +112,26 @@ export class ConfigurationsImpl implements Configurations {
99
112
  [Symbol.asyncIterator]() {
100
113
  return this;
101
114
  },
102
- byPage: () => {
103
- return this.listByResourceGroupPagingPage(resourceGroup, options);
115
+ byPage: (settings?: PageSettings) => {
116
+ if (settings?.maxPageSize) {
117
+ throw new Error("maxPageSize is not supported by this operation.");
118
+ }
119
+ return this.listByResourceGroupPagingPage(
120
+ resourceGroup,
121
+ options,
122
+ settings
123
+ );
104
124
  }
105
125
  };
106
126
  }
107
127
 
108
128
  private async *listByResourceGroupPagingPage(
109
129
  resourceGroup: string,
110
- options?: ConfigurationsListByResourceGroupOptionalParams
130
+ options?: ConfigurationsListByResourceGroupOptionalParams,
131
+ _settings?: PageSettings
111
132
  ): AsyncIterableIterator<ConfigData[]> {
112
- let result = await this._listByResourceGroup(resourceGroup, options);
133
+ let result: ConfigurationsListByResourceGroupResponse;
134
+ result = await this._listByResourceGroup(resourceGroup, options);
113
135
  yield result.value || [];
114
136
  }
115
137
 
@@ -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<OperationEntity[]> {
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 { RecommendationMetadata } 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
  MetadataEntity,
17
18
  RecommendationMetadataListNextOptionalParams,
18
19
  RecommendationMetadataListOptionalParams,
20
+ RecommendationMetadataListResponse,
19
21
  RecommendationMetadataGetOptionalParams,
20
22
  RecommendationMetadataGetResponse,
21
- RecommendationMetadataListResponse,
22
23
  RecommendationMetadataListNextResponse
23
24
  } from "../models";
24
25
 
@@ -50,22 +51,34 @@ export class RecommendationMetadataImpl implements RecommendationMetadata {
50
51
  [Symbol.asyncIterator]() {
51
52
  return this;
52
53
  },
53
- byPage: () => {
54
- return this.listPagingPage(options);
54
+ byPage: (settings?: PageSettings) => {
55
+ if (settings?.maxPageSize) {
56
+ throw new Error("maxPageSize is not supported by this operation.");
57
+ }
58
+ return this.listPagingPage(options, settings);
55
59
  }
56
60
  };
57
61
  }
58
62
 
59
63
  private async *listPagingPage(
60
- options?: RecommendationMetadataListOptionalParams
64
+ options?: RecommendationMetadataListOptionalParams,
65
+ settings?: PageSettings
61
66
  ): AsyncIterableIterator<MetadataEntity[]> {
62
- let result = await this._list(options);
63
- yield result.value || [];
64
- let continuationToken = result.nextLink;
67
+ let result: RecommendationMetadataListResponse;
68
+ let continuationToken = settings?.continuationToken;
69
+ if (!continuationToken) {
70
+ result = await this._list(options);
71
+ let page = result.value || [];
72
+ continuationToken = result.nextLink;
73
+ setContinuationToken(page, continuationToken);
74
+ yield page;
75
+ }
65
76
  while (continuationToken) {
66
77
  result = await this._listNext(continuationToken, options);
67
78
  continuationToken = result.nextLink;
68
- yield result.value || [];
79
+ let page = result.value || [];
80
+ setContinuationToken(page, continuationToken);
81
+ yield page;
69
82
  }
70
83
  }
71
84