@azure/arm-rediscache 30.0.0-alpha.20210928.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 (133) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +21 -0
  3. package/LICENSE.txt +21 -0
  4. package/README.md +94 -0
  5. package/dist/index.js +4051 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.min.js +1 -0
  8. package/dist/index.min.js.map +1 -0
  9. package/dist-esm/src/index.d.ts +6 -0
  10. package/dist-esm/src/index.d.ts.map +1 -0
  11. package/dist-esm/src/index.js +13 -0
  12. package/dist-esm/src/index.js.map +1 -0
  13. package/dist-esm/src/lroImpl.d.ts +16 -0
  14. package/dist-esm/src/lroImpl.d.ts.map +1 -0
  15. package/dist-esm/src/lroImpl.js +29 -0
  16. package/dist-esm/src/lroImpl.js.map +1 -0
  17. package/dist-esm/src/models/index.d.ts +1016 -0
  18. package/dist-esm/src/models/index.d.ts.map +1 -0
  19. package/dist-esm/src/models/index.js +77 -0
  20. package/dist-esm/src/models/index.js.map +1 -0
  21. package/dist-esm/src/models/mappers.d.ts +49 -0
  22. package/dist-esm/src/models/mappers.d.ts.map +1 -0
  23. package/dist-esm/src/models/mappers.js +1580 -0
  24. package/dist-esm/src/models/mappers.js.map +1 -0
  25. package/dist-esm/src/models/parameters.d.ts +27 -0
  26. package/dist-esm/src/models/parameters.d.ts.map +1 -0
  27. package/dist-esm/src/models/parameters.js +198 -0
  28. package/dist-esm/src/models/parameters.js.map +1 -0
  29. package/dist-esm/src/operations/firewallRules.d.ts +63 -0
  30. package/dist-esm/src/operations/firewallRules.d.ts.map +1 -0
  31. package/dist-esm/src/operations/firewallRules.js +238 -0
  32. package/dist-esm/src/operations/firewallRules.js.map +1 -0
  33. package/dist-esm/src/operations/index.d.ts +8 -0
  34. package/dist-esm/src/operations/index.d.ts.map +1 -0
  35. package/dist-esm/src/operations/index.js +15 -0
  36. package/dist-esm/src/operations/index.js.map +1 -0
  37. package/dist-esm/src/operations/linkedServer.d.ts +73 -0
  38. package/dist-esm/src/operations/linkedServer.d.ts.map +1 -0
  39. package/dist-esm/src/operations/linkedServer.js +288 -0
  40. package/dist-esm/src/operations/linkedServer.js.map +1 -0
  41. package/dist-esm/src/operations/operations.d.ts +32 -0
  42. package/dist-esm/src/operations/operations.d.ts.map +1 -0
  43. package/dist-esm/src/operations/operations.js +120 -0
  44. package/dist-esm/src/operations/operations.js.map +1 -0
  45. package/dist-esm/src/operations/patchSchedules.d.ts +63 -0
  46. package/dist-esm/src/operations/patchSchedules.d.ts.map +1 -0
  47. package/dist-esm/src/operations/patchSchedules.js +238 -0
  48. package/dist-esm/src/operations/patchSchedules.js.map +1 -0
  49. package/dist-esm/src/operations/privateEndpointConnections.d.ts +69 -0
  50. package/dist-esm/src/operations/privateEndpointConnections.d.ts.map +1 -0
  51. package/dist-esm/src/operations/privateEndpointConnections.js +260 -0
  52. package/dist-esm/src/operations/privateEndpointConnections.js.map +1 -0
  53. package/dist-esm/src/operations/privateLinkResources.d.ts +30 -0
  54. package/dist-esm/src/operations/privateLinkResources.d.ts.map +1 -0
  55. package/dist-esm/src/operations/privateLinkResources.js +99 -0
  56. package/dist-esm/src/operations/privateLinkResources.js.map +1 -0
  57. package/dist-esm/src/operations/redis.d.ts +192 -0
  58. package/dist-esm/src/operations/redis.d.ts.map +1 -0
  59. package/dist-esm/src/operations/redis.js +840 -0
  60. package/dist-esm/src/operations/redis.js.map +1 -0
  61. package/dist-esm/src/operationsInterfaces/firewallRules.d.ts +38 -0
  62. package/dist-esm/src/operationsInterfaces/firewallRules.d.ts.map +1 -0
  63. package/dist-esm/src/operationsInterfaces/firewallRules.js +9 -0
  64. package/dist-esm/src/operationsInterfaces/firewallRules.js.map +1 -0
  65. package/dist-esm/src/operationsInterfaces/index.d.ts +8 -0
  66. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
  67. package/dist-esm/src/operationsInterfaces/index.js +15 -0
  68. package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
  69. package/dist-esm/src/operationsInterfaces/linkedServer.d.ts +48 -0
  70. package/dist-esm/src/operationsInterfaces/linkedServer.d.ts.map +1 -0
  71. package/dist-esm/src/operationsInterfaces/linkedServer.js +9 -0
  72. package/dist-esm/src/operationsInterfaces/linkedServer.js.map +1 -0
  73. package/dist-esm/src/operationsInterfaces/operations.d.ts +11 -0
  74. package/dist-esm/src/operationsInterfaces/operations.d.ts.map +1 -0
  75. package/dist-esm/src/operationsInterfaces/operations.js +9 -0
  76. package/dist-esm/src/operationsInterfaces/operations.js.map +1 -0
  77. package/dist-esm/src/operationsInterfaces/patchSchedules.d.ts +38 -0
  78. package/dist-esm/src/operationsInterfaces/patchSchedules.d.ts.map +1 -0
  79. package/dist-esm/src/operationsInterfaces/patchSchedules.js +9 -0
  80. package/dist-esm/src/operationsInterfaces/patchSchedules.js.map +1 -0
  81. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.d.ts +52 -0
  82. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.d.ts.map +1 -0
  83. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.js +9 -0
  84. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.js.map +1 -0
  85. package/dist-esm/src/operationsInterfaces/privateLinkResources.d.ts +13 -0
  86. package/dist-esm/src/operationsInterfaces/privateLinkResources.d.ts.map +1 -0
  87. package/dist-esm/src/operationsInterfaces/privateLinkResources.js +9 -0
  88. package/dist-esm/src/operationsInterfaces/privateLinkResources.js.map +1 -0
  89. package/dist-esm/src/operationsInterfaces/redis.d.ts +136 -0
  90. package/dist-esm/src/operationsInterfaces/redis.d.ts.map +1 -0
  91. package/dist-esm/src/operationsInterfaces/redis.js +9 -0
  92. package/dist-esm/src/operationsInterfaces/redis.js.map +1 -0
  93. package/dist-esm/src/redisManagementClient.d.ts +22 -0
  94. package/dist-esm/src/redisManagementClient.d.ts.map +1 -0
  95. package/dist-esm/src/redisManagementClient.js +29 -0
  96. package/dist-esm/src/redisManagementClient.js.map +1 -0
  97. package/dist-esm/src/redisManagementClientContext.d.ts +17 -0
  98. package/dist-esm/src/redisManagementClientContext.d.ts.map +1 -0
  99. package/dist-esm/src/redisManagementClientContext.js +50 -0
  100. package/dist-esm/src/redisManagementClientContext.js.map +1 -0
  101. package/dist-esm/test/redis_examples.d.ts +2 -0
  102. package/dist-esm/test/redis_examples.d.ts.map +1 -0
  103. package/dist-esm/test/redis_examples.js +209 -0
  104. package/dist-esm/test/redis_examples.js.map +1 -0
  105. package/package.json +103 -0
  106. package/review/arm-rediscache.api.md +879 -0
  107. package/rollup.config.js +188 -0
  108. package/src/index.ts +13 -0
  109. package/src/lroImpl.ts +34 -0
  110. package/src/models/index.ts +1154 -0
  111. package/src/models/mappers.ts +1709 -0
  112. package/src/models/parameters.ts +240 -0
  113. package/src/operations/firewallRules.ts +314 -0
  114. package/src/operations/index.ts +15 -0
  115. package/src/operations/linkedServer.ts +397 -0
  116. package/src/operations/operations.ts +137 -0
  117. package/src/operations/patchSchedules.ts +327 -0
  118. package/src/operations/privateEndpointConnections.ts +353 -0
  119. package/src/operations/privateLinkResources.ts +135 -0
  120. package/src/operations/redis.ts +1152 -0
  121. package/src/operationsInterfaces/firewallRules.ts +75 -0
  122. package/src/operationsInterfaces/index.ts +15 -0
  123. package/src/operationsInterfaces/linkedServer.ts +97 -0
  124. package/src/operationsInterfaces/operations.ts +22 -0
  125. package/src/operationsInterfaces/patchSchedules.ts +76 -0
  126. package/src/operationsInterfaces/privateEndpointConnections.ts +100 -0
  127. package/src/operationsInterfaces/privateLinkResources.ts +29 -0
  128. package/src/operationsInterfaces/redis.ts +250 -0
  129. package/src/redisManagementClient.ts +61 -0
  130. package/src/redisManagementClientContext.ts +71 -0
  131. package/tsconfig.json +19 -0
  132. package/types/arm-rediscache.d.ts +1509 -0
  133. package/types/tsdoc-metadata.json +11 -0
@@ -0,0 +1,397 @@
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
+ import { PagedAsyncIterableIterator } from "@azure/core-paging";
10
+ import { LinkedServer } from "../operationsInterfaces";
11
+ import * as coreClient from "@azure/core-client";
12
+ import * as Mappers from "../models/mappers";
13
+ import * as Parameters from "../models/parameters";
14
+ import { RedisManagementClientContext } from "../redisManagementClientContext";
15
+ import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
16
+ import { LroImpl } from "../lroImpl";
17
+ import {
18
+ RedisLinkedServerWithProperties,
19
+ LinkedServerListNextOptionalParams,
20
+ LinkedServerListOptionalParams,
21
+ RedisLinkedServerCreateParameters,
22
+ LinkedServerCreateOptionalParams,
23
+ LinkedServerCreateResponse,
24
+ LinkedServerDeleteOptionalParams,
25
+ LinkedServerGetOptionalParams,
26
+ LinkedServerGetResponse,
27
+ LinkedServerListResponse,
28
+ LinkedServerListNextResponse
29
+ } from "../models";
30
+
31
+ /// <reference lib="esnext.asynciterable" />
32
+ /** Class containing LinkedServer operations. */
33
+ export class LinkedServerImpl implements LinkedServer {
34
+ private readonly client: RedisManagementClientContext;
35
+
36
+ /**
37
+ * Initialize a new instance of the class LinkedServer class.
38
+ * @param client Reference to the service client
39
+ */
40
+ constructor(client: RedisManagementClientContext) {
41
+ this.client = client;
42
+ }
43
+
44
+ /**
45
+ * Gets the list of linked servers associated with this redis cache (requires Premium SKU).
46
+ * @param resourceGroupName The name of the resource group.
47
+ * @param name The name of the redis cache.
48
+ * @param options The options parameters.
49
+ */
50
+ public list(
51
+ resourceGroupName: string,
52
+ name: string,
53
+ options?: LinkedServerListOptionalParams
54
+ ): PagedAsyncIterableIterator<RedisLinkedServerWithProperties> {
55
+ const iter = this.listPagingAll(resourceGroupName, name, options);
56
+ return {
57
+ next() {
58
+ return iter.next();
59
+ },
60
+ [Symbol.asyncIterator]() {
61
+ return this;
62
+ },
63
+ byPage: () => {
64
+ return this.listPagingPage(resourceGroupName, name, options);
65
+ }
66
+ };
67
+ }
68
+
69
+ private async *listPagingPage(
70
+ resourceGroupName: string,
71
+ name: string,
72
+ options?: LinkedServerListOptionalParams
73
+ ): AsyncIterableIterator<RedisLinkedServerWithProperties[]> {
74
+ let result = await this._list(resourceGroupName, name, options);
75
+ yield result.value || [];
76
+ let continuationToken = result.nextLink;
77
+ while (continuationToken) {
78
+ result = await this._listNext(
79
+ resourceGroupName,
80
+ name,
81
+ continuationToken,
82
+ options
83
+ );
84
+ continuationToken = result.nextLink;
85
+ yield result.value || [];
86
+ }
87
+ }
88
+
89
+ private async *listPagingAll(
90
+ resourceGroupName: string,
91
+ name: string,
92
+ options?: LinkedServerListOptionalParams
93
+ ): AsyncIterableIterator<RedisLinkedServerWithProperties> {
94
+ for await (const page of this.listPagingPage(
95
+ resourceGroupName,
96
+ name,
97
+ options
98
+ )) {
99
+ yield* page;
100
+ }
101
+ }
102
+
103
+ /**
104
+ * Adds a linked server to the Redis cache (requires Premium SKU).
105
+ * @param resourceGroupName The name of the resource group.
106
+ * @param name The name of the Redis cache.
107
+ * @param linkedServerName The name of the linked server that is being added to the Redis cache.
108
+ * @param parameters Parameters supplied to the Create Linked server operation.
109
+ * @param options The options parameters.
110
+ */
111
+ async beginCreate(
112
+ resourceGroupName: string,
113
+ name: string,
114
+ linkedServerName: string,
115
+ parameters: RedisLinkedServerCreateParameters,
116
+ options?: LinkedServerCreateOptionalParams
117
+ ): Promise<
118
+ PollerLike<
119
+ PollOperationState<LinkedServerCreateResponse>,
120
+ LinkedServerCreateResponse
121
+ >
122
+ > {
123
+ const directSendOperation = async (
124
+ args: coreClient.OperationArguments,
125
+ spec: coreClient.OperationSpec
126
+ ): Promise<LinkedServerCreateResponse> => {
127
+ return this.client.sendOperationRequest(args, spec);
128
+ };
129
+ const sendOperation = async (
130
+ args: coreClient.OperationArguments,
131
+ spec: coreClient.OperationSpec
132
+ ) => {
133
+ let currentRawResponse:
134
+ | coreClient.FullOperationResponse
135
+ | undefined = undefined;
136
+ const providedCallback = args.options?.onResponse;
137
+ const callback: coreClient.RawResponseCallback = (
138
+ rawResponse: coreClient.FullOperationResponse,
139
+ flatResponse: unknown
140
+ ) => {
141
+ currentRawResponse = rawResponse;
142
+ providedCallback?.(rawResponse, flatResponse);
143
+ };
144
+ const updatedArgs = {
145
+ ...args,
146
+ options: {
147
+ ...args.options,
148
+ onResponse: callback
149
+ }
150
+ };
151
+ const flatResponse = await directSendOperation(updatedArgs, spec);
152
+ return {
153
+ flatResponse,
154
+ rawResponse: {
155
+ statusCode: currentRawResponse!.status,
156
+ body: currentRawResponse!.parsedBody,
157
+ headers: currentRawResponse!.headers.toJSON()
158
+ }
159
+ };
160
+ };
161
+
162
+ const lro = new LroImpl(
163
+ sendOperation,
164
+ { resourceGroupName, name, linkedServerName, parameters, options },
165
+ createOperationSpec
166
+ );
167
+ return new LroEngine(lro, {
168
+ resumeFrom: options?.resumeFrom,
169
+ intervalInMs: options?.updateIntervalInMs
170
+ });
171
+ }
172
+
173
+ /**
174
+ * Adds a linked server to the Redis cache (requires Premium SKU).
175
+ * @param resourceGroupName The name of the resource group.
176
+ * @param name The name of the Redis cache.
177
+ * @param linkedServerName The name of the linked server that is being added to the Redis cache.
178
+ * @param parameters Parameters supplied to the Create Linked server operation.
179
+ * @param options The options parameters.
180
+ */
181
+ async beginCreateAndWait(
182
+ resourceGroupName: string,
183
+ name: string,
184
+ linkedServerName: string,
185
+ parameters: RedisLinkedServerCreateParameters,
186
+ options?: LinkedServerCreateOptionalParams
187
+ ): Promise<LinkedServerCreateResponse> {
188
+ const poller = await this.beginCreate(
189
+ resourceGroupName,
190
+ name,
191
+ linkedServerName,
192
+ parameters,
193
+ options
194
+ );
195
+ return poller.pollUntilDone();
196
+ }
197
+
198
+ /**
199
+ * Deletes the linked server from a redis cache (requires Premium SKU).
200
+ * @param resourceGroupName The name of the resource group.
201
+ * @param name The name of the redis cache.
202
+ * @param linkedServerName The name of the linked server that is being added to the Redis cache.
203
+ * @param options The options parameters.
204
+ */
205
+ delete(
206
+ resourceGroupName: string,
207
+ name: string,
208
+ linkedServerName: string,
209
+ options?: LinkedServerDeleteOptionalParams
210
+ ): Promise<void> {
211
+ return this.client.sendOperationRequest(
212
+ { resourceGroupName, name, linkedServerName, options },
213
+ deleteOperationSpec
214
+ );
215
+ }
216
+
217
+ /**
218
+ * Gets the detailed information about a linked server of a redis cache (requires Premium SKU).
219
+ * @param resourceGroupName The name of the resource group.
220
+ * @param name The name of the redis cache.
221
+ * @param linkedServerName The name of the linked server.
222
+ * @param options The options parameters.
223
+ */
224
+ get(
225
+ resourceGroupName: string,
226
+ name: string,
227
+ linkedServerName: string,
228
+ options?: LinkedServerGetOptionalParams
229
+ ): Promise<LinkedServerGetResponse> {
230
+ return this.client.sendOperationRequest(
231
+ { resourceGroupName, name, linkedServerName, options },
232
+ getOperationSpec
233
+ );
234
+ }
235
+
236
+ /**
237
+ * Gets the list of linked servers associated with this redis cache (requires Premium SKU).
238
+ * @param resourceGroupName The name of the resource group.
239
+ * @param name The name of the redis cache.
240
+ * @param options The options parameters.
241
+ */
242
+ private _list(
243
+ resourceGroupName: string,
244
+ name: string,
245
+ options?: LinkedServerListOptionalParams
246
+ ): Promise<LinkedServerListResponse> {
247
+ return this.client.sendOperationRequest(
248
+ { resourceGroupName, name, options },
249
+ listOperationSpec
250
+ );
251
+ }
252
+
253
+ /**
254
+ * ListNext
255
+ * @param resourceGroupName The name of the resource group.
256
+ * @param name The name of the redis cache.
257
+ * @param nextLink The nextLink from the previous successful call to the List method.
258
+ * @param options The options parameters.
259
+ */
260
+ private _listNext(
261
+ resourceGroupName: string,
262
+ name: string,
263
+ nextLink: string,
264
+ options?: LinkedServerListNextOptionalParams
265
+ ): Promise<LinkedServerListNextResponse> {
266
+ return this.client.sendOperationRequest(
267
+ { resourceGroupName, name, nextLink, options },
268
+ listNextOperationSpec
269
+ );
270
+ }
271
+ }
272
+ // Operation Specifications
273
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
274
+
275
+ const createOperationSpec: coreClient.OperationSpec = {
276
+ path:
277
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}",
278
+ httpMethod: "PUT",
279
+ responses: {
280
+ 200: {
281
+ bodyMapper: Mappers.RedisLinkedServerWithProperties
282
+ },
283
+ 201: {
284
+ bodyMapper: Mappers.RedisLinkedServerWithProperties
285
+ },
286
+ 202: {
287
+ bodyMapper: Mappers.RedisLinkedServerWithProperties
288
+ },
289
+ 204: {
290
+ bodyMapper: Mappers.RedisLinkedServerWithProperties
291
+ },
292
+ default: {
293
+ bodyMapper: Mappers.ErrorResponse
294
+ }
295
+ },
296
+ requestBody: Parameters.parameters9,
297
+ queryParameters: [Parameters.apiVersion],
298
+ urlParameters: [
299
+ Parameters.$host,
300
+ Parameters.subscriptionId,
301
+ Parameters.resourceGroupName,
302
+ Parameters.name,
303
+ Parameters.linkedServerName
304
+ ],
305
+ headerParameters: [Parameters.accept, Parameters.contentType],
306
+ mediaType: "json",
307
+ serializer
308
+ };
309
+ const deleteOperationSpec: coreClient.OperationSpec = {
310
+ path:
311
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}",
312
+ httpMethod: "DELETE",
313
+ responses: {
314
+ 200: {},
315
+ 204: {},
316
+ default: {
317
+ bodyMapper: Mappers.ErrorResponse
318
+ }
319
+ },
320
+ queryParameters: [Parameters.apiVersion],
321
+ urlParameters: [
322
+ Parameters.$host,
323
+ Parameters.subscriptionId,
324
+ Parameters.resourceGroupName,
325
+ Parameters.name,
326
+ Parameters.linkedServerName
327
+ ],
328
+ headerParameters: [Parameters.accept],
329
+ serializer
330
+ };
331
+ const getOperationSpec: coreClient.OperationSpec = {
332
+ path:
333
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}",
334
+ httpMethod: "GET",
335
+ responses: {
336
+ 200: {
337
+ bodyMapper: Mappers.RedisLinkedServerWithProperties
338
+ },
339
+ default: {
340
+ bodyMapper: Mappers.ErrorResponse
341
+ }
342
+ },
343
+ queryParameters: [Parameters.apiVersion],
344
+ urlParameters: [
345
+ Parameters.$host,
346
+ Parameters.subscriptionId,
347
+ Parameters.resourceGroupName,
348
+ Parameters.name,
349
+ Parameters.linkedServerName
350
+ ],
351
+ headerParameters: [Parameters.accept],
352
+ serializer
353
+ };
354
+ const listOperationSpec: coreClient.OperationSpec = {
355
+ path:
356
+ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers",
357
+ httpMethod: "GET",
358
+ responses: {
359
+ 200: {
360
+ bodyMapper: Mappers.RedisLinkedServerWithPropertiesList
361
+ },
362
+ default: {
363
+ bodyMapper: Mappers.ErrorResponse
364
+ }
365
+ },
366
+ queryParameters: [Parameters.apiVersion],
367
+ urlParameters: [
368
+ Parameters.$host,
369
+ Parameters.subscriptionId,
370
+ Parameters.resourceGroupName,
371
+ Parameters.name
372
+ ],
373
+ headerParameters: [Parameters.accept],
374
+ serializer
375
+ };
376
+ const listNextOperationSpec: coreClient.OperationSpec = {
377
+ path: "{nextLink}",
378
+ httpMethod: "GET",
379
+ responses: {
380
+ 200: {
381
+ bodyMapper: Mappers.RedisLinkedServerWithPropertiesList
382
+ },
383
+ default: {
384
+ bodyMapper: Mappers.ErrorResponse
385
+ }
386
+ },
387
+ queryParameters: [Parameters.apiVersion],
388
+ urlParameters: [
389
+ Parameters.$host,
390
+ Parameters.nextLink,
391
+ Parameters.subscriptionId,
392
+ Parameters.resourceGroupName,
393
+ Parameters.name
394
+ ],
395
+ headerParameters: [Parameters.accept],
396
+ serializer
397
+ };
@@ -0,0 +1,137 @@
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
+ import { PagedAsyncIterableIterator } from "@azure/core-paging";
10
+ import { Operations } from "../operationsInterfaces";
11
+ import * as coreClient from "@azure/core-client";
12
+ import * as Mappers from "../models/mappers";
13
+ import * as Parameters from "../models/parameters";
14
+ import { RedisManagementClientContext } from "../redisManagementClientContext";
15
+ import {
16
+ Operation,
17
+ OperationsListNextOptionalParams,
18
+ OperationsListOptionalParams,
19
+ OperationsListResponse,
20
+ OperationsListNextResponse
21
+ } from "../models";
22
+
23
+ /// <reference lib="esnext.asynciterable" />
24
+ /** Class containing Operations operations. */
25
+ export class OperationsImpl implements Operations {
26
+ private readonly client: RedisManagementClientContext;
27
+
28
+ /**
29
+ * Initialize a new instance of the class Operations class.
30
+ * @param client Reference to the service client
31
+ */
32
+ constructor(client: RedisManagementClientContext) {
33
+ this.client = client;
34
+ }
35
+
36
+ /**
37
+ * Lists all of the available REST API operations of the Microsoft.Cache provider.
38
+ * @param options The options parameters.
39
+ */
40
+ public list(
41
+ options?: OperationsListOptionalParams
42
+ ): PagedAsyncIterableIterator<Operation> {
43
+ const iter = this.listPagingAll(options);
44
+ return {
45
+ next() {
46
+ return iter.next();
47
+ },
48
+ [Symbol.asyncIterator]() {
49
+ return this;
50
+ },
51
+ byPage: () => {
52
+ return this.listPagingPage(options);
53
+ }
54
+ };
55
+ }
56
+
57
+ private async *listPagingPage(
58
+ options?: OperationsListOptionalParams
59
+ ): AsyncIterableIterator<Operation[]> {
60
+ let result = await this._list(options);
61
+ yield result.value || [];
62
+ let continuationToken = result.nextLink;
63
+ while (continuationToken) {
64
+ result = await this._listNext(continuationToken, options);
65
+ continuationToken = result.nextLink;
66
+ yield result.value || [];
67
+ }
68
+ }
69
+
70
+ private async *listPagingAll(
71
+ options?: OperationsListOptionalParams
72
+ ): AsyncIterableIterator<Operation> {
73
+ for await (const page of this.listPagingPage(options)) {
74
+ yield* page;
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Lists all of the available REST API operations of the Microsoft.Cache provider.
80
+ * @param options The options parameters.
81
+ */
82
+ private _list(
83
+ options?: OperationsListOptionalParams
84
+ ): Promise<OperationsListResponse> {
85
+ return this.client.sendOperationRequest({ options }, listOperationSpec);
86
+ }
87
+
88
+ /**
89
+ * ListNext
90
+ * @param nextLink The nextLink from the previous successful call to the List method.
91
+ * @param options The options parameters.
92
+ */
93
+ private _listNext(
94
+ nextLink: string,
95
+ options?: OperationsListNextOptionalParams
96
+ ): Promise<OperationsListNextResponse> {
97
+ return this.client.sendOperationRequest(
98
+ { nextLink, options },
99
+ listNextOperationSpec
100
+ );
101
+ }
102
+ }
103
+ // Operation Specifications
104
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
105
+
106
+ const listOperationSpec: coreClient.OperationSpec = {
107
+ path: "/providers/Microsoft.Cache/operations",
108
+ httpMethod: "GET",
109
+ responses: {
110
+ 200: {
111
+ bodyMapper: Mappers.OperationListResult
112
+ },
113
+ default: {
114
+ bodyMapper: Mappers.ErrorResponse
115
+ }
116
+ },
117
+ queryParameters: [Parameters.apiVersion],
118
+ urlParameters: [Parameters.$host],
119
+ headerParameters: [Parameters.accept],
120
+ serializer
121
+ };
122
+ const listNextOperationSpec: coreClient.OperationSpec = {
123
+ path: "{nextLink}",
124
+ httpMethod: "GET",
125
+ responses: {
126
+ 200: {
127
+ bodyMapper: Mappers.OperationListResult
128
+ },
129
+ default: {
130
+ bodyMapper: Mappers.ErrorResponse
131
+ }
132
+ },
133
+ queryParameters: [Parameters.apiVersion],
134
+ urlParameters: [Parameters.$host, Parameters.nextLink],
135
+ headerParameters: [Parameters.accept],
136
+ serializer
137
+ };