@azure/arm-postgresql 6.0.2-alpha.20221102.1 → 6.1.0-alpha.20221202.2

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 (86) hide show
  1. package/CHANGELOG.md +24 -11
  2. package/dist/index.js +271 -93
  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 +84 -35
  11. package/dist-esm/src/models/index.d.ts.map +1 -1
  12. package/dist-esm/src/models/index.js +48 -0
  13. package/dist-esm/src/models/index.js.map +1 -1
  14. package/dist-esm/src/operations/configurations.d.ts.map +1 -1
  15. package/dist-esm/src/operations/configurations.js +8 -4
  16. package/dist-esm/src/operations/configurations.js.map +1 -1
  17. package/dist-esm/src/operations/databases.d.ts.map +1 -1
  18. package/dist-esm/src/operations/databases.js +8 -4
  19. package/dist-esm/src/operations/databases.js.map +1 -1
  20. package/dist-esm/src/operations/firewallRules.d.ts.map +1 -1
  21. package/dist-esm/src/operations/firewallRules.js +8 -4
  22. package/dist-esm/src/operations/firewallRules.js.map +1 -1
  23. package/dist-esm/src/operations/locationBasedPerformanceTier.d.ts.map +1 -1
  24. package/dist-esm/src/operations/locationBasedPerformanceTier.js +8 -4
  25. package/dist-esm/src/operations/locationBasedPerformanceTier.js.map +1 -1
  26. package/dist-esm/src/operations/logFiles.d.ts.map +1 -1
  27. package/dist-esm/src/operations/logFiles.js +8 -4
  28. package/dist-esm/src/operations/logFiles.js.map +1 -1
  29. package/dist-esm/src/operations/privateEndpointConnections.d.ts.map +1 -1
  30. package/dist-esm/src/operations/privateEndpointConnections.js +19 -7
  31. package/dist-esm/src/operations/privateEndpointConnections.js.map +1 -1
  32. package/dist-esm/src/operations/privateLinkResources.d.ts.map +1 -1
  33. package/dist-esm/src/operations/privateLinkResources.js +19 -7
  34. package/dist-esm/src/operations/privateLinkResources.js.map +1 -1
  35. package/dist-esm/src/operations/replicas.d.ts.map +1 -1
  36. package/dist-esm/src/operations/replicas.js +8 -4
  37. package/dist-esm/src/operations/replicas.js.map +1 -1
  38. package/dist-esm/src/operations/serverAdministrators.d.ts.map +1 -1
  39. package/dist-esm/src/operations/serverAdministrators.js +8 -4
  40. package/dist-esm/src/operations/serverAdministrators.js.map +1 -1
  41. package/dist-esm/src/operations/serverBasedPerformanceTier.d.ts.map +1 -1
  42. package/dist-esm/src/operations/serverBasedPerformanceTier.js +8 -4
  43. package/dist-esm/src/operations/serverBasedPerformanceTier.js.map +1 -1
  44. package/dist-esm/src/operations/serverKeys.d.ts.map +1 -1
  45. package/dist-esm/src/operations/serverKeys.js +19 -7
  46. package/dist-esm/src/operations/serverKeys.js.map +1 -1
  47. package/dist-esm/src/operations/serverSecurityAlertPolicies.d.ts.map +1 -1
  48. package/dist-esm/src/operations/serverSecurityAlertPolicies.js +19 -7
  49. package/dist-esm/src/operations/serverSecurityAlertPolicies.js.map +1 -1
  50. package/dist-esm/src/operations/servers.d.ts.map +1 -1
  51. package/dist-esm/src/operations/servers.js +16 -8
  52. package/dist-esm/src/operations/servers.js.map +1 -1
  53. package/dist-esm/src/operations/virtualNetworkRules.d.ts.map +1 -1
  54. package/dist-esm/src/operations/virtualNetworkRules.js +19 -7
  55. package/dist-esm/src/operations/virtualNetworkRules.js.map +1 -1
  56. package/dist-esm/src/pagingHelper.d.ts +13 -0
  57. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  58. package/dist-esm/src/pagingHelper.js +32 -0
  59. package/dist-esm/src/pagingHelper.js.map +1 -0
  60. package/dist-esm/src/postgreSQLManagementClient.d.ts.map +1 -1
  61. package/dist-esm/src/postgreSQLManagementClient.js +20 -18
  62. package/dist-esm/src/postgreSQLManagementClient.js.map +1 -1
  63. package/dist-esm/test/sampleTest.js +11 -13
  64. package/dist-esm/test/sampleTest.js.map +1 -1
  65. package/package.json +12 -8
  66. package/review/arm-postgresql.api.md +68 -112
  67. package/src/index.ts +1 -0
  68. package/src/models/index.ts +85 -35
  69. package/src/operations/configurations.ts +13 -11
  70. package/src/operations/databases.ts +13 -11
  71. package/src/operations/firewallRules.ts +13 -11
  72. package/src/operations/locationBasedPerformanceTier.ts +10 -5
  73. package/src/operations/logFiles.ts +11 -9
  74. package/src/operations/privateEndpointConnections.ts +23 -13
  75. package/src/operations/privateLinkResources.ts +22 -12
  76. package/src/operations/replicas.ts +11 -9
  77. package/src/operations/serverAdministrators.ts +17 -7
  78. package/src/operations/serverBasedPerformanceTier.ts +15 -5
  79. package/src/operations/serverKeys.ts +26 -8
  80. package/src/operations/serverSecurityAlertPolicies.ts +23 -13
  81. package/src/operations/servers.ts +25 -11
  82. package/src/operations/virtualNetworkRules.ts +23 -13
  83. package/src/pagingHelper.ts +39 -0
  84. package/src/postgreSQLManagementClient.ts +26 -20
  85. package/types/arm-postgresql.d.ts +93 -35
  86. package/types/tsdoc-metadata.json +1 -1
@@ -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 { PrivateEndpointConnections } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -18,6 +19,7 @@ import {
18
19
  PrivateEndpointConnection,
19
20
  PrivateEndpointConnectionsListByServerNextOptionalParams,
20
21
  PrivateEndpointConnectionsListByServerOptionalParams,
22
+ PrivateEndpointConnectionsListByServerResponse,
21
23
  PrivateEndpointConnectionsGetOptionalParams,
22
24
  PrivateEndpointConnectionsGetResponse,
23
25
  PrivateEndpointConnectionsCreateOrUpdateOptionalParams,
@@ -26,7 +28,6 @@ import {
26
28
  TagsObject,
27
29
  PrivateEndpointConnectionsUpdateTagsOptionalParams,
28
30
  PrivateEndpointConnectionsUpdateTagsResponse,
29
- PrivateEndpointConnectionsListByServerResponse,
30
31
  PrivateEndpointConnectionsListByServerNextResponse
31
32
  } from "../models";
32
33
 
@@ -67,11 +68,15 @@ export class PrivateEndpointConnectionsImpl
67
68
  [Symbol.asyncIterator]() {
68
69
  return this;
69
70
  },
70
- byPage: () => {
71
+ byPage: (settings?: PageSettings) => {
72
+ if (settings?.maxPageSize) {
73
+ throw new Error("maxPageSize is not supported by this operation.");
74
+ }
71
75
  return this.listByServerPagingPage(
72
76
  resourceGroupName,
73
77
  serverName,
74
- options
78
+ options,
79
+ settings
75
80
  );
76
81
  }
77
82
  };
@@ -80,15 +85,18 @@ export class PrivateEndpointConnectionsImpl
80
85
  private async *listByServerPagingPage(
81
86
  resourceGroupName: string,
82
87
  serverName: string,
83
- options?: PrivateEndpointConnectionsListByServerOptionalParams
88
+ options?: PrivateEndpointConnectionsListByServerOptionalParams,
89
+ settings?: PageSettings
84
90
  ): AsyncIterableIterator<PrivateEndpointConnection[]> {
85
- let result = await this._listByServer(
86
- resourceGroupName,
87
- serverName,
88
- options
89
- );
90
- yield result.value || [];
91
- let continuationToken = result.nextLink;
91
+ let result: PrivateEndpointConnectionsListByServerResponse;
92
+ let continuationToken = settings?.continuationToken;
93
+ if (!continuationToken) {
94
+ result = await this._listByServer(resourceGroupName, serverName, options);
95
+ let page = result.value || [];
96
+ continuationToken = result.nextLink;
97
+ setContinuationToken(page, continuationToken);
98
+ yield page;
99
+ }
92
100
  while (continuationToken) {
93
101
  result = await this._listByServerNext(
94
102
  resourceGroupName,
@@ -97,7 +105,9 @@ export class PrivateEndpointConnectionsImpl
97
105
  options
98
106
  );
99
107
  continuationToken = result.nextLink;
100
- yield result.value || [];
108
+ let page = result.value || [];
109
+ setContinuationToken(page, continuationToken);
110
+ yield page;
101
111
  }
102
112
  }
103
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 { PrivateLinkResources } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -58,11 +59,15 @@ export class PrivateLinkResourcesImpl implements PrivateLinkResources {
58
59
  [Symbol.asyncIterator]() {
59
60
  return this;
60
61
  },
61
- byPage: () => {
62
+ byPage: (settings?: PageSettings) => {
63
+ if (settings?.maxPageSize) {
64
+ throw new Error("maxPageSize is not supported by this operation.");
65
+ }
62
66
  return this.listByServerPagingPage(
63
67
  resourceGroupName,
64
68
  serverName,
65
- options
69
+ options,
70
+ settings
66
71
  );
67
72
  }
68
73
  };
@@ -71,15 +76,18 @@ export class PrivateLinkResourcesImpl implements PrivateLinkResources {
71
76
  private async *listByServerPagingPage(
72
77
  resourceGroupName: string,
73
78
  serverName: string,
74
- options?: PrivateLinkResourcesListByServerOptionalParams
79
+ options?: PrivateLinkResourcesListByServerOptionalParams,
80
+ settings?: PageSettings
75
81
  ): AsyncIterableIterator<PrivateLinkResource[]> {
76
- let result = await this._listByServer(
77
- resourceGroupName,
78
- serverName,
79
- options
80
- );
81
- yield result.value || [];
82
- let continuationToken = result.nextLink;
82
+ let result: PrivateLinkResourcesListByServerResponse;
83
+ let continuationToken = settings?.continuationToken;
84
+ if (!continuationToken) {
85
+ result = await this._listByServer(resourceGroupName, serverName, options);
86
+ let page = result.value || [];
87
+ continuationToken = result.nextLink;
88
+ setContinuationToken(page, continuationToken);
89
+ yield page;
90
+ }
83
91
  while (continuationToken) {
84
92
  result = await this._listByServerNext(
85
93
  resourceGroupName,
@@ -88,7 +96,9 @@ export class PrivateLinkResourcesImpl implements PrivateLinkResources {
88
96
  options
89
97
  );
90
98
  continuationToken = result.nextLink;
91
- yield result.value || [];
99
+ let page = result.value || [];
100
+ setContinuationToken(page, continuationToken);
101
+ yield page;
92
102
  }
93
103
  }
94
104
 
@@ -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 { Replicas } from "../operationsInterfaces";
11
11
  import * as coreClient from "@azure/core-client";
12
12
  import * as Mappers from "../models/mappers";
@@ -54,11 +54,15 @@ export class ReplicasImpl implements Replicas {
54
54
  [Symbol.asyncIterator]() {
55
55
  return this;
56
56
  },
57
- byPage: () => {
57
+ byPage: (settings?: PageSettings) => {
58
+ if (settings?.maxPageSize) {
59
+ throw new Error("maxPageSize is not supported by this operation.");
60
+ }
58
61
  return this.listByServerPagingPage(
59
62
  resourceGroupName,
60
63
  serverName,
61
- options
64
+ options,
65
+ settings
62
66
  );
63
67
  }
64
68
  };
@@ -67,13 +71,11 @@ export class ReplicasImpl implements Replicas {
67
71
  private async *listByServerPagingPage(
68
72
  resourceGroupName: string,
69
73
  serverName: string,
70
- options?: ReplicasListByServerOptionalParams
74
+ options?: ReplicasListByServerOptionalParams,
75
+ _settings?: PageSettings
71
76
  ): AsyncIterableIterator<Server[]> {
72
- let result = await this._listByServer(
73
- resourceGroupName,
74
- serverName,
75
- options
76
- );
77
+ let result: ReplicasListByServerResponse;
78
+ result = await this._listByServer(resourceGroupName, serverName, options);
77
79
  yield result.value || [];
78
80
  }
79
81
 
@@ -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 { ServerAdministrators } from "../operationsInterfaces";
11
11
  import * as coreClient from "@azure/core-client";
12
12
  import * as Mappers from "../models/mappers";
@@ -17,12 +17,12 @@ import { LroImpl } from "../lroImpl";
17
17
  import {
18
18
  ServerAdministratorResource,
19
19
  ServerAdministratorsListOptionalParams,
20
+ ServerAdministratorsListResponse,
20
21
  ServerAdministratorsGetOptionalParams,
21
22
  ServerAdministratorsGetResponse,
22
23
  ServerAdministratorsCreateOrUpdateOptionalParams,
23
24
  ServerAdministratorsCreateOrUpdateResponse,
24
- ServerAdministratorsDeleteOptionalParams,
25
- ServerAdministratorsListResponse
25
+ ServerAdministratorsDeleteOptionalParams
26
26
  } from "../models";
27
27
 
28
28
  /// <reference lib="esnext.asynciterable" />
@@ -57,8 +57,16 @@ export class ServerAdministratorsImpl implements ServerAdministrators {
57
57
  [Symbol.asyncIterator]() {
58
58
  return this;
59
59
  },
60
- byPage: () => {
61
- return this.listPagingPage(resourceGroupName, serverName, options);
60
+ byPage: (settings?: PageSettings) => {
61
+ if (settings?.maxPageSize) {
62
+ throw new Error("maxPageSize is not supported by this operation.");
63
+ }
64
+ return this.listPagingPage(
65
+ resourceGroupName,
66
+ serverName,
67
+ options,
68
+ settings
69
+ );
62
70
  }
63
71
  };
64
72
  }
@@ -66,9 +74,11 @@ export class ServerAdministratorsImpl implements ServerAdministrators {
66
74
  private async *listPagingPage(
67
75
  resourceGroupName: string,
68
76
  serverName: string,
69
- options?: ServerAdministratorsListOptionalParams
77
+ options?: ServerAdministratorsListOptionalParams,
78
+ _settings?: PageSettings
70
79
  ): AsyncIterableIterator<ServerAdministratorResource[]> {
71
- let result = await this._list(resourceGroupName, serverName, options);
80
+ let result: ServerAdministratorsListResponse;
81
+ result = await this._list(resourceGroupName, serverName, options);
72
82
  yield result.value || [];
73
83
  }
74
84
 
@@ -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
  } from "../models";
34
34
 
@@ -62,17 +62,26 @@ export class ServersImpl implements Servers {
62
62
  [Symbol.asyncIterator]() {
63
63
  return this;
64
64
  },
65
- byPage: () => {
66
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
65
+ byPage: (settings?: PageSettings) => {
66
+ if (settings?.maxPageSize) {
67
+ throw new Error("maxPageSize is not supported by this operation.");
68
+ }
69
+ return this.listByResourceGroupPagingPage(
70
+ resourceGroupName,
71
+ options,
72
+ settings
73
+ );
67
74
  }
68
75
  };
69
76
  }
70
77
 
71
78
  private async *listByResourceGroupPagingPage(
72
79
  resourceGroupName: string,
73
- options?: ServersListByResourceGroupOptionalParams
80
+ options?: ServersListByResourceGroupOptionalParams,
81
+ _settings?: PageSettings
74
82
  ): AsyncIterableIterator<Server[]> {
75
- let result = await this._listByResourceGroup(resourceGroupName, options);
83
+ let result: ServersListByResourceGroupResponse;
84
+ result = await this._listByResourceGroup(resourceGroupName, options);
76
85
  yield result.value || [];
77
86
  }
78
87
 
@@ -103,16 +112,21 @@ export class ServersImpl implements Servers {
103
112
  [Symbol.asyncIterator]() {
104
113
  return this;
105
114
  },
106
- byPage: () => {
107
- return this.listPagingPage(options);
115
+ byPage: (settings?: PageSettings) => {
116
+ if (settings?.maxPageSize) {
117
+ throw new Error("maxPageSize is not supported by this operation.");
118
+ }
119
+ return this.listPagingPage(options, settings);
108
120
  }
109
121
  };
110
122
  }
111
123
 
112
124
  private async *listPagingPage(
113
- options?: ServersListOptionalParams
125
+ options?: ServersListOptionalParams,
126
+ _settings?: PageSettings
114
127
  ): AsyncIterableIterator<Server[]> {
115
- let result = await this._list(options);
128
+ let result: ServersListResponse;
129
+ result = await this._list(options);
116
130
  yield result.value || [];
117
131
  }
118
132
 
@@ -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
 
@@ -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
+ }