@azure/arm-resourcehealth 2.0.0 → 3.0.0-alpha.20211124.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/{LICENSE.txt → LICENSE} +1 -1
  3. package/README.md +70 -82
  4. package/dist/index.js +1811 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.min.js +1 -0
  7. package/dist/index.min.js.map +1 -0
  8. package/dist-esm/src/index.d.ts +6 -0
  9. package/dist-esm/src/index.d.ts.map +1 -0
  10. package/dist-esm/src/index.js +13 -0
  11. package/dist-esm/src/index.js.map +1 -0
  12. package/dist-esm/src/microsoftResourceHealth.d.ts +20 -0
  13. package/dist-esm/src/microsoftResourceHealth.d.ts.map +1 -0
  14. package/dist-esm/src/microsoftResourceHealth.js +27 -0
  15. package/dist-esm/src/microsoftResourceHealth.js.map +1 -0
  16. package/dist-esm/src/microsoftResourceHealthContext.d.ts +17 -0
  17. package/dist-esm/src/microsoftResourceHealthContext.d.ts.map +1 -0
  18. package/dist-esm/src/microsoftResourceHealthContext.js +50 -0
  19. package/dist-esm/src/microsoftResourceHealthContext.js.map +1 -0
  20. package/dist-esm/src/models/index.d.ts +402 -0
  21. package/dist-esm/src/models/index.d.ts.map +1 -0
  22. package/dist-esm/src/models/index.js +22 -0
  23. package/dist-esm/src/models/index.js.map +1 -0
  24. package/dist-esm/src/models/mappers.d.ts +21 -0
  25. package/dist-esm/src/models/mappers.d.ts.map +1 -0
  26. package/{esm → dist-esm/src}/models/mappers.js +233 -309
  27. package/dist-esm/src/models/mappers.js.map +1 -0
  28. package/dist-esm/src/models/parameters.d.ts +12 -0
  29. package/dist-esm/src/models/parameters.d.ts.map +1 -0
  30. package/{esm → dist-esm/src}/models/parameters.js +44 -39
  31. package/dist-esm/src/models/parameters.js.map +1 -0
  32. package/dist-esm/src/operations/availabilityStatuses.d.ts +102 -0
  33. package/dist-esm/src/operations/availabilityStatuses.d.ts.map +1 -0
  34. package/dist-esm/src/operations/availabilityStatuses.js +407 -0
  35. package/dist-esm/src/operations/availabilityStatuses.js.map +1 -0
  36. package/dist-esm/src/operations/childAvailabilityStatuses.d.ts +51 -0
  37. package/dist-esm/src/operations/childAvailabilityStatuses.d.ts.map +1 -0
  38. package/dist-esm/src/operations/childAvailabilityStatuses.js +173 -0
  39. package/dist-esm/src/operations/childAvailabilityStatuses.js.map +1 -0
  40. package/dist-esm/src/operations/childResources.d.ts +43 -0
  41. package/dist-esm/src/operations/childResources.d.ts.map +1 -0
  42. package/dist-esm/src/operations/childResources.js +143 -0
  43. package/dist-esm/src/operations/childResources.js.map +1 -0
  44. package/dist-esm/src/operations/emergingIssues.d.ts +37 -0
  45. package/dist-esm/src/operations/emergingIssues.d.ts.map +1 -0
  46. package/dist-esm/src/operations/emergingIssues.js +143 -0
  47. package/dist-esm/src/operations/emergingIssues.js.map +1 -0
  48. package/{esm → dist-esm/src}/operations/index.d.ts +0 -0
  49. package/dist-esm/src/operations/index.d.ts.map +1 -0
  50. package/{esm → dist-esm/src}/operations/index.js +1 -2
  51. package/dist-esm/src/operations/index.js.map +1 -0
  52. package/dist-esm/src/operations/operations.d.ts +18 -0
  53. package/dist-esm/src/operations/operations.d.ts.map +1 -0
  54. package/dist-esm/src/operations/operations.js +46 -0
  55. package/dist-esm/src/operations/operations.js.map +1 -0
  56. package/dist-esm/src/operationsInterfaces/availabilityStatuses.d.ts +40 -0
  57. package/dist-esm/src/operationsInterfaces/availabilityStatuses.d.ts.map +1 -0
  58. package/{src/models/operationsMappers.ts → dist-esm/src/operationsInterfaces/availabilityStatuses.js} +2 -7
  59. package/dist-esm/src/operationsInterfaces/availabilityStatuses.js.map +1 -0
  60. package/dist-esm/src/operationsInterfaces/childAvailabilityStatuses.d.ts +23 -0
  61. package/dist-esm/src/operationsInterfaces/childAvailabilityStatuses.d.ts.map +1 -0
  62. package/{esm/models/operationsMappers.js → dist-esm/src/operationsInterfaces/childAvailabilityStatuses.js} +2 -2
  63. package/dist-esm/src/operationsInterfaces/childAvailabilityStatuses.js.map +1 -0
  64. package/dist-esm/src/operationsInterfaces/childResources.d.ts +15 -0
  65. package/dist-esm/src/operationsInterfaces/childResources.d.ts.map +1 -0
  66. package/dist-esm/src/operationsInterfaces/childResources.js +9 -0
  67. package/dist-esm/src/operationsInterfaces/childResources.js.map +1 -0
  68. package/dist-esm/src/operationsInterfaces/emergingIssues.d.ts +16 -0
  69. package/dist-esm/src/operationsInterfaces/emergingIssues.d.ts.map +1 -0
  70. package/dist-esm/src/operationsInterfaces/emergingIssues.js +9 -0
  71. package/dist-esm/src/operationsInterfaces/emergingIssues.js.map +1 -0
  72. package/dist-esm/src/operationsInterfaces/index.d.ts +6 -0
  73. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
  74. package/dist-esm/src/operationsInterfaces/index.js +13 -0
  75. package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
  76. package/dist-esm/src/operationsInterfaces/operations.d.ts +10 -0
  77. package/dist-esm/src/operationsInterfaces/operations.d.ts.map +1 -0
  78. package/{esm/models/index.js → dist-esm/src/operationsInterfaces/operations.js} +2 -1
  79. package/dist-esm/src/operationsInterfaces/operations.js.map +1 -0
  80. package/dist-esm/test/sampleTest.d.ts +2 -0
  81. package/dist-esm/test/sampleTest.d.ts.map +1 -0
  82. package/dist-esm/test/sampleTest.js +40 -0
  83. package/dist-esm/test/sampleTest.js.map +1 -0
  84. package/package.json +63 -22
  85. package/review/arm-resourcehealth.api.md +396 -0
  86. package/rollup.config.js +181 -30
  87. package/src/index.ts +13 -0
  88. package/src/microsoftResourceHealth.ts +38 -41
  89. package/src/microsoftResourceHealthContext.ts +47 -44
  90. package/src/models/index.ts +322 -878
  91. package/src/models/mappers.ts +232 -320
  92. package/src/models/parameters.ts +58 -40
  93. package/src/operations/availabilityStatuses.ts +325 -276
  94. package/src/operations/childAvailabilityStatuses.ts +137 -130
  95. package/src/operations/childResources.ts +109 -85
  96. package/src/operations/emergingIssues.ts +96 -103
  97. package/src/operations/index.ts +1 -2
  98. package/src/operations/operations.ts +24 -38
  99. package/src/operationsInterfaces/availabilityStatuses.ts +67 -0
  100. package/src/operationsInterfaces/childAvailabilityStatuses.ts +43 -0
  101. package/src/operationsInterfaces/childResources.ts +30 -0
  102. package/src/operationsInterfaces/emergingIssues.ts +34 -0
  103. package/src/operationsInterfaces/index.ts +13 -0
  104. package/src/operationsInterfaces/operations.ts +21 -0
  105. package/tsconfig.json +3 -3
  106. package/types/arm-resourcehealth.d.ts +588 -0
  107. package/types/tsdoc-metadata.json +11 -0
  108. package/dist/arm-resourcehealth.js +0 -1743
  109. package/dist/arm-resourcehealth.js.map +0 -1
  110. package/dist/arm-resourcehealth.min.js +0 -1
  111. package/dist/arm-resourcehealth.min.js.map +0 -1
  112. package/esm/microsoftResourceHealth.d.ts +0 -29
  113. package/esm/microsoftResourceHealth.d.ts.map +0 -1
  114. package/esm/microsoftResourceHealth.js +0 -42
  115. package/esm/microsoftResourceHealth.js.map +0 -1
  116. package/esm/microsoftResourceHealthContext.d.ts +0 -23
  117. package/esm/microsoftResourceHealthContext.d.ts.map +0 -1
  118. package/esm/microsoftResourceHealthContext.js +0 -61
  119. package/esm/microsoftResourceHealthContext.js.map +0 -1
  120. package/esm/models/availabilityStatusesMappers.d.ts +0 -2
  121. package/esm/models/availabilityStatusesMappers.d.ts.map +0 -1
  122. package/esm/models/availabilityStatusesMappers.js +0 -9
  123. package/esm/models/availabilityStatusesMappers.js.map +0 -1
  124. package/esm/models/childAvailabilityStatusesMappers.d.ts +0 -2
  125. package/esm/models/childAvailabilityStatusesMappers.d.ts.map +0 -1
  126. package/esm/models/childAvailabilityStatusesMappers.js +0 -9
  127. package/esm/models/childAvailabilityStatusesMappers.js.map +0 -1
  128. package/esm/models/childResourcesMappers.d.ts +0 -2
  129. package/esm/models/childResourcesMappers.d.ts.map +0 -1
  130. package/esm/models/childResourcesMappers.js +0 -9
  131. package/esm/models/childResourcesMappers.js.map +0 -1
  132. package/esm/models/emergingIssuesMappers.d.ts +0 -2
  133. package/esm/models/emergingIssuesMappers.d.ts.map +0 -1
  134. package/esm/models/emergingIssuesMappers.js +0 -9
  135. package/esm/models/emergingIssuesMappers.js.map +0 -1
  136. package/esm/models/index.d.ts +0 -957
  137. package/esm/models/index.d.ts.map +0 -1
  138. package/esm/models/index.js.map +0 -1
  139. package/esm/models/mappers.d.ts +0 -26
  140. package/esm/models/mappers.d.ts.map +0 -1
  141. package/esm/models/mappers.js.map +0 -1
  142. package/esm/models/operationsMappers.d.ts +0 -2
  143. package/esm/models/operationsMappers.d.ts.map +0 -1
  144. package/esm/models/operationsMappers.js.map +0 -1
  145. package/esm/models/parameters.d.ts +0 -11
  146. package/esm/models/parameters.d.ts.map +0 -1
  147. package/esm/models/parameters.js.map +0 -1
  148. package/esm/operations/availabilityStatuses.d.ts +0 -166
  149. package/esm/operations/availabilityStatuses.d.ts.map +0 -1
  150. package/esm/operations/availabilityStatuses.js +0 -239
  151. package/esm/operations/availabilityStatuses.js.map +0 -1
  152. package/esm/operations/childAvailabilityStatuses.d.ts +0 -81
  153. package/esm/operations/childAvailabilityStatuses.d.ts.map +0 -1
  154. package/esm/operations/childAvailabilityStatuses.js +0 -117
  155. package/esm/operations/childAvailabilityStatuses.js.map +0 -1
  156. package/esm/operations/childResources.d.ts +0 -57
  157. package/esm/operations/childResources.d.ts.map +0 -1
  158. package/esm/operations/childResources.js +0 -87
  159. package/esm/operations/childResources.js.map +0 -1
  160. package/esm/operations/emergingIssues.d.ts +0 -61
  161. package/esm/operations/emergingIssues.d.ts.map +0 -1
  162. package/esm/operations/emergingIssues.js +0 -106
  163. package/esm/operations/emergingIssues.js.map +0 -1
  164. package/esm/operations/index.d.ts.map +0 -1
  165. package/esm/operations/index.js.map +0 -1
  166. package/esm/operations/operations.d.ts +0 -28
  167. package/esm/operations/operations.d.ts.map +0 -1
  168. package/esm/operations/operations.js +0 -50
  169. package/esm/operations/operations.js.map +0 -1
  170. package/src/models/availabilityStatusesMappers.ts +0 -19
  171. package/src/models/childAvailabilityStatusesMappers.ts +0 -19
  172. package/src/models/childResourcesMappers.ts +0 -19
  173. package/src/models/emergingIssuesMappers.ts +0 -22
@@ -3,143 +3,149 @@
3
3
  * Licensed under the MIT License.
4
4
  *
5
5
  * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is
7
- * regenerated.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
7
  */
9
8
 
10
- import * as msRest from "@azure/ms-rest-js";
11
- import * as Models from "../models";
12
- import * as Mappers from "../models/childAvailabilityStatusesMappers";
9
+ import { PagedAsyncIterableIterator } from "@azure/core-paging";
10
+ import { ChildAvailabilityStatuses } from "../operationsInterfaces";
11
+ import * as coreClient from "@azure/core-client";
12
+ import * as Mappers from "../models/mappers";
13
13
  import * as Parameters from "../models/parameters";
14
14
  import { MicrosoftResourceHealthContext } from "../microsoftResourceHealthContext";
15
+ import {
16
+ AvailabilityStatus,
17
+ ChildAvailabilityStatusesListNextOptionalParams,
18
+ ChildAvailabilityStatusesListOptionalParams,
19
+ ChildAvailabilityStatusesGetByResourceOptionalParams,
20
+ ChildAvailabilityStatusesGetByResourceResponse,
21
+ ChildAvailabilityStatusesListResponse,
22
+ ChildAvailabilityStatusesListNextResponse
23
+ } from "../models";
15
24
 
16
- /** Class representing a ChildAvailabilityStatuses. */
17
- export class ChildAvailabilityStatuses {
25
+ /// <reference lib="esnext.asynciterable" />
26
+ /** Class containing ChildAvailabilityStatuses operations. */
27
+ export class ChildAvailabilityStatusesImpl
28
+ implements ChildAvailabilityStatuses {
18
29
  private readonly client: MicrosoftResourceHealthContext;
19
30
 
20
31
  /**
21
- * Create a ChildAvailabilityStatuses.
22
- * @param {MicrosoftResourceHealthContext} client Reference to the service client.
32
+ * Initialize a new instance of the class ChildAvailabilityStatuses class.
33
+ * @param client Reference to the service client
23
34
  */
24
35
  constructor(client: MicrosoftResourceHealthContext) {
25
36
  this.client = client;
26
37
  }
27
38
 
28
39
  /**
29
- * Gets current availability status for a single resource
30
- * @param resourceUri The fully qualified ID of the resource, including the resource name and
31
- * resource type. Currently the API only support one nesting level resource types :
32
- * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}
33
- * @param [options] The optional parameters
34
- * @returns Promise<Models.ChildAvailabilityStatusesGetByResourceResponse>
35
- */
36
- getByResource(resourceUri: string, options?: Models.ChildAvailabilityStatusesGetByResourceOptionalParams): Promise<Models.ChildAvailabilityStatusesGetByResourceResponse>;
37
- /**
38
- * @param resourceUri The fully qualified ID of the resource, including the resource name and
39
- * resource type. Currently the API only support one nesting level resource types :
40
- * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}
41
- * @param callback The callback
42
- */
43
- getByResource(resourceUri: string, callback: msRest.ServiceCallback<Models.AvailabilityStatus>): void;
44
- /**
45
- * @param resourceUri The fully qualified ID of the resource, including the resource name and
46
- * resource type. Currently the API only support one nesting level resource types :
47
- * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}
48
- * @param options The optional parameters
49
- * @param callback The callback
40
+ * Lists the historical availability statuses for a single child resource. Use the nextLink property in
41
+ * the response to get the next page of availability status
42
+ * @param resourceUri The fully qualified ID of the resource, including the resource name and resource
43
+ * type. Currently the API only support one nesting level resource types :
44
+ * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}
45
+ * @param options The options parameters.
50
46
  */
51
- getByResource(resourceUri: string, options: Models.ChildAvailabilityStatusesGetByResourceOptionalParams, callback: msRest.ServiceCallback<Models.AvailabilityStatus>): void;
52
- getByResource(resourceUri: string, options?: Models.ChildAvailabilityStatusesGetByResourceOptionalParams | msRest.ServiceCallback<Models.AvailabilityStatus>, callback?: msRest.ServiceCallback<Models.AvailabilityStatus>): Promise<Models.ChildAvailabilityStatusesGetByResourceResponse> {
53
- return this.client.sendOperationRequest(
54
- {
55
- resourceUri,
56
- options
47
+ public list(
48
+ resourceUri: string,
49
+ options?: ChildAvailabilityStatusesListOptionalParams
50
+ ): PagedAsyncIterableIterator<AvailabilityStatus> {
51
+ const iter = this.listPagingAll(resourceUri, options);
52
+ return {
53
+ next() {
54
+ return iter.next();
57
55
  },
58
- getByResourceOperationSpec,
59
- callback) as Promise<Models.ChildAvailabilityStatusesGetByResourceResponse>;
56
+ [Symbol.asyncIterator]() {
57
+ return this;
58
+ },
59
+ byPage: () => {
60
+ return this.listPagingPage(resourceUri, options);
61
+ }
62
+ };
63
+ }
64
+
65
+ private async *listPagingPage(
66
+ resourceUri: string,
67
+ options?: ChildAvailabilityStatusesListOptionalParams
68
+ ): AsyncIterableIterator<AvailabilityStatus[]> {
69
+ let result = await this._list(resourceUri, options);
70
+ yield result.value || [];
71
+ let continuationToken = result.nextLink;
72
+ while (continuationToken) {
73
+ result = await this._listNext(resourceUri, continuationToken, options);
74
+ continuationToken = result.nextLink;
75
+ yield result.value || [];
76
+ }
77
+ }
78
+
79
+ private async *listPagingAll(
80
+ resourceUri: string,
81
+ options?: ChildAvailabilityStatusesListOptionalParams
82
+ ): AsyncIterableIterator<AvailabilityStatus> {
83
+ for await (const page of this.listPagingPage(resourceUri, options)) {
84
+ yield* page;
85
+ }
60
86
  }
61
87
 
62
88
  /**
63
- * Lists the historical availability statuses for a single child resource. Use the nextLink
64
- * property in the response to get the next page of availability status
65
- * @param resourceUri The fully qualified ID of the resource, including the resource name and
66
- * resource type. Currently the API only support one nesting level resource types :
67
- * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}
68
- * @param [options] The optional parameters
69
- * @returns Promise<Models.ChildAvailabilityStatusesListResponse>
70
- */
71
- list(resourceUri: string, options?: Models.ChildAvailabilityStatusesListOptionalParams): Promise<Models.ChildAvailabilityStatusesListResponse>;
72
- /**
73
- * @param resourceUri The fully qualified ID of the resource, including the resource name and
74
- * resource type. Currently the API only support one nesting level resource types :
75
- * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}
76
- * @param callback The callback
77
- */
78
- list(resourceUri: string, callback: msRest.ServiceCallback<Models.AvailabilityStatusListResult>): void;
79
- /**
80
- * @param resourceUri The fully qualified ID of the resource, including the resource name and
81
- * resource type. Currently the API only support one nesting level resource types :
82
- * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}
83
- * @param options The optional parameters
84
- * @param callback The callback
89
+ * Gets current availability status for a single resource
90
+ * @param resourceUri The fully qualified ID of the resource, including the resource name and resource
91
+ * type. Currently the API only support one nesting level resource types :
92
+ * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}
93
+ * @param options The options parameters.
85
94
  */
86
- list(resourceUri: string, options: Models.ChildAvailabilityStatusesListOptionalParams, callback: msRest.ServiceCallback<Models.AvailabilityStatusListResult>): void;
87
- list(resourceUri: string, options?: Models.ChildAvailabilityStatusesListOptionalParams | msRest.ServiceCallback<Models.AvailabilityStatusListResult>, callback?: msRest.ServiceCallback<Models.AvailabilityStatusListResult>): Promise<Models.ChildAvailabilityStatusesListResponse> {
95
+ getByResource(
96
+ resourceUri: string,
97
+ options?: ChildAvailabilityStatusesGetByResourceOptionalParams
98
+ ): Promise<ChildAvailabilityStatusesGetByResourceResponse> {
88
99
  return this.client.sendOperationRequest(
89
- {
90
- resourceUri,
91
- options
92
- },
93
- listOperationSpec,
94
- callback) as Promise<Models.ChildAvailabilityStatusesListResponse>;
100
+ { resourceUri, options },
101
+ getByResourceOperationSpec
102
+ );
95
103
  }
96
104
 
97
105
  /**
98
- * Lists the historical availability statuses for a single child resource. Use the nextLink
99
- * property in the response to get the next page of availability status
100
- * @param nextPageLink The NextLink from the previous successful call to List operation.
101
- * @param [options] The optional parameters
102
- * @returns Promise<Models.ChildAvailabilityStatusesListNextResponse>
103
- */
104
- listNext(nextPageLink: string, options?: Models.ChildAvailabilityStatusesListNextOptionalParams): Promise<Models.ChildAvailabilityStatusesListNextResponse>;
105
- /**
106
- * @param nextPageLink The NextLink from the previous successful call to List operation.
107
- * @param callback The callback
106
+ * Lists the historical availability statuses for a single child resource. Use the nextLink property in
107
+ * the response to get the next page of availability status
108
+ * @param resourceUri The fully qualified ID of the resource, including the resource name and resource
109
+ * type. Currently the API only support one nesting level resource types :
110
+ * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}
111
+ * @param options The options parameters.
108
112
  */
109
- listNext(nextPageLink: string, callback: msRest.ServiceCallback<Models.AvailabilityStatusListResult>): void;
113
+ private _list(
114
+ resourceUri: string,
115
+ options?: ChildAvailabilityStatusesListOptionalParams
116
+ ): Promise<ChildAvailabilityStatusesListResponse> {
117
+ return this.client.sendOperationRequest(
118
+ { resourceUri, options },
119
+ listOperationSpec
120
+ );
121
+ }
122
+
110
123
  /**
111
- * @param nextPageLink The NextLink from the previous successful call to List operation.
112
- * @param options The optional parameters
113
- * @param callback The callback
124
+ * ListNext
125
+ * @param resourceUri The fully qualified ID of the resource, including the resource name and resource
126
+ * type. Currently the API only support one nesting level resource types :
127
+ * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}
128
+ * @param nextLink The nextLink from the previous successful call to the List method.
129
+ * @param options The options parameters.
114
130
  */
115
- listNext(nextPageLink: string, options: Models.ChildAvailabilityStatusesListNextOptionalParams, callback: msRest.ServiceCallback<Models.AvailabilityStatusListResult>): void;
116
- listNext(nextPageLink: string, options?: Models.ChildAvailabilityStatusesListNextOptionalParams | msRest.ServiceCallback<Models.AvailabilityStatusListResult>, callback?: msRest.ServiceCallback<Models.AvailabilityStatusListResult>): Promise<Models.ChildAvailabilityStatusesListNextResponse> {
131
+ private _listNext(
132
+ resourceUri: string,
133
+ nextLink: string,
134
+ options?: ChildAvailabilityStatusesListNextOptionalParams
135
+ ): Promise<ChildAvailabilityStatusesListNextResponse> {
117
136
  return this.client.sendOperationRequest(
118
- {
119
- nextPageLink,
120
- options
121
- },
122
- listNextOperationSpec,
123
- callback) as Promise<Models.ChildAvailabilityStatusesListNextResponse>;
137
+ { resourceUri, nextLink, options },
138
+ listNextOperationSpec
139
+ );
124
140
  }
125
141
  }
126
-
127
142
  // Operation Specifications
128
- const serializer = new msRest.Serializer(Mappers);
129
- const getByResourceOperationSpec: msRest.OperationSpec = {
143
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
144
+
145
+ const getByResourceOperationSpec: coreClient.OperationSpec = {
146
+ path:
147
+ "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current",
130
148
  httpMethod: "GET",
131
- path: "{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current",
132
- urlParameters: [
133
- Parameters.resourceUri
134
- ],
135
- queryParameters: [
136
- Parameters.apiVersion,
137
- Parameters.filter,
138
- Parameters.expand
139
- ],
140
- headerParameters: [
141
- Parameters.acceptLanguage
142
- ],
143
149
  responses: {
144
150
  200: {
145
151
  bodyMapper: Mappers.AvailabilityStatus
@@ -148,23 +154,19 @@ const getByResourceOperationSpec: msRest.OperationSpec = {
148
154
  bodyMapper: Mappers.ErrorResponse
149
155
  }
150
156
  },
151
- serializer
152
- };
153
-
154
- const listOperationSpec: msRest.OperationSpec = {
155
- httpMethod: "GET",
156
- path: "{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses",
157
- urlParameters: [
158
- Parameters.resourceUri
159
- ],
160
157
  queryParameters: [
161
158
  Parameters.apiVersion,
162
159
  Parameters.filter,
163
160
  Parameters.expand
164
161
  ],
165
- headerParameters: [
166
- Parameters.acceptLanguage
167
- ],
162
+ urlParameters: [Parameters.$host, Parameters.resourceUri],
163
+ headerParameters: [Parameters.accept],
164
+ serializer
165
+ };
166
+ const listOperationSpec: coreClient.OperationSpec = {
167
+ path:
168
+ "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses",
169
+ httpMethod: "GET",
168
170
  responses: {
169
171
  200: {
170
172
  bodyMapper: Mappers.AvailabilityStatusListResult
@@ -173,24 +175,18 @@ const listOperationSpec: msRest.OperationSpec = {
173
175
  bodyMapper: Mappers.ErrorResponse
174
176
  }
175
177
  },
176
- serializer
177
- };
178
-
179
- const listNextOperationSpec: msRest.OperationSpec = {
180
- httpMethod: "GET",
181
- baseUrl: "https://management.azure.com",
182
- path: "{nextLink}",
183
- urlParameters: [
184
- Parameters.nextPageLink
185
- ],
186
178
  queryParameters: [
187
179
  Parameters.apiVersion,
188
180
  Parameters.filter,
189
181
  Parameters.expand
190
182
  ],
191
- headerParameters: [
192
- Parameters.acceptLanguage
193
- ],
183
+ urlParameters: [Parameters.$host, Parameters.resourceUri],
184
+ headerParameters: [Parameters.accept],
185
+ serializer
186
+ };
187
+ const listNextOperationSpec: coreClient.OperationSpec = {
188
+ path: "{nextLink}",
189
+ httpMethod: "GET",
194
190
  responses: {
195
191
  200: {
196
192
  bodyMapper: Mappers.AvailabilityStatusListResult
@@ -199,5 +195,16 @@ const listNextOperationSpec: msRest.OperationSpec = {
199
195
  bodyMapper: Mappers.ErrorResponse
200
196
  }
201
197
  },
198
+ queryParameters: [
199
+ Parameters.apiVersion,
200
+ Parameters.filter,
201
+ Parameters.expand
202
+ ],
203
+ urlParameters: [
204
+ Parameters.$host,
205
+ Parameters.resourceUri,
206
+ Parameters.nextLink
207
+ ],
208
+ headerParameters: [Parameters.accept],
202
209
  serializer
203
210
  };
@@ -3,23 +3,31 @@
3
3
  * Licensed under the MIT License.
4
4
  *
5
5
  * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is
7
- * regenerated.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
7
  */
9
8
 
10
- import * as msRest from "@azure/ms-rest-js";
11
- import * as Models from "../models";
12
- import * as Mappers from "../models/childResourcesMappers";
9
+ import { PagedAsyncIterableIterator } from "@azure/core-paging";
10
+ import { ChildResources } from "../operationsInterfaces";
11
+ import * as coreClient from "@azure/core-client";
12
+ import * as Mappers from "../models/mappers";
13
13
  import * as Parameters from "../models/parameters";
14
14
  import { MicrosoftResourceHealthContext } from "../microsoftResourceHealthContext";
15
+ import {
16
+ AvailabilityStatus,
17
+ ChildResourcesListNextOptionalParams,
18
+ ChildResourcesListOptionalParams,
19
+ ChildResourcesListResponse,
20
+ ChildResourcesListNextResponse
21
+ } from "../models";
15
22
 
16
- /** Class representing a ChildResources. */
17
- export class ChildResources {
23
+ /// <reference lib="esnext.asynciterable" />
24
+ /** Class containing ChildResources operations. */
25
+ export class ChildResourcesImpl implements ChildResources {
18
26
  private readonly client: MicrosoftResourceHealthContext;
19
27
 
20
28
  /**
21
- * Create a ChildResources.
22
- * @param {MicrosoftResourceHealthContext} client Reference to the service client.
29
+ * Initialize a new instance of the class ChildResources class.
30
+ * @param client Reference to the service client
23
31
  */
24
32
  constructor(client: MicrosoftResourceHealthContext) {
25
33
  this.client = client;
@@ -28,84 +36,95 @@ export class ChildResources {
28
36
  /**
29
37
  * Lists the all the children and its current health status for a parent resource. Use the nextLink
30
38
  * property in the response to get the next page of children current health
31
- * @param resourceUri The fully qualified ID of the resource, including the resource name and
32
- * resource type. Currently the API only support not nested parent resource type:
33
- * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}
34
- * @param [options] The optional parameters
35
- * @returns Promise<Models.ChildResourcesListResponse>
39
+ * @param resourceUri The fully qualified ID of the resource, including the resource name and resource
40
+ * type. Currently the API only support not nested parent resource type:
41
+ * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}
42
+ * @param options The options parameters.
36
43
  */
37
- list(resourceUri: string, options?: Models.ChildResourcesListOptionalParams): Promise<Models.ChildResourcesListResponse>;
38
- /**
39
- * @param resourceUri The fully qualified ID of the resource, including the resource name and
40
- * resource type. Currently the API only support not nested parent resource type:
41
- * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}
42
- * @param callback The callback
43
- */
44
- list(resourceUri: string, callback: msRest.ServiceCallback<Models.AvailabilityStatusListResult>): void;
45
- /**
46
- * @param resourceUri The fully qualified ID of the resource, including the resource name and
47
- * resource type. Currently the API only support not nested parent resource type:
48
- * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}
49
- * @param options The optional parameters
50
- * @param callback The callback
51
- */
52
- list(resourceUri: string, options: Models.ChildResourcesListOptionalParams, callback: msRest.ServiceCallback<Models.AvailabilityStatusListResult>): void;
53
- list(resourceUri: string, options?: Models.ChildResourcesListOptionalParams | msRest.ServiceCallback<Models.AvailabilityStatusListResult>, callback?: msRest.ServiceCallback<Models.AvailabilityStatusListResult>): Promise<Models.ChildResourcesListResponse> {
54
- return this.client.sendOperationRequest(
55
- {
56
- resourceUri,
57
- options
44
+ public list(
45
+ resourceUri: string,
46
+ options?: ChildResourcesListOptionalParams
47
+ ): PagedAsyncIterableIterator<AvailabilityStatus> {
48
+ const iter = this.listPagingAll(resourceUri, options);
49
+ return {
50
+ next() {
51
+ return iter.next();
52
+ },
53
+ [Symbol.asyncIterator]() {
54
+ return this;
58
55
  },
59
- listOperationSpec,
60
- callback) as Promise<Models.ChildResourcesListResponse>;
56
+ byPage: () => {
57
+ return this.listPagingPage(resourceUri, options);
58
+ }
59
+ };
60
+ }
61
+
62
+ private async *listPagingPage(
63
+ resourceUri: string,
64
+ options?: ChildResourcesListOptionalParams
65
+ ): AsyncIterableIterator<AvailabilityStatus[]> {
66
+ let result = await this._list(resourceUri, options);
67
+ yield result.value || [];
68
+ let continuationToken = result.nextLink;
69
+ while (continuationToken) {
70
+ result = await this._listNext(resourceUri, continuationToken, options);
71
+ continuationToken = result.nextLink;
72
+ yield result.value || [];
73
+ }
74
+ }
75
+
76
+ private async *listPagingAll(
77
+ resourceUri: string,
78
+ options?: ChildResourcesListOptionalParams
79
+ ): AsyncIterableIterator<AvailabilityStatus> {
80
+ for await (const page of this.listPagingPage(resourceUri, options)) {
81
+ yield* page;
82
+ }
61
83
  }
62
84
 
63
85
  /**
64
86
  * Lists the all the children and its current health status for a parent resource. Use the nextLink
65
87
  * property in the response to get the next page of children current health
66
- * @param nextPageLink The NextLink from the previous successful call to List operation.
67
- * @param [options] The optional parameters
68
- * @returns Promise<Models.ChildResourcesListNextResponse>
88
+ * @param resourceUri The fully qualified ID of the resource, including the resource name and resource
89
+ * type. Currently the API only support not nested parent resource type:
90
+ * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}
91
+ * @param options The options parameters.
69
92
  */
70
- listNext(nextPageLink: string, options?: Models.ChildResourcesListNextOptionalParams): Promise<Models.ChildResourcesListNextResponse>;
71
- /**
72
- * @param nextPageLink The NextLink from the previous successful call to List operation.
73
- * @param callback The callback
74
- */
75
- listNext(nextPageLink: string, callback: msRest.ServiceCallback<Models.AvailabilityStatusListResult>): void;
93
+ private _list(
94
+ resourceUri: string,
95
+ options?: ChildResourcesListOptionalParams
96
+ ): Promise<ChildResourcesListResponse> {
97
+ return this.client.sendOperationRequest(
98
+ { resourceUri, options },
99
+ listOperationSpec
100
+ );
101
+ }
102
+
76
103
  /**
77
- * @param nextPageLink The NextLink from the previous successful call to List operation.
78
- * @param options The optional parameters
79
- * @param callback The callback
104
+ * ListNext
105
+ * @param resourceUri The fully qualified ID of the resource, including the resource name and resource
106
+ * type. Currently the API only support not nested parent resource type:
107
+ * /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name}
108
+ * @param nextLink The nextLink from the previous successful call to the List method.
109
+ * @param options The options parameters.
80
110
  */
81
- listNext(nextPageLink: string, options: Models.ChildResourcesListNextOptionalParams, callback: msRest.ServiceCallback<Models.AvailabilityStatusListResult>): void;
82
- listNext(nextPageLink: string, options?: Models.ChildResourcesListNextOptionalParams | msRest.ServiceCallback<Models.AvailabilityStatusListResult>, callback?: msRest.ServiceCallback<Models.AvailabilityStatusListResult>): Promise<Models.ChildResourcesListNextResponse> {
111
+ private _listNext(
112
+ resourceUri: string,
113
+ nextLink: string,
114
+ options?: ChildResourcesListNextOptionalParams
115
+ ): Promise<ChildResourcesListNextResponse> {
83
116
  return this.client.sendOperationRequest(
84
- {
85
- nextPageLink,
86
- options
87
- },
88
- listNextOperationSpec,
89
- callback) as Promise<Models.ChildResourcesListNextResponse>;
117
+ { resourceUri, nextLink, options },
118
+ listNextOperationSpec
119
+ );
90
120
  }
91
121
  }
92
-
93
122
  // Operation Specifications
94
- const serializer = new msRest.Serializer(Mappers);
95
- const listOperationSpec: msRest.OperationSpec = {
123
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
124
+
125
+ const listOperationSpec: coreClient.OperationSpec = {
126
+ path: "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources",
96
127
  httpMethod: "GET",
97
- path: "{resourceUri}/providers/Microsoft.ResourceHealth/childResources",
98
- urlParameters: [
99
- Parameters.resourceUri
100
- ],
101
- queryParameters: [
102
- Parameters.apiVersion,
103
- Parameters.filter,
104
- Parameters.expand
105
- ],
106
- headerParameters: [
107
- Parameters.acceptLanguage
108
- ],
109
128
  responses: {
110
129
  200: {
111
130
  bodyMapper: Mappers.AvailabilityStatusListResult
@@ -114,24 +133,18 @@ const listOperationSpec: msRest.OperationSpec = {
114
133
  bodyMapper: Mappers.ErrorResponse
115
134
  }
116
135
  },
117
- serializer
118
- };
119
-
120
- const listNextOperationSpec: msRest.OperationSpec = {
121
- httpMethod: "GET",
122
- baseUrl: "https://management.azure.com",
123
- path: "{nextLink}",
124
- urlParameters: [
125
- Parameters.nextPageLink
126
- ],
127
136
  queryParameters: [
128
137
  Parameters.apiVersion,
129
138
  Parameters.filter,
130
139
  Parameters.expand
131
140
  ],
132
- headerParameters: [
133
- Parameters.acceptLanguage
134
- ],
141
+ urlParameters: [Parameters.$host, Parameters.resourceUri],
142
+ headerParameters: [Parameters.accept],
143
+ serializer
144
+ };
145
+ const listNextOperationSpec: coreClient.OperationSpec = {
146
+ path: "{nextLink}",
147
+ httpMethod: "GET",
135
148
  responses: {
136
149
  200: {
137
150
  bodyMapper: Mappers.AvailabilityStatusListResult
@@ -140,5 +153,16 @@ const listNextOperationSpec: msRest.OperationSpec = {
140
153
  bodyMapper: Mappers.ErrorResponse
141
154
  }
142
155
  },
156
+ queryParameters: [
157
+ Parameters.apiVersion,
158
+ Parameters.filter,
159
+ Parameters.expand
160
+ ],
161
+ urlParameters: [
162
+ Parameters.$host,
163
+ Parameters.resourceUri,
164
+ Parameters.nextLink
165
+ ],
166
+ headerParameters: [Parameters.accept],
143
167
  serializer
144
168
  };