@azure/arm-extendedlocation 1.0.0-beta.2 → 1.0.0-beta.3

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 +11 -1
  2. package/LICENSE +1 -1
  3. package/README.md +1 -1
  4. package/dist/index.js +143 -58
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.js +1 -1
  7. package/dist/index.min.js.map +1 -1
  8. package/dist-esm/samples-dev/customLocationsCreateOrUpdateSample.js +11 -3
  9. package/dist-esm/samples-dev/customLocationsCreateOrUpdateSample.js.map +1 -1
  10. package/dist-esm/samples-dev/customLocationsDeleteSample.js +11 -3
  11. package/dist-esm/samples-dev/customLocationsDeleteSample.js.map +1 -1
  12. package/dist-esm/samples-dev/customLocationsFindTargetResourceGroupSample.js +11 -3
  13. package/dist-esm/samples-dev/customLocationsFindTargetResourceGroupSample.js.map +1 -1
  14. package/dist-esm/samples-dev/customLocationsGetSample.js +11 -3
  15. package/dist-esm/samples-dev/customLocationsGetSample.js.map +1 -1
  16. package/dist-esm/samples-dev/customLocationsListByResourceGroupSample.js +11 -3
  17. package/dist-esm/samples-dev/customLocationsListByResourceGroupSample.js.map +1 -1
  18. package/dist-esm/samples-dev/customLocationsListBySubscriptionSample.js +10 -2
  19. package/dist-esm/samples-dev/customLocationsListBySubscriptionSample.js.map +1 -1
  20. package/dist-esm/samples-dev/customLocationsListEnabledResourceTypesSample.js +11 -3
  21. package/dist-esm/samples-dev/customLocationsListEnabledResourceTypesSample.js.map +1 -1
  22. package/dist-esm/samples-dev/customLocationsListOperationsSample.js +10 -2
  23. package/dist-esm/samples-dev/customLocationsListOperationsSample.js.map +1 -1
  24. package/dist-esm/samples-dev/customLocationsUpdateSample.js +11 -3
  25. package/dist-esm/samples-dev/customLocationsUpdateSample.js.map +1 -1
  26. package/dist-esm/samples-dev/resourceSyncRulesCreateOrUpdateSample.js +11 -3
  27. package/dist-esm/samples-dev/resourceSyncRulesCreateOrUpdateSample.js.map +1 -1
  28. package/dist-esm/samples-dev/resourceSyncRulesDeleteSample.js +11 -3
  29. package/dist-esm/samples-dev/resourceSyncRulesDeleteSample.js.map +1 -1
  30. package/dist-esm/samples-dev/resourceSyncRulesGetSample.js +11 -3
  31. package/dist-esm/samples-dev/resourceSyncRulesGetSample.js.map +1 -1
  32. package/dist-esm/samples-dev/resourceSyncRulesListByCustomLocationIdSample.js +11 -3
  33. package/dist-esm/samples-dev/resourceSyncRulesListByCustomLocationIdSample.js.map +1 -1
  34. package/dist-esm/samples-dev/resourceSyncRulesUpdateSample.js +11 -3
  35. package/dist-esm/samples-dev/resourceSyncRulesUpdateSample.js.map +1 -1
  36. package/dist-esm/src/customLocationsManagementClient.d.ts.map +1 -1
  37. package/dist-esm/src/customLocationsManagementClient.js +20 -18
  38. package/dist-esm/src/customLocationsManagementClient.js.map +1 -1
  39. package/dist-esm/src/index.d.ts +1 -0
  40. package/dist-esm/src/index.d.ts.map +1 -1
  41. package/dist-esm/src/index.js +1 -0
  42. package/dist-esm/src/index.js.map +1 -1
  43. package/dist-esm/src/operations/customLocations.d.ts.map +1 -1
  44. package/dist-esm/src/operations/customLocations.js +73 -32
  45. package/dist-esm/src/operations/customLocations.js.map +1 -1
  46. package/dist-esm/src/operations/resourceSyncRules.d.ts.map +1 -1
  47. package/dist-esm/src/operations/resourceSyncRules.js +19 -8
  48. package/dist-esm/src/operations/resourceSyncRules.js.map +1 -1
  49. package/dist-esm/src/pagingHelper.d.ts +13 -0
  50. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  51. package/dist-esm/src/pagingHelper.js +32 -0
  52. package/dist-esm/src/pagingHelper.js.map +1 -0
  53. package/package.json +8 -6
  54. package/review/arm-extendedlocation.api.md +3 -0
  55. package/src/customLocationsManagementClient.ts +26 -20
  56. package/src/index.ts +1 -0
  57. package/src/operations/customLocations.ts +91 -41
  58. package/src/operations/resourceSyncRules.ts +26 -13
  59. package/src/pagingHelper.ts +39 -0
  60. package/types/arm-extendedlocation.d.ts +9 -0
  61. 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 { CustomLocations } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -18,17 +19,18 @@ import {
18
19
  CustomLocationOperation,
19
20
  CustomLocationsListOperationsNextOptionalParams,
20
21
  CustomLocationsListOperationsOptionalParams,
22
+ CustomLocationsListOperationsResponse,
21
23
  CustomLocation,
22
24
  CustomLocationsListBySubscriptionNextOptionalParams,
23
25
  CustomLocationsListBySubscriptionOptionalParams,
26
+ CustomLocationsListBySubscriptionResponse,
24
27
  CustomLocationsListByResourceGroupNextOptionalParams,
25
28
  CustomLocationsListByResourceGroupOptionalParams,
29
+ CustomLocationsListByResourceGroupResponse,
26
30
  EnabledResourceType,
27
31
  CustomLocationsListEnabledResourceTypesNextOptionalParams,
28
32
  CustomLocationsListEnabledResourceTypesOptionalParams,
29
- CustomLocationsListOperationsResponse,
30
- CustomLocationsListBySubscriptionResponse,
31
- CustomLocationsListByResourceGroupResponse,
33
+ CustomLocationsListEnabledResourceTypesResponse,
32
34
  CustomLocationsGetOptionalParams,
33
35
  CustomLocationsGetResponse,
34
36
  CustomLocationsCreateOrUpdateOptionalParams,
@@ -36,7 +38,6 @@ import {
36
38
  CustomLocationsDeleteOptionalParams,
37
39
  CustomLocationsUpdateOptionalParams,
38
40
  CustomLocationsUpdateResponse,
39
- CustomLocationsListEnabledResourceTypesResponse,
40
41
  CustomLocationFindTargetResourceGroupProperties,
41
42
  CustomLocationsFindTargetResourceGroupOptionalParams,
42
43
  CustomLocationsFindTargetResourceGroupResponse,
@@ -74,22 +75,34 @@ export class CustomLocationsImpl implements CustomLocations {
74
75
  [Symbol.asyncIterator]() {
75
76
  return this;
76
77
  },
77
- byPage: () => {
78
- return this.listOperationsPagingPage(options);
78
+ byPage: (settings?: PageSettings) => {
79
+ if (settings?.maxPageSize) {
80
+ throw new Error("maxPageSize is not supported by this operation.");
81
+ }
82
+ return this.listOperationsPagingPage(options, settings);
79
83
  }
80
84
  };
81
85
  }
82
86
 
83
87
  private async *listOperationsPagingPage(
84
- options?: CustomLocationsListOperationsOptionalParams
88
+ options?: CustomLocationsListOperationsOptionalParams,
89
+ settings?: PageSettings
85
90
  ): AsyncIterableIterator<CustomLocationOperation[]> {
86
- let result = await this._listOperations(options);
87
- yield result.value || [];
88
- let continuationToken = result.nextLink;
91
+ let result: CustomLocationsListOperationsResponse;
92
+ let continuationToken = settings?.continuationToken;
93
+ if (!continuationToken) {
94
+ result = await this._listOperations(options);
95
+ let page = result.value || [];
96
+ continuationToken = result.nextLink;
97
+ setContinuationToken(page, continuationToken);
98
+ yield page;
99
+ }
89
100
  while (continuationToken) {
90
101
  result = await this._listOperationsNext(continuationToken, options);
91
102
  continuationToken = result.nextLink;
92
- yield result.value || [];
103
+ let page = result.value || [];
104
+ setContinuationToken(page, continuationToken);
105
+ yield page;
93
106
  }
94
107
  }
95
108
 
@@ -117,22 +130,34 @@ export class CustomLocationsImpl implements CustomLocations {
117
130
  [Symbol.asyncIterator]() {
118
131
  return this;
119
132
  },
120
- byPage: () => {
121
- return this.listBySubscriptionPagingPage(options);
133
+ byPage: (settings?: PageSettings) => {
134
+ if (settings?.maxPageSize) {
135
+ throw new Error("maxPageSize is not supported by this operation.");
136
+ }
137
+ return this.listBySubscriptionPagingPage(options, settings);
122
138
  }
123
139
  };
124
140
  }
125
141
 
126
142
  private async *listBySubscriptionPagingPage(
127
- options?: CustomLocationsListBySubscriptionOptionalParams
143
+ options?: CustomLocationsListBySubscriptionOptionalParams,
144
+ settings?: PageSettings
128
145
  ): AsyncIterableIterator<CustomLocation[]> {
129
- let result = await this._listBySubscription(options);
130
- yield result.value || [];
131
- let continuationToken = result.nextLink;
146
+ let result: CustomLocationsListBySubscriptionResponse;
147
+ let continuationToken = settings?.continuationToken;
148
+ if (!continuationToken) {
149
+ result = await this._listBySubscription(options);
150
+ let page = result.value || [];
151
+ continuationToken = result.nextLink;
152
+ setContinuationToken(page, continuationToken);
153
+ yield page;
154
+ }
132
155
  while (continuationToken) {
133
156
  result = await this._listBySubscriptionNext(continuationToken, options);
134
157
  continuationToken = result.nextLink;
135
- yield result.value || [];
158
+ let page = result.value || [];
159
+ setContinuationToken(page, continuationToken);
160
+ yield page;
136
161
  }
137
162
  }
138
163
 
@@ -162,19 +187,33 @@ export class CustomLocationsImpl implements CustomLocations {
162
187
  [Symbol.asyncIterator]() {
163
188
  return this;
164
189
  },
165
- byPage: () => {
166
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
190
+ byPage: (settings?: PageSettings) => {
191
+ if (settings?.maxPageSize) {
192
+ throw new Error("maxPageSize is not supported by this operation.");
193
+ }
194
+ return this.listByResourceGroupPagingPage(
195
+ resourceGroupName,
196
+ options,
197
+ settings
198
+ );
167
199
  }
168
200
  };
169
201
  }
170
202
 
171
203
  private async *listByResourceGroupPagingPage(
172
204
  resourceGroupName: string,
173
- options?: CustomLocationsListByResourceGroupOptionalParams
205
+ options?: CustomLocationsListByResourceGroupOptionalParams,
206
+ settings?: PageSettings
174
207
  ): AsyncIterableIterator<CustomLocation[]> {
175
- let result = await this._listByResourceGroup(resourceGroupName, options);
176
- yield result.value || [];
177
- let continuationToken = result.nextLink;
208
+ let result: CustomLocationsListByResourceGroupResponse;
209
+ let continuationToken = settings?.continuationToken;
210
+ if (!continuationToken) {
211
+ result = await this._listByResourceGroup(resourceGroupName, options);
212
+ let page = result.value || [];
213
+ continuationToken = result.nextLink;
214
+ setContinuationToken(page, continuationToken);
215
+ yield page;
216
+ }
178
217
  while (continuationToken) {
179
218
  result = await this._listByResourceGroupNext(
180
219
  resourceGroupName,
@@ -182,7 +221,9 @@ export class CustomLocationsImpl implements CustomLocations {
182
221
  options
183
222
  );
184
223
  continuationToken = result.nextLink;
185
- yield result.value || [];
224
+ let page = result.value || [];
225
+ setContinuationToken(page, continuationToken);
226
+ yield page;
186
227
  }
187
228
  }
188
229
 
@@ -221,11 +262,15 @@ export class CustomLocationsImpl implements CustomLocations {
221
262
  [Symbol.asyncIterator]() {
222
263
  return this;
223
264
  },
224
- byPage: () => {
265
+ byPage: (settings?: PageSettings) => {
266
+ if (settings?.maxPageSize) {
267
+ throw new Error("maxPageSize is not supported by this operation.");
268
+ }
225
269
  return this.listEnabledResourceTypesPagingPage(
226
270
  resourceGroupName,
227
271
  resourceName,
228
- options
272
+ options,
273
+ settings
229
274
  );
230
275
  }
231
276
  };
@@ -234,15 +279,22 @@ export class CustomLocationsImpl implements CustomLocations {
234
279
  private async *listEnabledResourceTypesPagingPage(
235
280
  resourceGroupName: string,
236
281
  resourceName: string,
237
- options?: CustomLocationsListEnabledResourceTypesOptionalParams
282
+ options?: CustomLocationsListEnabledResourceTypesOptionalParams,
283
+ settings?: PageSettings
238
284
  ): AsyncIterableIterator<EnabledResourceType[]> {
239
- let result = await this._listEnabledResourceTypes(
240
- resourceGroupName,
241
- resourceName,
242
- options
243
- );
244
- yield result.value || [];
245
- let continuationToken = result.nextLink;
285
+ let result: CustomLocationsListEnabledResourceTypesResponse;
286
+ let continuationToken = settings?.continuationToken;
287
+ if (!continuationToken) {
288
+ result = await this._listEnabledResourceTypes(
289
+ resourceGroupName,
290
+ resourceName,
291
+ options
292
+ );
293
+ let page = result.value || [];
294
+ continuationToken = result.nextLink;
295
+ setContinuationToken(page, continuationToken);
296
+ yield page;
297
+ }
246
298
  while (continuationToken) {
247
299
  result = await this._listEnabledResourceTypesNext(
248
300
  resourceGroupName,
@@ -251,7 +303,9 @@ export class CustomLocationsImpl implements CustomLocations {
251
303
  options
252
304
  );
253
305
  continuationToken = result.nextLink;
254
- yield result.value || [];
306
+ let page = result.value || [];
307
+ setContinuationToken(page, continuationToken);
308
+ yield page;
255
309
  }
256
310
  }
257
311
 
@@ -857,7 +911,6 @@ const listOperationsNextOperationSpec: coreClient.OperationSpec = {
857
911
  bodyMapper: Mappers.ErrorResponse
858
912
  }
859
913
  },
860
- queryParameters: [Parameters.apiVersion],
861
914
  urlParameters: [Parameters.$host, Parameters.nextLink],
862
915
  headerParameters: [Parameters.accept],
863
916
  serializer
@@ -873,7 +926,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = {
873
926
  bodyMapper: Mappers.ErrorResponse
874
927
  }
875
928
  },
876
- queryParameters: [Parameters.apiVersion],
877
929
  urlParameters: [
878
930
  Parameters.$host,
879
931
  Parameters.subscriptionId,
@@ -893,7 +945,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = {
893
945
  bodyMapper: Mappers.ErrorResponse
894
946
  }
895
947
  },
896
- queryParameters: [Parameters.apiVersion],
897
948
  urlParameters: [
898
949
  Parameters.$host,
899
950
  Parameters.subscriptionId,
@@ -914,7 +965,6 @@ const listEnabledResourceTypesNextOperationSpec: coreClient.OperationSpec = {
914
965
  bodyMapper: Mappers.ErrorResponse
915
966
  }
916
967
  },
917
- queryParameters: [Parameters.apiVersion],
918
968
  urlParameters: [
919
969
  Parameters.$host,
920
970
  Parameters.subscriptionId,
@@ -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 { ResourceSyncRules } 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 ResourceSyncRulesImpl implements ResourceSyncRules {
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.listByCustomLocationIDPagingPage(
71
75
  resourceGroupName,
72
76
  resourceName,
73
- options
77
+ options,
78
+ settings
74
79
  );
75
80
  }
76
81
  };
@@ -79,15 +84,22 @@ export class ResourceSyncRulesImpl implements ResourceSyncRules {
79
84
  private async *listByCustomLocationIDPagingPage(
80
85
  resourceGroupName: string,
81
86
  resourceName: string,
82
- options?: ResourceSyncRulesListByCustomLocationIDOptionalParams
87
+ options?: ResourceSyncRulesListByCustomLocationIDOptionalParams,
88
+ settings?: PageSettings
83
89
  ): AsyncIterableIterator<ResourceSyncRule[]> {
84
- let result = await this._listByCustomLocationID(
85
- resourceGroupName,
86
- resourceName,
87
- options
88
- );
89
- yield result.value || [];
90
- let continuationToken = result.nextLink;
90
+ let result: ResourceSyncRulesListByCustomLocationIDResponse;
91
+ let continuationToken = settings?.continuationToken;
92
+ if (!continuationToken) {
93
+ result = await this._listByCustomLocationID(
94
+ resourceGroupName,
95
+ resourceName,
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._listByCustomLocationIDNext(
93
105
  resourceGroupName,
@@ -96,7 +108,9 @@ export class ResourceSyncRulesImpl implements ResourceSyncRules {
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
 
@@ -549,7 +563,6 @@ const listByCustomLocationIDNextOperationSpec: coreClient.OperationSpec = {
549
563
  bodyMapper: Mappers.ErrorResponse
550
564
  }
551
565
  },
552
- queryParameters: [Parameters.apiVersion],
553
566
  urlParameters: [
554
567
  Parameters.$host,
555
568
  Parameters.subscriptionId,
@@ -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 the last `.value` produced by the `byPage` iterator,
17
+ * returns a continuation token that can be used to begin paging from
18
+ * that point later.
19
+ * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
20
+ * @returns The continuation token that can be passed into byPage() during future calls.
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
+ }
@@ -446,6 +446,15 @@ export declare interface ErrorResponse {
446
446
  error?: ErrorDetail;
447
447
  }
448
448
 
449
+ /**
450
+ * Given the last `.value` produced by the `byPage` iterator,
451
+ * returns a continuation token that can be used to begin paging from
452
+ * that point later.
453
+ * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
454
+ * @returns The continuation token that can be passed into byPage() during future calls.
455
+ */
456
+ export declare function getContinuationToken(page: unknown): string | undefined;
457
+
449
458
  /**
450
459
  * Defines values for HostType. \
451
460
  * {@link KnownHostType} can be used interchangeably with HostType,
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.18.11"
8
+ "packageVersion": "7.33.7"
9
9
  }
10
10
  ]
11
11
  }