@azure/arm-search 2.0.0 → 3.0.0-beta.1

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 (209) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/{LICENSE.txt → LICENSE} +1 -1
  3. package/README.md +70 -78
  4. package/dist/index.js +2926 -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 +5 -0
  9. package/dist-esm/src/index.d.ts.map +1 -0
  10. package/{esm/models/adminKeysMappers.js → dist-esm/src/index.js} +5 -2
  11. package/dist-esm/src/index.js.map +1 -0
  12. package/dist-esm/src/lroImpl.d.ts +16 -0
  13. package/dist-esm/src/lroImpl.d.ts.map +1 -0
  14. package/dist-esm/src/lroImpl.js +29 -0
  15. package/dist-esm/src/lroImpl.js.map +1 -0
  16. package/dist-esm/src/models/index.d.ts +692 -0
  17. package/dist-esm/src/models/index.d.ts.map +1 -0
  18. package/dist-esm/src/models/index.js +21 -0
  19. package/dist-esm/src/models/index.js.map +1 -0
  20. package/dist-esm/src/models/mappers.d.ts +35 -0
  21. package/dist-esm/src/models/mappers.d.ts.map +1 -0
  22. package/{esm → dist-esm/src}/models/mappers.js +503 -558
  23. package/dist-esm/src/models/mappers.js.map +1 -0
  24. package/dist-esm/src/models/parameters.d.ts +22 -0
  25. package/dist-esm/src/models/parameters.d.ts.map +1 -0
  26. package/{esm → dist-esm/src}/models/parameters.js +92 -47
  27. package/dist-esm/src/models/parameters.js.map +1 -0
  28. package/dist-esm/src/operations/adminKeys.d.ts +33 -0
  29. package/dist-esm/src/operations/adminKeys.d.ts.map +1 -0
  30. package/dist-esm/src/operations/adminKeys.js +90 -0
  31. package/dist-esm/src/operations/adminKeys.js.map +1 -0
  32. package/{esm → dist-esm/src}/operations/index.d.ts +0 -0
  33. package/dist-esm/src/operations/index.d.ts.map +1 -0
  34. package/{esm → dist-esm/src}/operations/index.js +1 -2
  35. package/dist-esm/src/operations/index.js.map +1 -0
  36. package/dist-esm/src/operations/operations.d.ts +26 -0
  37. package/dist-esm/src/operations/operations.d.ts.map +1 -0
  38. package/dist-esm/src/operations/operations.js +90 -0
  39. package/dist-esm/src/operations/operations.js.map +1 -0
  40. package/dist-esm/src/operations/privateEndpointConnections.d.ts +79 -0
  41. package/dist-esm/src/operations/privateEndpointConnections.d.ts.map +1 -0
  42. package/dist-esm/src/operations/privateEndpointConnections.js +273 -0
  43. package/dist-esm/src/operations/privateEndpointConnections.js.map +1 -0
  44. package/dist-esm/src/operations/privateLinkResources.d.ts +34 -0
  45. package/dist-esm/src/operations/privateLinkResources.d.ts.map +1 -0
  46. package/dist-esm/src/operations/privateLinkResources.js +103 -0
  47. package/dist-esm/src/operations/privateLinkResources.js.map +1 -0
  48. package/dist-esm/src/operations/queryKeys.d.ts +66 -0
  49. package/dist-esm/src/operations/queryKeys.d.ts.map +1 -0
  50. package/dist-esm/src/operations/queryKeys.js +213 -0
  51. package/dist-esm/src/operations/queryKeys.js.map +1 -0
  52. package/dist-esm/src/operations/services.d.ts +123 -0
  53. package/dist-esm/src/operations/services.d.ts.map +1 -0
  54. package/dist-esm/src/operations/services.js +475 -0
  55. package/dist-esm/src/operations/services.js.map +1 -0
  56. package/dist-esm/src/operations/sharedPrivateLinkResources.d.ts +107 -0
  57. package/dist-esm/src/operations/sharedPrivateLinkResources.d.ts.map +1 -0
  58. package/dist-esm/src/operations/sharedPrivateLinkResources.js +379 -0
  59. package/dist-esm/src/operations/sharedPrivateLinkResources.js.map +1 -0
  60. package/dist-esm/src/operationsInterfaces/adminKeys.d.ts +25 -0
  61. package/dist-esm/src/operationsInterfaces/adminKeys.d.ts.map +1 -0
  62. package/{src/models/adminKeysMappers.ts → dist-esm/src/operationsInterfaces/adminKeys.js} +2 -5
  63. package/dist-esm/src/operationsInterfaces/adminKeys.js.map +1 -0
  64. package/dist-esm/src/operationsInterfaces/index.d.ts +8 -0
  65. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
  66. package/dist-esm/src/operationsInterfaces/index.js +15 -0
  67. package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
  68. package/dist-esm/src/operationsInterfaces/operations.d.ts +11 -0
  69. package/dist-esm/src/operationsInterfaces/operations.d.ts.map +1 -0
  70. package/{src/models/queryKeysMappers.ts → dist-esm/src/operationsInterfaces/operations.js} +2 -6
  71. package/dist-esm/src/operationsInterfaces/operations.js.map +1 -0
  72. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.d.ts +50 -0
  73. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.d.ts.map +1 -0
  74. package/{src/models/operationsMappers.ts → dist-esm/src/operationsInterfaces/privateEndpointConnections.js} +2 -7
  75. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.js.map +1 -0
  76. package/dist-esm/src/operationsInterfaces/privateLinkResources.d.ts +15 -0
  77. package/dist-esm/src/operationsInterfaces/privateLinkResources.d.ts.map +1 -0
  78. package/dist-esm/src/operationsInterfaces/privateLinkResources.js +9 -0
  79. package/dist-esm/src/operationsInterfaces/privateLinkResources.js.map +1 -0
  80. package/dist-esm/src/operationsInterfaces/queryKeys.d.ts +37 -0
  81. package/dist-esm/src/operationsInterfaces/queryKeys.d.ts.map +1 -0
  82. package/dist-esm/src/operationsInterfaces/queryKeys.js +9 -0
  83. package/dist-esm/src/operationsInterfaces/queryKeys.js.map +1 -0
  84. package/dist-esm/src/operationsInterfaces/services.d.ts +85 -0
  85. package/dist-esm/src/operationsInterfaces/services.d.ts.map +1 -0
  86. package/{esm/models/index.js → dist-esm/src/operationsInterfaces/services.js} +2 -1
  87. package/dist-esm/src/operationsInterfaces/services.js.map +1 -0
  88. package/dist-esm/src/operationsInterfaces/sharedPrivateLinkResources.d.ts +78 -0
  89. package/dist-esm/src/operationsInterfaces/sharedPrivateLinkResources.d.ts.map +1 -0
  90. package/dist-esm/src/operationsInterfaces/sharedPrivateLinkResources.js +9 -0
  91. package/dist-esm/src/operationsInterfaces/sharedPrivateLinkResources.js.map +1 -0
  92. package/dist-esm/src/searchManagementClient.d.ts +25 -0
  93. package/dist-esm/src/searchManagementClient.d.ts.map +1 -0
  94. package/dist-esm/src/searchManagementClient.js +58 -0
  95. package/dist-esm/src/searchManagementClient.js.map +1 -0
  96. package/dist-esm/test/search_examples.d.ts +4 -0
  97. package/dist-esm/test/search_examples.d.ts.map +1 -0
  98. package/dist-esm/test/search_examples.js +163 -0
  99. package/dist-esm/test/search_examples.js.map +1 -0
  100. package/package.json +65 -32
  101. package/review/arm-search.api.md +600 -0
  102. package/rollup.config.js +181 -30
  103. package/{esm/models/queryKeysMappers.js → src/index.ts} +5 -2
  104. package/src/lroImpl.ts +34 -0
  105. package/src/models/index.ts +563 -1357
  106. package/src/models/mappers.ts +516 -575
  107. package/src/models/parameters.ts +122 -48
  108. package/src/operations/adminKeys.ts +65 -109
  109. package/src/operations/index.ts +1 -2
  110. package/src/operations/operations.ts +64 -39
  111. package/src/operations/privateEndpointConnections.ts +223 -235
  112. package/src/operations/privateLinkResources.ts +100 -54
  113. package/src/operations/queryKeys.ts +192 -190
  114. package/src/operations/services.ts +423 -409
  115. package/src/operations/sharedPrivateLinkResources.ts +390 -232
  116. package/src/operationsInterfaces/adminKeys.ts +48 -0
  117. package/src/operationsInterfaces/index.ts +15 -0
  118. package/src/operationsInterfaces/operations.ts +22 -0
  119. package/src/operationsInterfaces/privateEndpointConnections.ts +88 -0
  120. package/src/operationsInterfaces/privateLinkResources.ts +31 -0
  121. package/src/operationsInterfaces/queryKeys.ts +66 -0
  122. package/src/operationsInterfaces/services.ts +144 -0
  123. package/src/operationsInterfaces/sharedPrivateLinkResources.ts +131 -0
  124. package/src/searchManagementClient.ts +90 -46
  125. package/tsconfig.json +3 -3
  126. package/types/arm-search.d.ts +1104 -0
  127. package/types/tsdoc-metadata.json +11 -0
  128. package/dist/arm-search.js +0 -2737
  129. package/dist/arm-search.js.map +0 -1
  130. package/dist/arm-search.min.js +0 -1
  131. package/dist/arm-search.min.js.map +0 -1
  132. package/esm/models/adminKeysMappers.d.ts +0 -2
  133. package/esm/models/adminKeysMappers.d.ts.map +0 -1
  134. package/esm/models/adminKeysMappers.js.map +0 -1
  135. package/esm/models/index.d.ts +0 -1499
  136. package/esm/models/index.d.ts.map +0 -1
  137. package/esm/models/index.js.map +0 -1
  138. package/esm/models/mappers.d.ts +0 -38
  139. package/esm/models/mappers.d.ts.map +0 -1
  140. package/esm/models/mappers.js.map +0 -1
  141. package/esm/models/operationsMappers.d.ts +0 -2
  142. package/esm/models/operationsMappers.d.ts.map +0 -1
  143. package/esm/models/operationsMappers.js +0 -9
  144. package/esm/models/operationsMappers.js.map +0 -1
  145. package/esm/models/parameters.d.ts +0 -14
  146. package/esm/models/parameters.d.ts.map +0 -1
  147. package/esm/models/parameters.js.map +0 -1
  148. package/esm/models/privateEndpointConnectionsMappers.d.ts +0 -2
  149. package/esm/models/privateEndpointConnectionsMappers.d.ts.map +0 -1
  150. package/esm/models/privateEndpointConnectionsMappers.js +0 -9
  151. package/esm/models/privateEndpointConnectionsMappers.js.map +0 -1
  152. package/esm/models/privateLinkResourcesMappers.d.ts +0 -2
  153. package/esm/models/privateLinkResourcesMappers.d.ts.map +0 -1
  154. package/esm/models/privateLinkResourcesMappers.js +0 -9
  155. package/esm/models/privateLinkResourcesMappers.js.map +0 -1
  156. package/esm/models/queryKeysMappers.d.ts +0 -2
  157. package/esm/models/queryKeysMappers.d.ts.map +0 -1
  158. package/esm/models/queryKeysMappers.js.map +0 -1
  159. package/esm/models/servicesMappers.d.ts +0 -2
  160. package/esm/models/servicesMappers.d.ts.map +0 -1
  161. package/esm/models/servicesMappers.js +0 -9
  162. package/esm/models/servicesMappers.js.map +0 -1
  163. package/esm/models/sharedPrivateLinkResourcesMappers.d.ts +0 -2
  164. package/esm/models/sharedPrivateLinkResourcesMappers.d.ts.map +0 -1
  165. package/esm/models/sharedPrivateLinkResourcesMappers.js +0 -9
  166. package/esm/models/sharedPrivateLinkResourcesMappers.js.map +0 -1
  167. package/esm/operations/adminKeys.d.ts +0 -74
  168. package/esm/operations/adminKeys.d.ts.map +0 -1
  169. package/esm/operations/adminKeys.js +0 -92
  170. package/esm/operations/adminKeys.js.map +0 -1
  171. package/esm/operations/index.d.ts.map +0 -1
  172. package/esm/operations/index.js.map +0 -1
  173. package/esm/operations/operations.d.ts +0 -28
  174. package/esm/operations/operations.d.ts.map +0 -1
  175. package/esm/operations/operations.js +0 -50
  176. package/esm/operations/operations.js.map +0 -1
  177. package/esm/operations/privateEndpointConnections.d.ts +0 -161
  178. package/esm/operations/privateEndpointConnections.d.ts.map +0 -1
  179. package/esm/operations/privateEndpointConnections.js +0 -197
  180. package/esm/operations/privateEndpointConnections.js.map +0 -1
  181. package/esm/operations/privateLinkResources.d.ts +0 -40
  182. package/esm/operations/privateLinkResources.d.ts.map +0 -1
  183. package/esm/operations/privateLinkResources.js +0 -58
  184. package/esm/operations/privateLinkResources.js.map +0 -1
  185. package/esm/operations/queryKeys.d.ts +0 -120
  186. package/esm/operations/queryKeys.d.ts.map +0 -1
  187. package/esm/operations/queryKeys.js +0 -156
  188. package/esm/operations/queryKeys.js.map +0 -1
  189. package/esm/operations/services.d.ts +0 -225
  190. package/esm/operations/services.d.ts.map +0 -1
  191. package/esm/operations/services.js +0 -355
  192. package/esm/operations/services.js.map +0 -1
  193. package/esm/operations/sharedPrivateLinkResources.d.ts +0 -147
  194. package/esm/operations/sharedPrivateLinkResources.d.ts.map +0 -1
  195. package/esm/operations/sharedPrivateLinkResources.js +0 -255
  196. package/esm/operations/sharedPrivateLinkResources.js.map +0 -1
  197. package/esm/searchManagementClient.d.ts +0 -31
  198. package/esm/searchManagementClient.d.ts.map +0 -1
  199. package/esm/searchManagementClient.js +0 -44
  200. package/esm/searchManagementClient.js.map +0 -1
  201. package/esm/searchManagementClientContext.d.ts +0 -23
  202. package/esm/searchManagementClientContext.d.ts.map +0 -1
  203. package/esm/searchManagementClientContext.js +0 -61
  204. package/esm/searchManagementClientContext.js.map +0 -1
  205. package/src/models/privateEndpointConnectionsMappers.ts +0 -33
  206. package/src/models/privateLinkResourcesMappers.ts +0 -33
  207. package/src/models/servicesMappers.ts +0 -35
  208. package/src/models/sharedPrivateLinkResourcesMappers.ts +0 -33
  209. package/src/searchManagementClientContext.ts +0 -68
@@ -3,84 +3,122 @@
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/privateLinkResourcesMappers";
9
+ import { PagedAsyncIterableIterator } from "@azure/core-paging";
10
+ import { PrivateLinkResources } 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
- import { SearchManagementClientContext } from "../searchManagementClientContext";
14
+ import { SearchManagementClient } from "../searchManagementClient";
15
+ import {
16
+ PrivateLinkResource,
17
+ PrivateLinkResourcesListSupportedOptionalParams,
18
+ PrivateLinkResourcesListSupportedResponse
19
+ } from "../models";
15
20
 
16
- /** Class representing a PrivateLinkResources. */
17
- export class PrivateLinkResources {
18
- private readonly client: SearchManagementClientContext;
21
+ /// <reference lib="esnext.asynciterable" />
22
+ /** Class containing PrivateLinkResources operations. */
23
+ export class PrivateLinkResourcesImpl implements PrivateLinkResources {
24
+ private readonly client: SearchManagementClient;
19
25
 
20
26
  /**
21
- * Create a PrivateLinkResources.
22
- * @param {SearchManagementClientContext} client Reference to the service client.
27
+ * Initialize a new instance of the class PrivateLinkResources class.
28
+ * @param client Reference to the service client
23
29
  */
24
- constructor(client: SearchManagementClientContext) {
30
+ constructor(client: SearchManagementClient) {
25
31
  this.client = client;
26
32
  }
27
33
 
28
34
  /**
29
35
  * Gets a list of all supported private link resource types for the given service.
30
36
  * @param resourceGroupName The name of the resource group within the current subscription. You can
31
- * obtain this value from the Azure Resource Manager API or the portal.
37
+ * obtain this value from the Azure Resource Manager API or the portal.
32
38
  * @param searchServiceName The name of the Azure Cognitive Search service associated with the
33
- * specified resource group.
34
- * @param [options] The optional parameters
35
- * @returns Promise<Models.PrivateLinkResourcesListSupportedResponse>
39
+ * specified resource group.
40
+ * @param options The options parameters.
36
41
  */
37
- listSupported(resourceGroupName: string, searchServiceName: string, options?: Models.PrivateLinkResourcesListSupportedOptionalParams): Promise<Models.PrivateLinkResourcesListSupportedResponse>;
38
- /**
39
- * @param resourceGroupName The name of the resource group within the current subscription. You can
40
- * obtain this value from the Azure Resource Manager API or the portal.
41
- * @param searchServiceName The name of the Azure Cognitive Search service associated with the
42
- * specified resource group.
43
- * @param callback The callback
44
- */
45
- listSupported(resourceGroupName: string, searchServiceName: string, callback: msRest.ServiceCallback<Models.PrivateLinkResourcesResult>): void;
42
+ public listSupported(
43
+ resourceGroupName: string,
44
+ searchServiceName: string,
45
+ options?: PrivateLinkResourcesListSupportedOptionalParams
46
+ ): PagedAsyncIterableIterator<PrivateLinkResource> {
47
+ const iter = this.listSupportedPagingAll(
48
+ resourceGroupName,
49
+ searchServiceName,
50
+ options
51
+ );
52
+ return {
53
+ next() {
54
+ return iter.next();
55
+ },
56
+ [Symbol.asyncIterator]() {
57
+ return this;
58
+ },
59
+ byPage: () => {
60
+ return this.listSupportedPagingPage(
61
+ resourceGroupName,
62
+ searchServiceName,
63
+ options
64
+ );
65
+ }
66
+ };
67
+ }
68
+
69
+ private async *listSupportedPagingPage(
70
+ resourceGroupName: string,
71
+ searchServiceName: string,
72
+ options?: PrivateLinkResourcesListSupportedOptionalParams
73
+ ): AsyncIterableIterator<PrivateLinkResource[]> {
74
+ let result = await this._listSupported(
75
+ resourceGroupName,
76
+ searchServiceName,
77
+ options
78
+ );
79
+ yield result.value || [];
80
+ }
81
+
82
+ private async *listSupportedPagingAll(
83
+ resourceGroupName: string,
84
+ searchServiceName: string,
85
+ options?: PrivateLinkResourcesListSupportedOptionalParams
86
+ ): AsyncIterableIterator<PrivateLinkResource> {
87
+ for await (const page of this.listSupportedPagingPage(
88
+ resourceGroupName,
89
+ searchServiceName,
90
+ options
91
+ )) {
92
+ yield* page;
93
+ }
94
+ }
95
+
46
96
  /**
97
+ * Gets a list of all supported private link resource types for the given service.
47
98
  * @param resourceGroupName The name of the resource group within the current subscription. You can
48
- * obtain this value from the Azure Resource Manager API or the portal.
99
+ * obtain this value from the Azure Resource Manager API or the portal.
49
100
  * @param searchServiceName The name of the Azure Cognitive Search service associated with the
50
- * specified resource group.
51
- * @param options The optional parameters
52
- * @param callback The callback
101
+ * specified resource group.
102
+ * @param options The options parameters.
53
103
  */
54
- listSupported(resourceGroupName: string, searchServiceName: string, options: Models.PrivateLinkResourcesListSupportedOptionalParams, callback: msRest.ServiceCallback<Models.PrivateLinkResourcesResult>): void;
55
- listSupported(resourceGroupName: string, searchServiceName: string, options?: Models.PrivateLinkResourcesListSupportedOptionalParams | msRest.ServiceCallback<Models.PrivateLinkResourcesResult>, callback?: msRest.ServiceCallback<Models.PrivateLinkResourcesResult>): Promise<Models.PrivateLinkResourcesListSupportedResponse> {
104
+ private _listSupported(
105
+ resourceGroupName: string,
106
+ searchServiceName: string,
107
+ options?: PrivateLinkResourcesListSupportedOptionalParams
108
+ ): Promise<PrivateLinkResourcesListSupportedResponse> {
56
109
  return this.client.sendOperationRequest(
57
- {
58
- resourceGroupName,
59
- searchServiceName,
60
- options
61
- },
62
- listSupportedOperationSpec,
63
- callback) as Promise<Models.PrivateLinkResourcesListSupportedResponse>;
110
+ { resourceGroupName, searchServiceName, options },
111
+ listSupportedOperationSpec
112
+ );
64
113
  }
65
114
  }
66
-
67
115
  // Operation Specifications
68
- const serializer = new msRest.Serializer(Mappers);
69
- const listSupportedOperationSpec: msRest.OperationSpec = {
116
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
117
+
118
+ const listSupportedOperationSpec: coreClient.OperationSpec = {
119
+ path:
120
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateLinkResources",
70
121
  httpMethod: "GET",
71
- path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateLinkResources",
72
- urlParameters: [
73
- Parameters.subscriptionId,
74
- Parameters.resourceGroupName,
75
- Parameters.searchServiceName
76
- ],
77
- queryParameters: [
78
- Parameters.apiVersion
79
- ],
80
- headerParameters: [
81
- Parameters.acceptLanguage,
82
- Parameters.clientRequestId
83
- ],
84
122
  responses: {
85
123
  200: {
86
124
  bodyMapper: Mappers.PrivateLinkResourcesResult
@@ -89,5 +127,13 @@ const listSupportedOperationSpec: msRest.OperationSpec = {
89
127
  bodyMapper: Mappers.CloudError
90
128
  }
91
129
  },
130
+ queryParameters: [Parameters.apiVersion],
131
+ urlParameters: [
132
+ Parameters.$host,
133
+ Parameters.resourceGroupName,
134
+ Parameters.searchServiceName,
135
+ Parameters.subscriptionId
136
+ ],
137
+ headerParameters: [Parameters.accept, Parameters.clientRequestId],
92
138
  serializer
93
139
  };
@@ -3,199 +3,203 @@
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/queryKeysMappers";
9
+ import { PagedAsyncIterableIterator } from "@azure/core-paging";
10
+ import { QueryKeys } 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
- import { SearchManagementClientContext } from "../searchManagementClientContext";
14
+ import { SearchManagementClient } from "../searchManagementClient";
15
+ import {
16
+ QueryKey,
17
+ QueryKeysListBySearchServiceNextOptionalParams,
18
+ QueryKeysListBySearchServiceOptionalParams,
19
+ QueryKeysCreateOptionalParams,
20
+ QueryKeysCreateResponse,
21
+ QueryKeysListBySearchServiceResponse,
22
+ QueryKeysDeleteOptionalParams,
23
+ QueryKeysListBySearchServiceNextResponse
24
+ } from "../models";
15
25
 
16
- /** Class representing a QueryKeys. */
17
- export class QueryKeys {
18
- private readonly client: SearchManagementClientContext;
26
+ /// <reference lib="esnext.asynciterable" />
27
+ /** Class containing QueryKeys operations. */
28
+ export class QueryKeysImpl implements QueryKeys {
29
+ private readonly client: SearchManagementClient;
19
30
 
20
31
  /**
21
- * Create a QueryKeys.
22
- * @param {SearchManagementClientContext} client Reference to the service client.
32
+ * Initialize a new instance of the class QueryKeys class.
33
+ * @param client Reference to the service client
23
34
  */
24
- constructor(client: SearchManagementClientContext) {
35
+ constructor(client: SearchManagementClient) {
25
36
  this.client = client;
26
37
  }
27
38
 
28
39
  /**
29
- * Generates a new query key for the specified search service. You can create up to 50 query keys
30
- * per service.
31
- * @param resourceGroupName The name of the resource group within the current subscription. You can
32
- * obtain this value from the Azure Resource Manager API or the portal.
33
- * @param searchServiceName The name of the Azure Cognitive Search service associated with the
34
- * specified resource group.
35
- * @param name The name of the new query API key.
36
- * @param [options] The optional parameters
37
- * @returns Promise<Models.QueryKeysCreateResponse>
38
- */
39
- create(resourceGroupName: string, searchServiceName: string, name: string, options?: Models.QueryKeysCreateOptionalParams): Promise<Models.QueryKeysCreateResponse>;
40
- /**
41
- * @param resourceGroupName The name of the resource group within the current subscription. You can
42
- * obtain this value from the Azure Resource Manager API or the portal.
43
- * @param searchServiceName The name of the Azure Cognitive Search service associated with the
44
- * specified resource group.
45
- * @param name The name of the new query API key.
46
- * @param callback The callback
47
- */
48
- create(resourceGroupName: string, searchServiceName: string, name: string, callback: msRest.ServiceCallback<Models.QueryKey>): void;
49
- /**
40
+ * Returns the list of query API keys for the given Azure Cognitive Search service.
50
41
  * @param resourceGroupName The name of the resource group within the current subscription. You can
51
- * obtain this value from the Azure Resource Manager API or the portal.
42
+ * obtain this value from the Azure Resource Manager API or the portal.
52
43
  * @param searchServiceName The name of the Azure Cognitive Search service associated with the
53
- * specified resource group.
54
- * @param name The name of the new query API key.
55
- * @param options The optional parameters
56
- * @param callback The callback
44
+ * specified resource group.
45
+ * @param options The options parameters.
57
46
  */
58
- create(resourceGroupName: string, searchServiceName: string, name: string, options: Models.QueryKeysCreateOptionalParams, callback: msRest.ServiceCallback<Models.QueryKey>): void;
59
- create(resourceGroupName: string, searchServiceName: string, name: string, options?: Models.QueryKeysCreateOptionalParams | msRest.ServiceCallback<Models.QueryKey>, callback?: msRest.ServiceCallback<Models.QueryKey>): Promise<Models.QueryKeysCreateResponse> {
60
- return this.client.sendOperationRequest(
61
- {
62
- resourceGroupName,
63
- searchServiceName,
64
- name,
65
- options
47
+ public listBySearchService(
48
+ resourceGroupName: string,
49
+ searchServiceName: string,
50
+ options?: QueryKeysListBySearchServiceOptionalParams
51
+ ): PagedAsyncIterableIterator<QueryKey> {
52
+ const iter = this.listBySearchServicePagingAll(
53
+ resourceGroupName,
54
+ searchServiceName,
55
+ options
56
+ );
57
+ return {
58
+ next() {
59
+ return iter.next();
60
+ },
61
+ [Symbol.asyncIterator]() {
62
+ return this;
66
63
  },
67
- createOperationSpec,
68
- callback) as Promise<Models.QueryKeysCreateResponse>;
64
+ byPage: () => {
65
+ return this.listBySearchServicePagingPage(
66
+ resourceGroupName,
67
+ searchServiceName,
68
+ options
69
+ );
70
+ }
71
+ };
69
72
  }
70
73
 
71
- /**
72
- * Returns the list of query API keys for the given Azure Cognitive Search service.
73
- * @param resourceGroupName The name of the resource group within the current subscription. You can
74
- * obtain this value from the Azure Resource Manager API or the portal.
75
- * @param searchServiceName The name of the Azure Cognitive Search service associated with the
76
- * specified resource group.
77
- * @param [options] The optional parameters
78
- * @returns Promise<Models.QueryKeysListBySearchServiceResponse>
79
- */
80
- listBySearchService(resourceGroupName: string, searchServiceName: string, options?: Models.QueryKeysListBySearchServiceOptionalParams): Promise<Models.QueryKeysListBySearchServiceResponse>;
81
- /**
82
- * @param resourceGroupName The name of the resource group within the current subscription. You can
83
- * obtain this value from the Azure Resource Manager API or the portal.
84
- * @param searchServiceName The name of the Azure Cognitive Search service associated with the
85
- * specified resource group.
86
- * @param callback The callback
87
- */
88
- listBySearchService(resourceGroupName: string, searchServiceName: string, callback: msRest.ServiceCallback<Models.ListQueryKeysResult>): void;
89
- /**
90
- * @param resourceGroupName The name of the resource group within the current subscription. You can
91
- * obtain this value from the Azure Resource Manager API or the portal.
92
- * @param searchServiceName The name of the Azure Cognitive Search service associated with the
93
- * specified resource group.
94
- * @param options The optional parameters
95
- * @param callback The callback
96
- */
97
- listBySearchService(resourceGroupName: string, searchServiceName: string, options: Models.QueryKeysListBySearchServiceOptionalParams, callback: msRest.ServiceCallback<Models.ListQueryKeysResult>): void;
98
- listBySearchService(resourceGroupName: string, searchServiceName: string, options?: Models.QueryKeysListBySearchServiceOptionalParams | msRest.ServiceCallback<Models.ListQueryKeysResult>, callback?: msRest.ServiceCallback<Models.ListQueryKeysResult>): Promise<Models.QueryKeysListBySearchServiceResponse> {
99
- return this.client.sendOperationRequest(
100
- {
74
+ private async *listBySearchServicePagingPage(
75
+ resourceGroupName: string,
76
+ searchServiceName: string,
77
+ options?: QueryKeysListBySearchServiceOptionalParams
78
+ ): AsyncIterableIterator<QueryKey[]> {
79
+ let result = await this._listBySearchService(
80
+ resourceGroupName,
81
+ searchServiceName,
82
+ options
83
+ );
84
+ yield result.value || [];
85
+ let continuationToken = result.nextLink;
86
+ while (continuationToken) {
87
+ result = await this._listBySearchServiceNext(
101
88
  resourceGroupName,
102
89
  searchServiceName,
90
+ continuationToken,
103
91
  options
104
- },
105
- listBySearchServiceOperationSpec,
106
- callback) as Promise<Models.QueryKeysListBySearchServiceResponse>;
92
+ );
93
+ continuationToken = result.nextLink;
94
+ yield result.value || [];
95
+ }
96
+ }
97
+
98
+ private async *listBySearchServicePagingAll(
99
+ resourceGroupName: string,
100
+ searchServiceName: string,
101
+ options?: QueryKeysListBySearchServiceOptionalParams
102
+ ): AsyncIterableIterator<QueryKey> {
103
+ for await (const page of this.listBySearchServicePagingPage(
104
+ resourceGroupName,
105
+ searchServiceName,
106
+ options
107
+ )) {
108
+ yield* page;
109
+ }
107
110
  }
108
111
 
109
112
  /**
110
- * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process
111
- * for regenerating a query key is to delete and then recreate it.
113
+ * Generates a new query key for the specified search service. You can create up to 50 query keys per
114
+ * service.
112
115
  * @param resourceGroupName The name of the resource group within the current subscription. You can
113
- * obtain this value from the Azure Resource Manager API or the portal.
116
+ * obtain this value from the Azure Resource Manager API or the portal.
114
117
  * @param searchServiceName The name of the Azure Cognitive Search service associated with the
115
- * specified resource group.
116
- * @param key The query key to be deleted. Query keys are identified by value, not by name.
117
- * @param [options] The optional parameters
118
- * @returns Promise<msRest.RestResponse>
118
+ * specified resource group.
119
+ * @param name The name of the new query API key.
120
+ * @param options The options parameters.
119
121
  */
120
- deleteMethod(resourceGroupName: string, searchServiceName: string, key: string, options?: Models.QueryKeysDeleteMethodOptionalParams): Promise<msRest.RestResponse>;
122
+ create(
123
+ resourceGroupName: string,
124
+ searchServiceName: string,
125
+ name: string,
126
+ options?: QueryKeysCreateOptionalParams
127
+ ): Promise<QueryKeysCreateResponse> {
128
+ return this.client.sendOperationRequest(
129
+ { resourceGroupName, searchServiceName, name, options },
130
+ createOperationSpec
131
+ );
132
+ }
133
+
121
134
  /**
135
+ * Returns the list of query API keys for the given Azure Cognitive Search service.
122
136
  * @param resourceGroupName The name of the resource group within the current subscription. You can
123
- * obtain this value from the Azure Resource Manager API or the portal.
137
+ * obtain this value from the Azure Resource Manager API or the portal.
124
138
  * @param searchServiceName The name of the Azure Cognitive Search service associated with the
125
- * specified resource group.
126
- * @param key The query key to be deleted. Query keys are identified by value, not by name.
127
- * @param callback The callback
139
+ * specified resource group.
140
+ * @param options The options parameters.
128
141
  */
129
- deleteMethod(resourceGroupName: string, searchServiceName: string, key: string, callback: msRest.ServiceCallback<void>): void;
142
+ private _listBySearchService(
143
+ resourceGroupName: string,
144
+ searchServiceName: string,
145
+ options?: QueryKeysListBySearchServiceOptionalParams
146
+ ): Promise<QueryKeysListBySearchServiceResponse> {
147
+ return this.client.sendOperationRequest(
148
+ { resourceGroupName, searchServiceName, options },
149
+ listBySearchServiceOperationSpec
150
+ );
151
+ }
152
+
130
153
  /**
154
+ * Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for
155
+ * regenerating a query key is to delete and then recreate it.
131
156
  * @param resourceGroupName The name of the resource group within the current subscription. You can
132
- * obtain this value from the Azure Resource Manager API or the portal.
157
+ * obtain this value from the Azure Resource Manager API or the portal.
133
158
  * @param searchServiceName The name of the Azure Cognitive Search service associated with the
134
- * specified resource group.
159
+ * specified resource group.
135
160
  * @param key The query key to be deleted. Query keys are identified by value, not by name.
136
- * @param options The optional parameters
137
- * @param callback The callback
161
+ * @param options The options parameters.
138
162
  */
139
- deleteMethod(resourceGroupName: string, searchServiceName: string, key: string, options: Models.QueryKeysDeleteMethodOptionalParams, callback: msRest.ServiceCallback<void>): void;
140
- deleteMethod(resourceGroupName: string, searchServiceName: string, key: string, options?: Models.QueryKeysDeleteMethodOptionalParams | msRest.ServiceCallback<void>, callback?: msRest.ServiceCallback<void>): Promise<msRest.RestResponse> {
163
+ delete(
164
+ resourceGroupName: string,
165
+ searchServiceName: string,
166
+ key: string,
167
+ options?: QueryKeysDeleteOptionalParams
168
+ ): Promise<void> {
141
169
  return this.client.sendOperationRequest(
142
- {
143
- resourceGroupName,
144
- searchServiceName,
145
- key,
146
- options
147
- },
148
- deleteMethodOperationSpec,
149
- callback);
170
+ { resourceGroupName, searchServiceName, key, options },
171
+ deleteOperationSpec
172
+ );
150
173
  }
151
174
 
152
175
  /**
153
- * Returns the list of query API keys for the given Azure Cognitive Search service.
154
- * @param nextPageLink The NextLink from the previous successful call to List operation.
155
- * @param [options] The optional parameters
156
- * @returns Promise<Models.QueryKeysListBySearchServiceNextResponse>
157
- */
158
- listBySearchServiceNext(nextPageLink: string, options?: Models.QueryKeysListBySearchServiceNextOptionalParams): Promise<Models.QueryKeysListBySearchServiceNextResponse>;
159
- /**
160
- * @param nextPageLink The NextLink from the previous successful call to List operation.
161
- * @param callback The callback
162
- */
163
- listBySearchServiceNext(nextPageLink: string, callback: msRest.ServiceCallback<Models.ListQueryKeysResult>): void;
164
- /**
165
- * @param nextPageLink The NextLink from the previous successful call to List operation.
166
- * @param options The optional parameters
167
- * @param callback The callback
176
+ * ListBySearchServiceNext
177
+ * @param resourceGroupName The name of the resource group within the current subscription. You can
178
+ * obtain this value from the Azure Resource Manager API or the portal.
179
+ * @param searchServiceName The name of the Azure Cognitive Search service associated with the
180
+ * specified resource group.
181
+ * @param nextLink The nextLink from the previous successful call to the ListBySearchService method.
182
+ * @param options The options parameters.
168
183
  */
169
- listBySearchServiceNext(nextPageLink: string, options: Models.QueryKeysListBySearchServiceNextOptionalParams, callback: msRest.ServiceCallback<Models.ListQueryKeysResult>): void;
170
- listBySearchServiceNext(nextPageLink: string, options?: Models.QueryKeysListBySearchServiceNextOptionalParams | msRest.ServiceCallback<Models.ListQueryKeysResult>, callback?: msRest.ServiceCallback<Models.ListQueryKeysResult>): Promise<Models.QueryKeysListBySearchServiceNextResponse> {
184
+ private _listBySearchServiceNext(
185
+ resourceGroupName: string,
186
+ searchServiceName: string,
187
+ nextLink: string,
188
+ options?: QueryKeysListBySearchServiceNextOptionalParams
189
+ ): Promise<QueryKeysListBySearchServiceNextResponse> {
171
190
  return this.client.sendOperationRequest(
172
- {
173
- nextPageLink,
174
- options
175
- },
176
- listBySearchServiceNextOperationSpec,
177
- callback) as Promise<Models.QueryKeysListBySearchServiceNextResponse>;
191
+ { resourceGroupName, searchServiceName, nextLink, options },
192
+ listBySearchServiceNextOperationSpec
193
+ );
178
194
  }
179
195
  }
180
-
181
196
  // Operation Specifications
182
- const serializer = new msRest.Serializer(Mappers);
183
- const createOperationSpec: msRest.OperationSpec = {
197
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
198
+
199
+ const createOperationSpec: coreClient.OperationSpec = {
200
+ path:
201
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}",
184
202
  httpMethod: "POST",
185
- path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}",
186
- urlParameters: [
187
- Parameters.resourceGroupName,
188
- Parameters.searchServiceName,
189
- Parameters.name,
190
- Parameters.subscriptionId
191
- ],
192
- queryParameters: [
193
- Parameters.apiVersion
194
- ],
195
- headerParameters: [
196
- Parameters.acceptLanguage,
197
- Parameters.clientRequestId
198
- ],
199
203
  responses: {
200
204
  200: {
201
205
  bodyMapper: Mappers.QueryKey
@@ -204,24 +208,21 @@ const createOperationSpec: msRest.OperationSpec = {
204
208
  bodyMapper: Mappers.CloudError
205
209
  }
206
210
  },
207
- serializer
208
- };
209
-
210
- const listBySearchServiceOperationSpec: msRest.OperationSpec = {
211
- httpMethod: "POST",
212
- path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys",
211
+ queryParameters: [Parameters.apiVersion],
213
212
  urlParameters: [
213
+ Parameters.$host,
214
214
  Parameters.resourceGroupName,
215
215
  Parameters.searchServiceName,
216
- Parameters.subscriptionId
217
- ],
218
- queryParameters: [
219
- Parameters.apiVersion
220
- ],
221
- headerParameters: [
222
- Parameters.acceptLanguage,
223
- Parameters.clientRequestId
216
+ Parameters.subscriptionId,
217
+ Parameters.name
224
218
  ],
219
+ headerParameters: [Parameters.accept, Parameters.clientRequestId],
220
+ serializer
221
+ };
222
+ const listBySearchServiceOperationSpec: coreClient.OperationSpec = {
223
+ path:
224
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys",
225
+ httpMethod: "POST",
225
226
  responses: {
226
227
  200: {
227
228
  bodyMapper: Mappers.ListQueryKeysResult
@@ -230,25 +231,20 @@ const listBySearchServiceOperationSpec: msRest.OperationSpec = {
230
231
  bodyMapper: Mappers.CloudError
231
232
  }
232
233
  },
233
- serializer
234
- };
235
-
236
- const deleteMethodOperationSpec: msRest.OperationSpec = {
237
- httpMethod: "DELETE",
238
- path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}",
234
+ queryParameters: [Parameters.apiVersion],
239
235
  urlParameters: [
236
+ Parameters.$host,
240
237
  Parameters.resourceGroupName,
241
238
  Parameters.searchServiceName,
242
- Parameters.key,
243
239
  Parameters.subscriptionId
244
240
  ],
245
- queryParameters: [
246
- Parameters.apiVersion
247
- ],
248
- headerParameters: [
249
- Parameters.acceptLanguage,
250
- Parameters.clientRequestId
251
- ],
241
+ headerParameters: [Parameters.accept, Parameters.clientRequestId],
242
+ serializer
243
+ };
244
+ const deleteOperationSpec: coreClient.OperationSpec = {
245
+ path:
246
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}",
247
+ httpMethod: "DELETE",
252
248
  responses: {
253
249
  200: {},
254
250
  204: {},
@@ -257,23 +253,20 @@ const deleteMethodOperationSpec: msRest.OperationSpec = {
257
253
  bodyMapper: Mappers.CloudError
258
254
  }
259
255
  },
256
+ queryParameters: [Parameters.apiVersion],
257
+ urlParameters: [
258
+ Parameters.$host,
259
+ Parameters.resourceGroupName,
260
+ Parameters.searchServiceName,
261
+ Parameters.subscriptionId,
262
+ Parameters.key
263
+ ],
264
+ headerParameters: [Parameters.accept, Parameters.clientRequestId],
260
265
  serializer
261
266
  };
262
-
263
- const listBySearchServiceNextOperationSpec: msRest.OperationSpec = {
264
- httpMethod: "POST",
265
- baseUrl: "https://management.azure.com",
267
+ const listBySearchServiceNextOperationSpec: coreClient.OperationSpec = {
266
268
  path: "{nextLink}",
267
- urlParameters: [
268
- Parameters.nextPageLink
269
- ],
270
- queryParameters: [
271
- Parameters.apiVersion
272
- ],
273
- headerParameters: [
274
- Parameters.acceptLanguage,
275
- Parameters.clientRequestId
276
- ],
269
+ httpMethod: "GET",
277
270
  responses: {
278
271
  200: {
279
272
  bodyMapper: Mappers.ListQueryKeysResult
@@ -282,5 +275,14 @@ const listBySearchServiceNextOperationSpec: msRest.OperationSpec = {
282
275
  bodyMapper: Mappers.CloudError
283
276
  }
284
277
  },
278
+ queryParameters: [Parameters.apiVersion],
279
+ urlParameters: [
280
+ Parameters.$host,
281
+ Parameters.resourceGroupName,
282
+ Parameters.searchServiceName,
283
+ Parameters.subscriptionId,
284
+ Parameters.nextLink
285
+ ],
286
+ headerParameters: [Parameters.accept, Parameters.clientRequestId],
285
287
  serializer
286
288
  };