@azure/arm-resourcehealth 3.1.1-alpha.20230127.1 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. package/CHANGELOG.md +16 -10
  2. package/LICENSE +1 -1
  3. package/dist/index.js +161 -86
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.js +1 -1
  6. package/dist/index.min.js.map +1 -1
  7. package/dist-esm/samples-dev/availabilityStatusesGetByResourceSample.js +10 -2
  8. package/dist-esm/samples-dev/availabilityStatusesGetByResourceSample.js.map +1 -1
  9. package/dist-esm/samples-dev/availabilityStatusesListByResourceGroupSample.js +10 -3
  10. package/dist-esm/samples-dev/availabilityStatusesListByResourceGroupSample.js.map +1 -1
  11. package/dist-esm/samples-dev/availabilityStatusesListBySubscriptionIdSample.js +9 -2
  12. package/dist-esm/samples-dev/availabilityStatusesListBySubscriptionIdSample.js.map +1 -1
  13. package/dist-esm/samples-dev/availabilityStatusesListSample.js +10 -2
  14. package/dist-esm/samples-dev/availabilityStatusesListSample.js.map +1 -1
  15. package/dist-esm/samples-dev/childAvailabilityStatusesGetByResourceSample.js +10 -2
  16. package/dist-esm/samples-dev/childAvailabilityStatusesGetByResourceSample.js.map +1 -1
  17. package/dist-esm/samples-dev/childAvailabilityStatusesListSample.js +10 -2
  18. package/dist-esm/samples-dev/childAvailabilityStatusesListSample.js.map +1 -1
  19. package/dist-esm/samples-dev/childResourcesListSample.js +10 -2
  20. package/dist-esm/samples-dev/childResourcesListSample.js.map +1 -1
  21. package/dist-esm/samples-dev/emergingIssuesGetSample.js +10 -2
  22. package/dist-esm/samples-dev/emergingIssuesGetSample.js.map +1 -1
  23. package/dist-esm/samples-dev/emergingIssuesListSample.js +10 -2
  24. package/dist-esm/samples-dev/emergingIssuesListSample.js.map +1 -1
  25. package/dist-esm/src/index.d.ts +1 -0
  26. package/dist-esm/src/index.d.ts.map +1 -1
  27. package/dist-esm/src/index.js +1 -0
  28. package/dist-esm/src/index.js.map +1 -1
  29. package/dist-esm/src/microsoftResourceHealth.d.ts.map +1 -1
  30. package/dist-esm/src/microsoftResourceHealth.js +20 -18
  31. package/dist-esm/src/microsoftResourceHealth.js.map +1 -1
  32. package/dist-esm/src/models/index.d.ts +0 -20
  33. package/dist-esm/src/models/index.d.ts.map +1 -1
  34. package/dist-esm/src/operations/availabilityStatuses.d.ts.map +1 -1
  35. package/dist-esm/src/operations/availabilityStatuses.js +55 -36
  36. package/dist-esm/src/operations/availabilityStatuses.js.map +1 -1
  37. package/dist-esm/src/operations/childAvailabilityStatuses.d.ts.map +1 -1
  38. package/dist-esm/src/operations/childAvailabilityStatuses.js +19 -12
  39. package/dist-esm/src/operations/childAvailabilityStatuses.js.map +1 -1
  40. package/dist-esm/src/operations/childResources.d.ts.map +1 -1
  41. package/dist-esm/src/operations/childResources.js +19 -12
  42. package/dist-esm/src/operations/childResources.js.map +1 -1
  43. package/dist-esm/src/operations/emergingIssues.d.ts.map +1 -1
  44. package/dist-esm/src/operations/emergingIssues.js +19 -8
  45. package/dist-esm/src/operations/emergingIssues.js.map +1 -1
  46. package/dist-esm/src/pagingHelper.d.ts +13 -0
  47. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  48. package/dist-esm/src/pagingHelper.js +32 -0
  49. package/dist-esm/src/pagingHelper.js.map +1 -0
  50. package/package.json +7 -5
  51. package/review/arm-resourcehealth.api.md +3 -10
  52. package/src/index.ts +1 -0
  53. package/src/microsoftResourceHealth.ts +26 -20
  54. package/src/models/index.ts +5 -30
  55. package/src/operations/availabilityStatuses.ts +66 -40
  56. package/src/operations/childAvailabilityStatuses.ts +22 -14
  57. package/src/operations/childResources.ts +21 -13
  58. package/src/operations/emergingIssues.ts +22 -10
  59. package/src/pagingHelper.ts +39 -0
  60. package/types/arm-resourcehealth.d.ts +9 -20
  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 { ChildResources } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -53,23 +54,35 @@ export class ChildResourcesImpl implements ChildResources {
53
54
  [Symbol.asyncIterator]() {
54
55
  return this;
55
56
  },
56
- byPage: () => {
57
- return this.listPagingPage(resourceUri, options);
57
+ byPage: (settings?: PageSettings) => {
58
+ if (settings?.maxPageSize) {
59
+ throw new Error("maxPageSize is not supported by this operation.");
60
+ }
61
+ return this.listPagingPage(resourceUri, options, settings);
58
62
  }
59
63
  };
60
64
  }
61
65
 
62
66
  private async *listPagingPage(
63
67
  resourceUri: string,
64
- options?: ChildResourcesListOptionalParams
68
+ options?: ChildResourcesListOptionalParams,
69
+ settings?: PageSettings
65
70
  ): AsyncIterableIterator<AvailabilityStatus[]> {
66
- let result = await this._list(resourceUri, options);
67
- yield result.value || [];
68
- let continuationToken = result.nextLink;
71
+ let result: ChildResourcesListResponse;
72
+ let continuationToken = settings?.continuationToken;
73
+ if (!continuationToken) {
74
+ result = await this._list(resourceUri, options);
75
+ let page = result.value || [];
76
+ continuationToken = result.nextLink;
77
+ setContinuationToken(page, continuationToken);
78
+ yield page;
79
+ }
69
80
  while (continuationToken) {
70
81
  result = await this._listNext(resourceUri, continuationToken, options);
71
82
  continuationToken = result.nextLink;
72
- yield result.value || [];
83
+ let page = result.value || [];
84
+ setContinuationToken(page, continuationToken);
85
+ yield page;
73
86
  }
74
87
  }
75
88
 
@@ -153,11 +166,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
153
166
  bodyMapper: Mappers.ErrorResponse
154
167
  }
155
168
  },
156
- queryParameters: [
157
- Parameters.apiVersion,
158
- Parameters.filter,
159
- Parameters.expand
160
- ],
161
169
  urlParameters: [
162
170
  Parameters.$host,
163
171
  Parameters.resourceUri,
@@ -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 { EmergingIssues } 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
  EmergingIssuesGetResult,
17
18
  EmergingIssuesListNextOptionalParams,
18
19
  EmergingIssuesListOptionalParams,
20
+ EmergingIssuesListResponse,
19
21
  EmergingIssuesGetOptionalParams,
20
22
  EmergingIssuesGetResponse,
21
- EmergingIssuesListResponse,
22
23
  EmergingIssuesListNextResponse
23
24
  } from "../models";
24
25
 
@@ -50,22 +51,34 @@ export class EmergingIssuesImpl implements EmergingIssues {
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?: EmergingIssuesListOptionalParams
64
+ options?: EmergingIssuesListOptionalParams,
65
+ settings?: PageSettings
61
66
  ): AsyncIterableIterator<EmergingIssuesGetResult[]> {
62
- let result = await this._list(options);
63
- yield result.value || [];
64
- let continuationToken = result.nextLink;
67
+ let result: EmergingIssuesListResponse;
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
 
@@ -158,7 +171,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
158
171
  bodyMapper: Mappers.ErrorResponse
159
172
  }
160
173
  },
161
- queryParameters: [Parameters.apiVersion],
162
174
  urlParameters: [Parameters.$host, Parameters.nextLink],
163
175
  headerParameters: [Parameters.accept],
164
176
  serializer
@@ -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
+ }
@@ -70,10 +70,6 @@ export declare type AvailabilityStatusesGetByResourceResponse = AvailabilityStat
70
70
 
71
71
  /** Optional parameters. */
72
72
  export declare interface AvailabilityStatusesListByResourceGroupNextOptionalParams extends coreClient.OperationOptions {
73
- /** The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN */
74
- filter?: string;
75
- /** Setting $expand=recommendedactions in url query expands the recommendedactions in the response. */
76
- expand?: string;
77
73
  }
78
74
 
79
75
  /** Contains response data for the listByResourceGroupNext operation. */
@@ -92,10 +88,6 @@ export declare type AvailabilityStatusesListByResourceGroupResponse = Availabili
92
88
 
93
89
  /** Optional parameters. */
94
90
  export declare interface AvailabilityStatusesListBySubscriptionIdNextOptionalParams extends coreClient.OperationOptions {
95
- /** The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN */
96
- filter?: string;
97
- /** Setting $expand=recommendedactions in url query expands the recommendedactions in the response. */
98
- expand?: string;
99
91
  }
100
92
 
101
93
  /** Contains response data for the listBySubscriptionIdNext operation. */
@@ -114,10 +106,6 @@ export declare type AvailabilityStatusesListBySubscriptionIdResponse = Availabil
114
106
 
115
107
  /** Optional parameters. */
116
108
  export declare interface AvailabilityStatusesListNextOptionalParams extends coreClient.OperationOptions {
117
- /** The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN */
118
- filter?: string;
119
- /** Setting $expand=recommendedactions in url query expands the recommendedactions in the response. */
120
- expand?: string;
121
109
  }
122
110
 
123
111
  /** Contains response data for the listNext operation. */
@@ -222,10 +210,6 @@ export declare type ChildAvailabilityStatusesGetByResourceResponse = Availabilit
222
210
 
223
211
  /** Optional parameters. */
224
212
  export declare interface ChildAvailabilityStatusesListNextOptionalParams extends coreClient.OperationOptions {
225
- /** The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN */
226
- filter?: string;
227
- /** Setting $expand=recommendedactions in url query expands the recommendedactions in the response. */
228
- expand?: string;
229
213
  }
230
214
 
231
215
  /** Contains response data for the listNext operation. */
@@ -257,10 +241,6 @@ export declare interface ChildResources {
257
241
 
258
242
  /** Optional parameters. */
259
243
  export declare interface ChildResourcesListNextOptionalParams extends coreClient.OperationOptions {
260
- /** The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN */
261
- filter?: string;
262
- /** Setting $expand=recommendedactions in url query expands the recommendedactions in the response. */
263
- expand?: string;
264
244
  }
265
245
 
266
246
  /** Contains response data for the listNext operation. */
@@ -359,6 +339,15 @@ export declare interface ErrorResponse {
359
339
  readonly details?: string;
360
340
  }
361
341
 
342
+ /**
343
+ * Given the last `.value` produced by the `byPage` iterator,
344
+ * returns a continuation token that can be used to begin paging from
345
+ * that point later.
346
+ * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
347
+ * @returns The continuation token that can be passed into byPage() during future calls.
348
+ */
349
+ export declare function getContinuationToken(page: unknown): string | undefined;
350
+
362
351
  /** Object of impacted region. */
363
352
  export declare interface ImpactedRegion {
364
353
  /** The impacted region id. */
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.34.0"
8
+ "packageVersion": "7.34.2"
9
9
  }
10
10
  ]
11
11
  }