@azure/arm-mysql 5.0.2-alpha.20221101.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 (110) hide show
  1. package/CHANGELOG.md +28 -10
  2. package/dist/index.js +378 -135
  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/index.d.ts +1 -0
  7. package/dist-esm/src/index.d.ts.map +1 -1
  8. package/dist-esm/src/index.js +1 -0
  9. package/dist-esm/src/index.js.map +1 -1
  10. package/dist-esm/src/models/index.d.ts +93 -45
  11. package/dist-esm/src/models/index.d.ts.map +1 -1
  12. package/dist-esm/src/models/index.js +47 -0
  13. package/dist-esm/src/models/index.js.map +1 -1
  14. package/dist-esm/src/mySQLManagementClient.d.ts.map +1 -1
  15. package/dist-esm/src/mySQLManagementClient.js +20 -18
  16. package/dist-esm/src/mySQLManagementClient.js.map +1 -1
  17. package/dist-esm/src/operations/advisors.d.ts.map +1 -1
  18. package/dist-esm/src/operations/advisors.js +19 -7
  19. package/dist-esm/src/operations/advisors.js.map +1 -1
  20. package/dist-esm/src/operations/configurations.d.ts.map +1 -1
  21. package/dist-esm/src/operations/configurations.js +8 -4
  22. package/dist-esm/src/operations/configurations.js.map +1 -1
  23. package/dist-esm/src/operations/databases.d.ts.map +1 -1
  24. package/dist-esm/src/operations/databases.js +8 -4
  25. package/dist-esm/src/operations/databases.js.map +1 -1
  26. package/dist-esm/src/operations/firewallRules.d.ts.map +1 -1
  27. package/dist-esm/src/operations/firewallRules.js +8 -4
  28. package/dist-esm/src/operations/firewallRules.js.map +1 -1
  29. package/dist-esm/src/operations/locationBasedPerformanceTier.d.ts.map +1 -1
  30. package/dist-esm/src/operations/locationBasedPerformanceTier.js +8 -4
  31. package/dist-esm/src/operations/locationBasedPerformanceTier.js.map +1 -1
  32. package/dist-esm/src/operations/locationBasedRecommendedActionSessionsResult.d.ts.map +1 -1
  33. package/dist-esm/src/operations/locationBasedRecommendedActionSessionsResult.js +19 -7
  34. package/dist-esm/src/operations/locationBasedRecommendedActionSessionsResult.js.map +1 -1
  35. package/dist-esm/src/operations/logFiles.d.ts.map +1 -1
  36. package/dist-esm/src/operations/logFiles.js +8 -4
  37. package/dist-esm/src/operations/logFiles.js.map +1 -1
  38. package/dist-esm/src/operations/privateEndpointConnections.d.ts.map +1 -1
  39. package/dist-esm/src/operations/privateEndpointConnections.js +19 -7
  40. package/dist-esm/src/operations/privateEndpointConnections.js.map +1 -1
  41. package/dist-esm/src/operations/privateLinkResources.d.ts.map +1 -1
  42. package/dist-esm/src/operations/privateLinkResources.js +19 -7
  43. package/dist-esm/src/operations/privateLinkResources.js.map +1 -1
  44. package/dist-esm/src/operations/queryTexts.d.ts.map +1 -1
  45. package/dist-esm/src/operations/queryTexts.js +19 -7
  46. package/dist-esm/src/operations/queryTexts.js.map +1 -1
  47. package/dist-esm/src/operations/recommendedActions.d.ts.map +1 -1
  48. package/dist-esm/src/operations/recommendedActions.js +19 -7
  49. package/dist-esm/src/operations/recommendedActions.js.map +1 -1
  50. package/dist-esm/src/operations/replicas.d.ts.map +1 -1
  51. package/dist-esm/src/operations/replicas.js +8 -4
  52. package/dist-esm/src/operations/replicas.js.map +1 -1
  53. package/dist-esm/src/operations/serverAdministrators.d.ts.map +1 -1
  54. package/dist-esm/src/operations/serverAdministrators.js +8 -4
  55. package/dist-esm/src/operations/serverAdministrators.js.map +1 -1
  56. package/dist-esm/src/operations/serverBasedPerformanceTier.d.ts.map +1 -1
  57. package/dist-esm/src/operations/serverBasedPerformanceTier.js +8 -4
  58. package/dist-esm/src/operations/serverBasedPerformanceTier.js.map +1 -1
  59. package/dist-esm/src/operations/serverKeys.d.ts.map +1 -1
  60. package/dist-esm/src/operations/serverKeys.js +19 -7
  61. package/dist-esm/src/operations/serverKeys.js.map +1 -1
  62. package/dist-esm/src/operations/serverSecurityAlertPolicies.d.ts.map +1 -1
  63. package/dist-esm/src/operations/serverSecurityAlertPolicies.js +19 -7
  64. package/dist-esm/src/operations/serverSecurityAlertPolicies.js.map +1 -1
  65. package/dist-esm/src/operations/servers.d.ts.map +1 -1
  66. package/dist-esm/src/operations/servers.js +16 -8
  67. package/dist-esm/src/operations/servers.js.map +1 -1
  68. package/dist-esm/src/operations/topQueryStatistics.d.ts.map +1 -1
  69. package/dist-esm/src/operations/topQueryStatistics.js +19 -7
  70. package/dist-esm/src/operations/topQueryStatistics.js.map +1 -1
  71. package/dist-esm/src/operations/virtualNetworkRules.d.ts.map +1 -1
  72. package/dist-esm/src/operations/virtualNetworkRules.js +19 -7
  73. package/dist-esm/src/operations/virtualNetworkRules.js.map +1 -1
  74. package/dist-esm/src/operations/waitStatistics.d.ts.map +1 -1
  75. package/dist-esm/src/operations/waitStatistics.js +19 -7
  76. package/dist-esm/src/operations/waitStatistics.js.map +1 -1
  77. package/dist-esm/src/pagingHelper.d.ts +13 -0
  78. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  79. package/dist-esm/src/pagingHelper.js +32 -0
  80. package/dist-esm/src/pagingHelper.js.map +1 -0
  81. package/dist-esm/test/sampleTest.js +11 -13
  82. package/dist-esm/test/sampleTest.js.map +1 -1
  83. package/package.json +13 -9
  84. package/review/arm-mysql.api.md +92 -135
  85. package/src/index.ts +1 -0
  86. package/src/models/index.ts +94 -45
  87. package/src/mySQLManagementClient.ts +26 -20
  88. package/src/operations/advisors.ts +23 -13
  89. package/src/operations/configurations.ts +13 -11
  90. package/src/operations/databases.ts +13 -11
  91. package/src/operations/firewallRules.ts +13 -11
  92. package/src/operations/locationBasedPerformanceTier.ts +10 -5
  93. package/src/operations/locationBasedRecommendedActionSessionsResult.ts +26 -8
  94. package/src/operations/logFiles.ts +11 -9
  95. package/src/operations/privateEndpointConnections.ts +23 -13
  96. package/src/operations/privateLinkResources.ts +22 -12
  97. package/src/operations/queryTexts.ts +28 -14
  98. package/src/operations/recommendedActions.ts +28 -14
  99. package/src/operations/replicas.ts +11 -9
  100. package/src/operations/serverAdministrators.ts +17 -7
  101. package/src/operations/serverBasedPerformanceTier.ts +15 -5
  102. package/src/operations/serverKeys.ts +26 -8
  103. package/src/operations/serverSecurityAlertPolicies.ts +23 -13
  104. package/src/operations/servers.ts +25 -11
  105. package/src/operations/topQueryStatistics.ts +28 -14
  106. package/src/operations/virtualNetworkRules.ts +23 -13
  107. package/src/operations/waitStatistics.ts +28 -14
  108. package/src/pagingHelper.ts +39 -0
  109. package/types/arm-mysql.d.ts +102 -45
  110. package/types/tsdoc-metadata.json +1 -1
@@ -6,7 +6,7 @@
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
10
  import { ServerBasedPerformanceTier } from "../operationsInterfaces";
11
11
  import * as coreClient from "@azure/core-client";
12
12
  import * as Mappers from "../models/mappers";
@@ -51,8 +51,16 @@ export class ServerBasedPerformanceTierImpl
51
51
  [Symbol.asyncIterator]() {
52
52
  return this;
53
53
  },
54
- byPage: () => {
55
- return this.listPagingPage(resourceGroupName, serverName, 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(
59
+ resourceGroupName,
60
+ serverName,
61
+ options,
62
+ settings
63
+ );
56
64
  }
57
65
  };
58
66
  }
@@ -60,9 +68,11 @@ export class ServerBasedPerformanceTierImpl
60
68
  private async *listPagingPage(
61
69
  resourceGroupName: string,
62
70
  serverName: string,
63
- options?: ServerBasedPerformanceTierListOptionalParams
71
+ options?: ServerBasedPerformanceTierListOptionalParams,
72
+ _settings?: PageSettings
64
73
  ): AsyncIterableIterator<PerformanceTierProperties[]> {
65
- let result = await this._list(resourceGroupName, serverName, options);
74
+ let result: ServerBasedPerformanceTierListResponse;
75
+ result = await this._list(resourceGroupName, serverName, options);
66
76
  yield result.value || [];
67
77
  }
68
78
 
@@ -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 { ServerKeys } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -59,8 +60,16 @@ export class ServerKeysImpl implements ServerKeys {
59
60
  [Symbol.asyncIterator]() {
60
61
  return this;
61
62
  },
62
- byPage: () => {
63
- return this.listPagingPage(resourceGroupName, serverName, options);
63
+ byPage: (settings?: PageSettings) => {
64
+ if (settings?.maxPageSize) {
65
+ throw new Error("maxPageSize is not supported by this operation.");
66
+ }
67
+ return this.listPagingPage(
68
+ resourceGroupName,
69
+ serverName,
70
+ options,
71
+ settings
72
+ );
64
73
  }
65
74
  };
66
75
  }
@@ -68,11 +77,18 @@ export class ServerKeysImpl implements ServerKeys {
68
77
  private async *listPagingPage(
69
78
  resourceGroupName: string,
70
79
  serverName: string,
71
- options?: ServerKeysListOptionalParams
80
+ options?: ServerKeysListOptionalParams,
81
+ settings?: PageSettings
72
82
  ): AsyncIterableIterator<ServerKey[]> {
73
- let result = await this._list(resourceGroupName, serverName, options);
74
- yield result.value || [];
75
- let continuationToken = result.nextLink;
83
+ let result: ServerKeysListResponse;
84
+ let continuationToken = settings?.continuationToken;
85
+ if (!continuationToken) {
86
+ result = await this._list(resourceGroupName, serverName, options);
87
+ let page = result.value || [];
88
+ continuationToken = result.nextLink;
89
+ setContinuationToken(page, continuationToken);
90
+ yield page;
91
+ }
76
92
  while (continuationToken) {
77
93
  result = await this._listNext(
78
94
  resourceGroupName,
@@ -81,7 +97,9 @@ export class ServerKeysImpl implements ServerKeys {
81
97
  options
82
98
  );
83
99
  continuationToken = result.nextLink;
84
- yield result.value || [];
100
+ let page = result.value || [];
101
+ setContinuationToken(page, continuationToken);
102
+ yield page;
85
103
  }
86
104
  }
87
105
 
@@ -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 { ServerSecurityAlertPolicies } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -18,12 +19,12 @@ import {
18
19
  ServerSecurityAlertPolicy,
19
20
  ServerSecurityAlertPoliciesListByServerNextOptionalParams,
20
21
  ServerSecurityAlertPoliciesListByServerOptionalParams,
22
+ ServerSecurityAlertPoliciesListByServerResponse,
21
23
  SecurityAlertPolicyName,
22
24
  ServerSecurityAlertPoliciesGetOptionalParams,
23
25
  ServerSecurityAlertPoliciesGetResponse,
24
26
  ServerSecurityAlertPoliciesCreateOrUpdateOptionalParams,
25
27
  ServerSecurityAlertPoliciesCreateOrUpdateResponse,
26
- ServerSecurityAlertPoliciesListByServerResponse,
27
28
  ServerSecurityAlertPoliciesListByServerNextResponse
28
29
  } from "../models";
29
30
 
@@ -64,11 +65,15 @@ export class ServerSecurityAlertPoliciesImpl
64
65
  [Symbol.asyncIterator]() {
65
66
  return this;
66
67
  },
67
- byPage: () => {
68
+ byPage: (settings?: PageSettings) => {
69
+ if (settings?.maxPageSize) {
70
+ throw new Error("maxPageSize is not supported by this operation.");
71
+ }
68
72
  return this.listByServerPagingPage(
69
73
  resourceGroupName,
70
74
  serverName,
71
- options
75
+ options,
76
+ settings
72
77
  );
73
78
  }
74
79
  };
@@ -77,15 +82,18 @@ export class ServerSecurityAlertPoliciesImpl
77
82
  private async *listByServerPagingPage(
78
83
  resourceGroupName: string,
79
84
  serverName: string,
80
- options?: ServerSecurityAlertPoliciesListByServerOptionalParams
85
+ options?: ServerSecurityAlertPoliciesListByServerOptionalParams,
86
+ settings?: PageSettings
81
87
  ): AsyncIterableIterator<ServerSecurityAlertPolicy[]> {
82
- let result = await this._listByServer(
83
- resourceGroupName,
84
- serverName,
85
- options
86
- );
87
- yield result.value || [];
88
- let continuationToken = result.nextLink;
88
+ let result: ServerSecurityAlertPoliciesListByServerResponse;
89
+ let continuationToken = settings?.continuationToken;
90
+ if (!continuationToken) {
91
+ result = await this._listByServer(resourceGroupName, serverName, options);
92
+ let page = result.value || [];
93
+ continuationToken = result.nextLink;
94
+ setContinuationToken(page, continuationToken);
95
+ yield page;
96
+ }
89
97
  while (continuationToken) {
90
98
  result = await this._listByServerNext(
91
99
  resourceGroupName,
@@ -94,7 +102,9 @@ export class ServerSecurityAlertPoliciesImpl
94
102
  options
95
103
  );
96
104
  continuationToken = result.nextLink;
97
- yield result.value || [];
105
+ let page = result.value || [];
106
+ setContinuationToken(page, continuationToken);
107
+ yield page;
98
108
  }
99
109
  }
100
110
 
@@ -6,7 +6,7 @@
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
10
  import { Servers } from "../operationsInterfaces";
11
11
  import * as coreClient from "@azure/core-client";
12
12
  import * as Mappers from "../models/mappers";
@@ -17,7 +17,9 @@ import { LroImpl } from "../lroImpl";
17
17
  import {
18
18
  Server,
19
19
  ServersListByResourceGroupOptionalParams,
20
+ ServersListByResourceGroupResponse,
20
21
  ServersListOptionalParams,
22
+ ServersListResponse,
21
23
  ServerForCreate,
22
24
  ServersCreateOptionalParams,
23
25
  ServersCreateResponse,
@@ -27,8 +29,6 @@ import {
27
29
  ServersDeleteOptionalParams,
28
30
  ServersGetOptionalParams,
29
31
  ServersGetResponse,
30
- ServersListByResourceGroupResponse,
31
- ServersListResponse,
32
32
  ServersRestartOptionalParams,
33
33
  ServersStartOptionalParams,
34
34
  ServersStopOptionalParams,
@@ -66,17 +66,26 @@ export class ServersImpl implements Servers {
66
66
  [Symbol.asyncIterator]() {
67
67
  return this;
68
68
  },
69
- byPage: () => {
70
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
69
+ byPage: (settings?: PageSettings) => {
70
+ if (settings?.maxPageSize) {
71
+ throw new Error("maxPageSize is not supported by this operation.");
72
+ }
73
+ return this.listByResourceGroupPagingPage(
74
+ resourceGroupName,
75
+ options,
76
+ settings
77
+ );
71
78
  }
72
79
  };
73
80
  }
74
81
 
75
82
  private async *listByResourceGroupPagingPage(
76
83
  resourceGroupName: string,
77
- options?: ServersListByResourceGroupOptionalParams
84
+ options?: ServersListByResourceGroupOptionalParams,
85
+ _settings?: PageSettings
78
86
  ): AsyncIterableIterator<Server[]> {
79
- let result = await this._listByResourceGroup(resourceGroupName, options);
87
+ let result: ServersListByResourceGroupResponse;
88
+ result = await this._listByResourceGroup(resourceGroupName, options);
80
89
  yield result.value || [];
81
90
  }
82
91
 
@@ -107,16 +116,21 @@ export class ServersImpl implements Servers {
107
116
  [Symbol.asyncIterator]() {
108
117
  return this;
109
118
  },
110
- byPage: () => {
111
- return this.listPagingPage(options);
119
+ byPage: (settings?: PageSettings) => {
120
+ if (settings?.maxPageSize) {
121
+ throw new Error("maxPageSize is not supported by this operation.");
122
+ }
123
+ return this.listPagingPage(options, settings);
112
124
  }
113
125
  };
114
126
  }
115
127
 
116
128
  private async *listPagingPage(
117
- options?: ServersListOptionalParams
129
+ options?: ServersListOptionalParams,
130
+ _settings?: PageSettings
118
131
  ): AsyncIterableIterator<Server[]> {
119
- let result = await this._list(options);
132
+ let result: ServersListResponse;
133
+ result = await this._list(options);
120
134
  yield result.value || [];
121
135
  }
122
136
 
@@ -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 { TopQueryStatistics } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -17,9 +18,9 @@ import {
17
18
  TopQueryStatisticsInput,
18
19
  TopQueryStatisticsListByServerNextOptionalParams,
19
20
  TopQueryStatisticsListByServerOptionalParams,
21
+ TopQueryStatisticsListByServerResponse,
20
22
  TopQueryStatisticsGetOptionalParams,
21
23
  TopQueryStatisticsGetResponse,
22
- TopQueryStatisticsListByServerResponse,
23
24
  TopQueryStatisticsListByServerNextResponse
24
25
  } from "../models";
25
26
 
@@ -62,12 +63,16 @@ export class TopQueryStatisticsImpl implements TopQueryStatistics {
62
63
  [Symbol.asyncIterator]() {
63
64
  return this;
64
65
  },
65
- byPage: () => {
66
+ byPage: (settings?: PageSettings) => {
67
+ if (settings?.maxPageSize) {
68
+ throw new Error("maxPageSize is not supported by this operation.");
69
+ }
66
70
  return this.listByServerPagingPage(
67
71
  resourceGroupName,
68
72
  serverName,
69
73
  parameters,
70
- options
74
+ options,
75
+ settings
71
76
  );
72
77
  }
73
78
  };
@@ -77,16 +82,23 @@ export class TopQueryStatisticsImpl implements TopQueryStatistics {
77
82
  resourceGroupName: string,
78
83
  serverName: string,
79
84
  parameters: TopQueryStatisticsInput,
80
- options?: TopQueryStatisticsListByServerOptionalParams
85
+ options?: TopQueryStatisticsListByServerOptionalParams,
86
+ settings?: PageSettings
81
87
  ): AsyncIterableIterator<QueryStatistic[]> {
82
- let result = await this._listByServer(
83
- resourceGroupName,
84
- serverName,
85
- parameters,
86
- options
87
- );
88
- yield result.value || [];
89
- let continuationToken = result.nextLink;
88
+ let result: TopQueryStatisticsListByServerResponse;
89
+ let continuationToken = settings?.continuationToken;
90
+ if (!continuationToken) {
91
+ result = await this._listByServer(
92
+ resourceGroupName,
93
+ serverName,
94
+ parameters,
95
+ options
96
+ );
97
+ let page = result.value || [];
98
+ continuationToken = result.nextLink;
99
+ setContinuationToken(page, continuationToken);
100
+ yield page;
101
+ }
90
102
  while (continuationToken) {
91
103
  result = await this._listByServerNext(
92
104
  resourceGroupName,
@@ -96,7 +108,9 @@ export class TopQueryStatisticsImpl implements TopQueryStatistics {
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 { VirtualNetworkRules } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -18,12 +19,12 @@ import {
18
19
  VirtualNetworkRule,
19
20
  VirtualNetworkRulesListByServerNextOptionalParams,
20
21
  VirtualNetworkRulesListByServerOptionalParams,
22
+ VirtualNetworkRulesListByServerResponse,
21
23
  VirtualNetworkRulesGetOptionalParams,
22
24
  VirtualNetworkRulesGetResponse,
23
25
  VirtualNetworkRulesCreateOrUpdateOptionalParams,
24
26
  VirtualNetworkRulesCreateOrUpdateResponse,
25
27
  VirtualNetworkRulesDeleteOptionalParams,
26
- VirtualNetworkRulesListByServerResponse,
27
28
  VirtualNetworkRulesListByServerNextResponse
28
29
  } from "../models";
29
30
 
@@ -63,11 +64,15 @@ export class VirtualNetworkRulesImpl implements VirtualNetworkRules {
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.listByServerPagingPage(
68
72
  resourceGroupName,
69
73
  serverName,
70
- options
74
+ options,
75
+ settings
71
76
  );
72
77
  }
73
78
  };
@@ -76,15 +81,18 @@ export class VirtualNetworkRulesImpl implements VirtualNetworkRules {
76
81
  private async *listByServerPagingPage(
77
82
  resourceGroupName: string,
78
83
  serverName: string,
79
- options?: VirtualNetworkRulesListByServerOptionalParams
84
+ options?: VirtualNetworkRulesListByServerOptionalParams,
85
+ settings?: PageSettings
80
86
  ): AsyncIterableIterator<VirtualNetworkRule[]> {
81
- let result = await this._listByServer(
82
- resourceGroupName,
83
- serverName,
84
- options
85
- );
86
- yield result.value || [];
87
- let continuationToken = result.nextLink;
87
+ let result: VirtualNetworkRulesListByServerResponse;
88
+ let continuationToken = settings?.continuationToken;
89
+ if (!continuationToken) {
90
+ result = await this._listByServer(resourceGroupName, serverName, options);
91
+ let page = result.value || [];
92
+ continuationToken = result.nextLink;
93
+ setContinuationToken(page, continuationToken);
94
+ yield page;
95
+ }
88
96
  while (continuationToken) {
89
97
  result = await this._listByServerNext(
90
98
  resourceGroupName,
@@ -93,7 +101,9 @@ export class VirtualNetworkRulesImpl implements VirtualNetworkRules {
93
101
  options
94
102
  );
95
103
  continuationToken = result.nextLink;
96
- yield result.value || [];
104
+ let page = result.value || [];
105
+ setContinuationToken(page, continuationToken);
106
+ yield page;
97
107
  }
98
108
  }
99
109
 
@@ -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 { WaitStatistics } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -17,9 +18,9 @@ import {
17
18
  WaitStatisticsInput,
18
19
  WaitStatisticsListByServerNextOptionalParams,
19
20
  WaitStatisticsListByServerOptionalParams,
21
+ WaitStatisticsListByServerResponse,
20
22
  WaitStatisticsGetOptionalParams,
21
23
  WaitStatisticsGetResponse,
22
- WaitStatisticsListByServerResponse,
23
24
  WaitStatisticsListByServerNextResponse
24
25
  } from "../models";
25
26
 
@@ -62,12 +63,16 @@ export class WaitStatisticsImpl implements WaitStatistics {
62
63
  [Symbol.asyncIterator]() {
63
64
  return this;
64
65
  },
65
- byPage: () => {
66
+ byPage: (settings?: PageSettings) => {
67
+ if (settings?.maxPageSize) {
68
+ throw new Error("maxPageSize is not supported by this operation.");
69
+ }
66
70
  return this.listByServerPagingPage(
67
71
  resourceGroupName,
68
72
  serverName,
69
73
  parameters,
70
- options
74
+ options,
75
+ settings
71
76
  );
72
77
  }
73
78
  };
@@ -77,16 +82,23 @@ export class WaitStatisticsImpl implements WaitStatistics {
77
82
  resourceGroupName: string,
78
83
  serverName: string,
79
84
  parameters: WaitStatisticsInput,
80
- options?: WaitStatisticsListByServerOptionalParams
85
+ options?: WaitStatisticsListByServerOptionalParams,
86
+ settings?: PageSettings
81
87
  ): AsyncIterableIterator<WaitStatistic[]> {
82
- let result = await this._listByServer(
83
- resourceGroupName,
84
- serverName,
85
- parameters,
86
- options
87
- );
88
- yield result.value || [];
89
- let continuationToken = result.nextLink;
88
+ let result: WaitStatisticsListByServerResponse;
89
+ let continuationToken = settings?.continuationToken;
90
+ if (!continuationToken) {
91
+ result = await this._listByServer(
92
+ resourceGroupName,
93
+ serverName,
94
+ parameters,
95
+ options
96
+ );
97
+ let page = result.value || [];
98
+ continuationToken = result.nextLink;
99
+ setContinuationToken(page, continuationToken);
100
+ yield page;
101
+ }
90
102
  while (continuationToken) {
91
103
  result = await this._listByServerNext(
92
104
  resourceGroupName,
@@ -96,7 +108,9 @@ export class WaitStatisticsImpl implements WaitStatistics {
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
 
@@ -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
+ }