@azure/arm-cognitiveservices 7.4.1-alpha.20230724.1 → 7.5.0

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 (155) hide show
  1. package/CHANGELOG.md +37 -10
  2. package/dist/index.js +770 -166
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.min.js +1 -1
  5. package/dist/index.min.js.map +1 -1
  6. package/dist-esm/samples-dev/accountsCreateSample.js +2 -2
  7. package/dist-esm/samples-dev/accountsDeleteSample.js +1 -1
  8. package/dist-esm/samples-dev/accountsGetSample.js +1 -1
  9. package/dist-esm/samples-dev/accountsListByResourceGroupSample.js +1 -1
  10. package/dist-esm/samples-dev/accountsListKeysSample.js +1 -1
  11. package/dist-esm/samples-dev/accountsListModelsSample.js +1 -1
  12. package/dist-esm/samples-dev/accountsListSample.js +1 -1
  13. package/dist-esm/samples-dev/accountsListSkusSample.js +1 -1
  14. package/dist-esm/samples-dev/accountsListUsagesSample.js +1 -1
  15. package/dist-esm/samples-dev/accountsRegenerateKeySample.js +1 -1
  16. package/dist-esm/samples-dev/accountsUpdateSample.js +1 -1
  17. package/dist-esm/samples-dev/checkDomainAvailabilitySample.js +1 -1
  18. package/dist-esm/samples-dev/checkSkuAvailabilitySample.js +1 -1
  19. package/dist-esm/samples-dev/commitmentPlansCreateOrUpdateAssociationSample.js +1 -1
  20. package/dist-esm/samples-dev/commitmentPlansCreateOrUpdatePlanSample.js +1 -1
  21. package/dist-esm/samples-dev/commitmentPlansCreateOrUpdateSample.js +1 -1
  22. package/dist-esm/samples-dev/commitmentPlansDeleteAssociationSample.js +1 -1
  23. package/dist-esm/samples-dev/commitmentPlansDeletePlanSample.js +1 -1
  24. package/dist-esm/samples-dev/commitmentPlansDeleteSample.js +1 -1
  25. package/dist-esm/samples-dev/commitmentPlansGetAssociationSample.js +1 -1
  26. package/dist-esm/samples-dev/commitmentPlansGetPlanSample.js +1 -1
  27. package/dist-esm/samples-dev/commitmentPlansGetSample.js +1 -1
  28. package/dist-esm/samples-dev/commitmentPlansListAssociationsSample.js +1 -1
  29. package/dist-esm/samples-dev/commitmentPlansListPlansByResourceGroupSample.js +1 -1
  30. package/dist-esm/samples-dev/commitmentPlansListPlansBySubscriptionSample.js +1 -1
  31. package/dist-esm/samples-dev/commitmentPlansListSample.js +1 -1
  32. package/dist-esm/samples-dev/commitmentPlansUpdatePlanSample.js +1 -1
  33. package/dist-esm/samples-dev/commitmentTiersListSample.js +1 -1
  34. package/dist-esm/samples-dev/deletedAccountsGetSample.js +1 -1
  35. package/dist-esm/samples-dev/deletedAccountsListSample.js +1 -1
  36. package/dist-esm/samples-dev/deletedAccountsPurgeSample.js +1 -1
  37. package/dist-esm/samples-dev/deploymentsCreateOrUpdateSample.js +3 -5
  38. package/dist-esm/samples-dev/deploymentsCreateOrUpdateSample.js.map +1 -1
  39. package/dist-esm/samples-dev/deploymentsDeleteSample.js +1 -1
  40. package/dist-esm/samples-dev/deploymentsGetSample.js +1 -1
  41. package/dist-esm/samples-dev/deploymentsListSample.js +1 -1
  42. package/dist-esm/samples-dev/modelsListSample.d.ts +2 -0
  43. package/dist-esm/samples-dev/modelsListSample.d.ts.map +1 -0
  44. package/dist-esm/samples-dev/modelsListSample.js +59 -0
  45. package/dist-esm/samples-dev/modelsListSample.js.map +1 -0
  46. package/dist-esm/samples-dev/operationsListSample.js +1 -1
  47. package/dist-esm/samples-dev/privateEndpointConnectionsCreateOrUpdateSample.js +1 -1
  48. package/dist-esm/samples-dev/privateEndpointConnectionsDeleteSample.js +1 -1
  49. package/dist-esm/samples-dev/privateEndpointConnectionsGetSample.js +1 -1
  50. package/dist-esm/samples-dev/privateEndpointConnectionsListSample.js +1 -1
  51. package/dist-esm/samples-dev/privateLinkResourcesListSample.js +1 -1
  52. package/dist-esm/samples-dev/resourceSkusListSample.js +1 -1
  53. package/dist-esm/samples-dev/usagesListSample.d.ts +2 -0
  54. package/dist-esm/samples-dev/usagesListSample.d.ts.map +1 -0
  55. package/dist-esm/samples-dev/usagesListSample.js +59 -0
  56. package/dist-esm/samples-dev/usagesListSample.js.map +1 -0
  57. package/dist-esm/src/cognitiveServicesManagementClient.d.ts +3 -1
  58. package/dist-esm/src/cognitiveServicesManagementClient.d.ts.map +1 -1
  59. package/dist-esm/src/cognitiveServicesManagementClient.js +5 -3
  60. package/dist-esm/src/cognitiveServicesManagementClient.js.map +1 -1
  61. package/dist-esm/src/lroImpl.d.ts +6 -11
  62. package/dist-esm/src/lroImpl.d.ts.map +1 -1
  63. package/dist-esm/src/lroImpl.js +12 -20
  64. package/dist-esm/src/lroImpl.js.map +1 -1
  65. package/dist-esm/src/models/index.d.ts +144 -5
  66. package/dist-esm/src/models/index.d.ts.map +1 -1
  67. package/dist-esm/src/models/index.js +24 -0
  68. package/dist-esm/src/models/index.js.map +1 -1
  69. package/dist-esm/src/models/mappers.d.ts +5 -0
  70. package/dist-esm/src/models/mappers.d.ts.map +1 -1
  71. package/dist-esm/src/models/mappers.js +229 -1
  72. package/dist-esm/src/models/mappers.js.map +1 -1
  73. package/dist-esm/src/models/parameters.js +1 -1
  74. package/dist-esm/src/operations/accounts.d.ts +4 -4
  75. package/dist-esm/src/operations/accounts.d.ts.map +1 -1
  76. package/dist-esm/src/operations/accounts.js +26 -14
  77. package/dist-esm/src/operations/accounts.js.map +1 -1
  78. package/dist-esm/src/operations/commitmentPlans.d.ts +7 -7
  79. package/dist-esm/src/operations/commitmentPlans.d.ts.map +1 -1
  80. package/dist-esm/src/operations/commitmentPlans.js +66 -42
  81. package/dist-esm/src/operations/commitmentPlans.js.map +1 -1
  82. package/dist-esm/src/operations/deletedAccounts.d.ts +2 -2
  83. package/dist-esm/src/operations/deletedAccounts.d.ts.map +1 -1
  84. package/dist-esm/src/operations/deletedAccounts.js +10 -6
  85. package/dist-esm/src/operations/deletedAccounts.js.map +1 -1
  86. package/dist-esm/src/operations/deployments.d.ts +3 -3
  87. package/dist-esm/src/operations/deployments.d.ts.map +1 -1
  88. package/dist-esm/src/operations/deployments.js +26 -11
  89. package/dist-esm/src/operations/deployments.js.map +1 -1
  90. package/dist-esm/src/operations/index.d.ts +2 -0
  91. package/dist-esm/src/operations/index.d.ts.map +1 -1
  92. package/dist-esm/src/operations/index.js +2 -0
  93. package/dist-esm/src/operations/index.js.map +1 -1
  94. package/dist-esm/src/operations/models.d.ts +35 -0
  95. package/dist-esm/src/operations/models.d.ts.map +1 -0
  96. package/dist-esm/src/operations/models.js +150 -0
  97. package/dist-esm/src/operations/models.js.map +1 -0
  98. package/dist-esm/src/operations/privateEndpointConnections.d.ts +3 -3
  99. package/dist-esm/src/operations/privateEndpointConnections.d.ts.map +1 -1
  100. package/dist-esm/src/operations/privateEndpointConnections.js +29 -21
  101. package/dist-esm/src/operations/privateEndpointConnections.js.map +1 -1
  102. package/dist-esm/src/operations/usages.d.ts +35 -0
  103. package/dist-esm/src/operations/usages.d.ts.map +1 -0
  104. package/dist-esm/src/operations/usages.js +150 -0
  105. package/dist-esm/src/operations/usages.js.map +1 -0
  106. package/dist-esm/src/operationsInterfaces/accounts.d.ts +4 -4
  107. package/dist-esm/src/operationsInterfaces/accounts.d.ts.map +1 -1
  108. package/dist-esm/src/operationsInterfaces/commitmentPlans.d.ts +7 -7
  109. package/dist-esm/src/operationsInterfaces/commitmentPlans.d.ts.map +1 -1
  110. package/dist-esm/src/operationsInterfaces/deletedAccounts.d.ts +2 -2
  111. package/dist-esm/src/operationsInterfaces/deletedAccounts.d.ts.map +1 -1
  112. package/dist-esm/src/operationsInterfaces/deployments.d.ts +3 -3
  113. package/dist-esm/src/operationsInterfaces/deployments.d.ts.map +1 -1
  114. package/dist-esm/src/operationsInterfaces/index.d.ts +2 -0
  115. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -1
  116. package/dist-esm/src/operationsInterfaces/index.js +2 -0
  117. package/dist-esm/src/operationsInterfaces/index.js.map +1 -1
  118. package/dist-esm/src/operationsInterfaces/models.d.ts +12 -0
  119. package/dist-esm/src/operationsInterfaces/models.d.ts.map +1 -0
  120. package/dist-esm/src/operationsInterfaces/models.js +9 -0
  121. package/dist-esm/src/operationsInterfaces/models.js.map +1 -0
  122. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.d.ts +3 -3
  123. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.d.ts.map +1 -1
  124. package/dist-esm/src/operationsInterfaces/usages.d.ts +12 -0
  125. package/dist-esm/src/operationsInterfaces/usages.d.ts.map +1 -0
  126. package/dist-esm/src/operationsInterfaces/usages.js +9 -0
  127. package/dist-esm/src/operationsInterfaces/usages.js.map +1 -0
  128. package/dist-esm/test/cognitiveservices_congitiveservice.spec.js +1 -1
  129. package/dist-esm/test/cognitiveservices_congitiveservice.spec.js.map +1 -1
  130. package/dist-esm/test/cognitiveservices_openai.spec.js +1 -2
  131. package/dist-esm/test/cognitiveservices_openai.spec.js.map +1 -1
  132. package/package.json +7 -7
  133. package/review/arm-cognitiveservices.api.md +127 -16
  134. package/src/cognitiveServicesManagementClient.ts +10 -2
  135. package/src/lroImpl.ts +31 -23
  136. package/src/models/index.ts +160 -5
  137. package/src/models/mappers.ts +236 -0
  138. package/src/models/parameters.ts +1 -1
  139. package/src/operations/accounts.ts +41 -31
  140. package/src/operations/commitmentPlans.ts +77 -64
  141. package/src/operations/deletedAccounts.ts +15 -11
  142. package/src/operations/deployments.ts +36 -22
  143. package/src/operations/index.ts +2 -0
  144. package/src/operations/models.ts +170 -0
  145. package/src/operations/privateEndpointConnections.ts +28 -21
  146. package/src/operations/usages.ts +170 -0
  147. package/src/operationsInterfaces/accounts.ts +6 -6
  148. package/src/operationsInterfaces/commitmentPlans.ts +10 -10
  149. package/src/operationsInterfaces/deletedAccounts.ts +2 -2
  150. package/src/operationsInterfaces/deployments.ts +4 -4
  151. package/src/operationsInterfaces/index.ts +2 -0
  152. package/src/operationsInterfaces/models.ts +24 -0
  153. package/src/operationsInterfaces/privateEndpointConnections.ts +4 -4
  154. package/src/operationsInterfaces/usages.ts +24 -0
  155. package/types/arm-cognitiveservices.d.ts +199 -21
@@ -0,0 +1,170 @@
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, PageSettings } from "@azure/core-paging";
10
+ import { setContinuationToken } from "../pagingHelper";
11
+ import { Models } from "../operationsInterfaces";
12
+ import * as coreClient from "@azure/core-client";
13
+ import * as Mappers from "../models/mappers";
14
+ import * as Parameters from "../models/parameters";
15
+ import { CognitiveServicesManagementClient } from "../cognitiveServicesManagementClient";
16
+ import {
17
+ Model,
18
+ ModelsListNextOptionalParams,
19
+ ModelsListOptionalParams,
20
+ ModelsListResponse,
21
+ ModelsListNextResponse
22
+ } from "../models";
23
+
24
+ /// <reference lib="esnext.asynciterable" />
25
+ /** Class containing Models operations. */
26
+ export class ModelsImpl implements Models {
27
+ private readonly client: CognitiveServicesManagementClient;
28
+
29
+ /**
30
+ * Initialize a new instance of the class Models class.
31
+ * @param client Reference to the service client
32
+ */
33
+ constructor(client: CognitiveServicesManagementClient) {
34
+ this.client = client;
35
+ }
36
+
37
+ /**
38
+ * List Models.
39
+ * @param location Resource location.
40
+ * @param options The options parameters.
41
+ */
42
+ public list(
43
+ location: string,
44
+ options?: ModelsListOptionalParams
45
+ ): PagedAsyncIterableIterator<Model> {
46
+ const iter = this.listPagingAll(location, options);
47
+ return {
48
+ next() {
49
+ return iter.next();
50
+ },
51
+ [Symbol.asyncIterator]() {
52
+ return this;
53
+ },
54
+ byPage: (settings?: PageSettings) => {
55
+ if (settings?.maxPageSize) {
56
+ throw new Error("maxPageSize is not supported by this operation.");
57
+ }
58
+ return this.listPagingPage(location, options, settings);
59
+ }
60
+ };
61
+ }
62
+
63
+ private async *listPagingPage(
64
+ location: string,
65
+ options?: ModelsListOptionalParams,
66
+ settings?: PageSettings
67
+ ): AsyncIterableIterator<Model[]> {
68
+ let result: ModelsListResponse;
69
+ let continuationToken = settings?.continuationToken;
70
+ if (!continuationToken) {
71
+ result = await this._list(location, options);
72
+ let page = result.value || [];
73
+ continuationToken = result.nextLink;
74
+ setContinuationToken(page, continuationToken);
75
+ yield page;
76
+ }
77
+ while (continuationToken) {
78
+ result = await this._listNext(location, continuationToken, options);
79
+ continuationToken = result.nextLink;
80
+ let page = result.value || [];
81
+ setContinuationToken(page, continuationToken);
82
+ yield page;
83
+ }
84
+ }
85
+
86
+ private async *listPagingAll(
87
+ location: string,
88
+ options?: ModelsListOptionalParams
89
+ ): AsyncIterableIterator<Model> {
90
+ for await (const page of this.listPagingPage(location, options)) {
91
+ yield* page;
92
+ }
93
+ }
94
+
95
+ /**
96
+ * List Models.
97
+ * @param location Resource location.
98
+ * @param options The options parameters.
99
+ */
100
+ private _list(
101
+ location: string,
102
+ options?: ModelsListOptionalParams
103
+ ): Promise<ModelsListResponse> {
104
+ return this.client.sendOperationRequest(
105
+ { location, options },
106
+ listOperationSpec
107
+ );
108
+ }
109
+
110
+ /**
111
+ * ListNext
112
+ * @param location Resource location.
113
+ * @param nextLink The nextLink from the previous successful call to the List method.
114
+ * @param options The options parameters.
115
+ */
116
+ private _listNext(
117
+ location: string,
118
+ nextLink: string,
119
+ options?: ModelsListNextOptionalParams
120
+ ): Promise<ModelsListNextResponse> {
121
+ return this.client.sendOperationRequest(
122
+ { location, nextLink, options },
123
+ listNextOperationSpec
124
+ );
125
+ }
126
+ }
127
+ // Operation Specifications
128
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
129
+
130
+ const listOperationSpec: coreClient.OperationSpec = {
131
+ path:
132
+ "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/models",
133
+ httpMethod: "GET",
134
+ responses: {
135
+ 200: {
136
+ bodyMapper: Mappers.ModelListResult
137
+ },
138
+ default: {
139
+ bodyMapper: Mappers.ErrorResponse
140
+ }
141
+ },
142
+ queryParameters: [Parameters.apiVersion],
143
+ urlParameters: [
144
+ Parameters.$host,
145
+ Parameters.subscriptionId,
146
+ Parameters.location
147
+ ],
148
+ headerParameters: [Parameters.accept],
149
+ serializer
150
+ };
151
+ const listNextOperationSpec: coreClient.OperationSpec = {
152
+ path: "{nextLink}",
153
+ httpMethod: "GET",
154
+ responses: {
155
+ 200: {
156
+ bodyMapper: Mappers.ModelListResult
157
+ },
158
+ default: {
159
+ bodyMapper: Mappers.ErrorResponse
160
+ }
161
+ },
162
+ urlParameters: [
163
+ Parameters.$host,
164
+ Parameters.subscriptionId,
165
+ Parameters.nextLink,
166
+ Parameters.location
167
+ ],
168
+ headerParameters: [Parameters.accept],
169
+ serializer
170
+ };
@@ -11,8 +11,12 @@ import * as coreClient from "@azure/core-client";
11
11
  import * as Mappers from "../models/mappers";
12
12
  import * as Parameters from "../models/parameters";
13
13
  import { CognitiveServicesManagementClient } from "../cognitiveServicesManagementClient";
14
- import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
15
- import { LroImpl } from "../lroImpl";
14
+ import {
15
+ SimplePollerLike,
16
+ OperationState,
17
+ createHttpPoller
18
+ } from "@azure/core-lro";
19
+ import { createLroSpec } from "../lroImpl";
16
20
  import {
17
21
  PrivateEndpointConnectionsListOptionalParams,
18
22
  PrivateEndpointConnectionsListResponse,
@@ -96,8 +100,8 @@ export class PrivateEndpointConnectionsImpl
96
100
  properties: PrivateEndpointConnection,
97
101
  options?: PrivateEndpointConnectionsCreateOrUpdateOptionalParams
98
102
  ): Promise<
99
- PollerLike<
100
- PollOperationState<PrivateEndpointConnectionsCreateOrUpdateResponse>,
103
+ SimplePollerLike<
104
+ OperationState<PrivateEndpointConnectionsCreateOrUpdateResponse>,
101
105
  PrivateEndpointConnectionsCreateOrUpdateResponse
102
106
  >
103
107
  > {
@@ -107,7 +111,7 @@ export class PrivateEndpointConnectionsImpl
107
111
  ): Promise<PrivateEndpointConnectionsCreateOrUpdateResponse> => {
108
112
  return this.client.sendOperationRequest(args, spec);
109
113
  };
110
- const sendOperation = async (
114
+ const sendOperationFn = async (
111
115
  args: coreClient.OperationArguments,
112
116
  spec: coreClient.OperationSpec
113
117
  ) => {
@@ -140,19 +144,22 @@ export class PrivateEndpointConnectionsImpl
140
144
  };
141
145
  };
142
146
 
143
- const lro = new LroImpl(
144
- sendOperation,
145
- {
147
+ const lro = createLroSpec({
148
+ sendOperationFn,
149
+ args: {
146
150
  resourceGroupName,
147
151
  accountName,
148
152
  privateEndpointConnectionName,
149
153
  properties,
150
154
  options
151
155
  },
152
- createOrUpdateOperationSpec
153
- );
154
- const poller = new LroEngine(lro, {
155
- resumeFrom: options?.resumeFrom,
156
+ spec: createOrUpdateOperationSpec
157
+ });
158
+ const poller = await createHttpPoller<
159
+ PrivateEndpointConnectionsCreateOrUpdateResponse,
160
+ OperationState<PrivateEndpointConnectionsCreateOrUpdateResponse>
161
+ >(lro, {
162
+ restoreFrom: options?.resumeFrom,
156
163
  intervalInMs: options?.updateIntervalInMs
157
164
  });
158
165
  await poller.poll();
@@ -199,14 +206,14 @@ export class PrivateEndpointConnectionsImpl
199
206
  accountName: string,
200
207
  privateEndpointConnectionName: string,
201
208
  options?: PrivateEndpointConnectionsDeleteOptionalParams
202
- ): Promise<PollerLike<PollOperationState<void>, void>> {
209
+ ): Promise<SimplePollerLike<OperationState<void>, void>> {
203
210
  const directSendOperation = async (
204
211
  args: coreClient.OperationArguments,
205
212
  spec: coreClient.OperationSpec
206
213
  ): Promise<void> => {
207
214
  return this.client.sendOperationRequest(args, spec);
208
215
  };
209
- const sendOperation = async (
216
+ const sendOperationFn = async (
210
217
  args: coreClient.OperationArguments,
211
218
  spec: coreClient.OperationSpec
212
219
  ) => {
@@ -239,18 +246,18 @@ export class PrivateEndpointConnectionsImpl
239
246
  };
240
247
  };
241
248
 
242
- const lro = new LroImpl(
243
- sendOperation,
244
- {
249
+ const lro = createLroSpec({
250
+ sendOperationFn,
251
+ args: {
245
252
  resourceGroupName,
246
253
  accountName,
247
254
  privateEndpointConnectionName,
248
255
  options
249
256
  },
250
- deleteOperationSpec
251
- );
252
- const poller = new LroEngine(lro, {
253
- resumeFrom: options?.resumeFrom,
257
+ spec: deleteOperationSpec
258
+ });
259
+ const poller = await createHttpPoller<void, OperationState<void>>(lro, {
260
+ restoreFrom: options?.resumeFrom,
254
261
  intervalInMs: options?.updateIntervalInMs
255
262
  });
256
263
  await poller.poll();
@@ -0,0 +1,170 @@
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, PageSettings } from "@azure/core-paging";
10
+ import { setContinuationToken } from "../pagingHelper";
11
+ import { Usages } from "../operationsInterfaces";
12
+ import * as coreClient from "@azure/core-client";
13
+ import * as Mappers from "../models/mappers";
14
+ import * as Parameters from "../models/parameters";
15
+ import { CognitiveServicesManagementClient } from "../cognitiveServicesManagementClient";
16
+ import {
17
+ Usage,
18
+ UsagesListNextOptionalParams,
19
+ UsagesListOptionalParams,
20
+ UsagesListResponse,
21
+ UsagesListNextResponse
22
+ } from "../models";
23
+
24
+ /// <reference lib="esnext.asynciterable" />
25
+ /** Class containing Usages operations. */
26
+ export class UsagesImpl implements Usages {
27
+ private readonly client: CognitiveServicesManagementClient;
28
+
29
+ /**
30
+ * Initialize a new instance of the class Usages class.
31
+ * @param client Reference to the service client
32
+ */
33
+ constructor(client: CognitiveServicesManagementClient) {
34
+ this.client = client;
35
+ }
36
+
37
+ /**
38
+ * Get usages for the requested subscription
39
+ * @param location Resource location.
40
+ * @param options The options parameters.
41
+ */
42
+ public list(
43
+ location: string,
44
+ options?: UsagesListOptionalParams
45
+ ): PagedAsyncIterableIterator<Usage> {
46
+ const iter = this.listPagingAll(location, options);
47
+ return {
48
+ next() {
49
+ return iter.next();
50
+ },
51
+ [Symbol.asyncIterator]() {
52
+ return this;
53
+ },
54
+ byPage: (settings?: PageSettings) => {
55
+ if (settings?.maxPageSize) {
56
+ throw new Error("maxPageSize is not supported by this operation.");
57
+ }
58
+ return this.listPagingPage(location, options, settings);
59
+ }
60
+ };
61
+ }
62
+
63
+ private async *listPagingPage(
64
+ location: string,
65
+ options?: UsagesListOptionalParams,
66
+ settings?: PageSettings
67
+ ): AsyncIterableIterator<Usage[]> {
68
+ let result: UsagesListResponse;
69
+ let continuationToken = settings?.continuationToken;
70
+ if (!continuationToken) {
71
+ result = await this._list(location, options);
72
+ let page = result.value || [];
73
+ continuationToken = result.nextLink;
74
+ setContinuationToken(page, continuationToken);
75
+ yield page;
76
+ }
77
+ while (continuationToken) {
78
+ result = await this._listNext(location, continuationToken, options);
79
+ continuationToken = result.nextLink;
80
+ let page = result.value || [];
81
+ setContinuationToken(page, continuationToken);
82
+ yield page;
83
+ }
84
+ }
85
+
86
+ private async *listPagingAll(
87
+ location: string,
88
+ options?: UsagesListOptionalParams
89
+ ): AsyncIterableIterator<Usage> {
90
+ for await (const page of this.listPagingPage(location, options)) {
91
+ yield* page;
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Get usages for the requested subscription
97
+ * @param location Resource location.
98
+ * @param options The options parameters.
99
+ */
100
+ private _list(
101
+ location: string,
102
+ options?: UsagesListOptionalParams
103
+ ): Promise<UsagesListResponse> {
104
+ return this.client.sendOperationRequest(
105
+ { location, options },
106
+ listOperationSpec
107
+ );
108
+ }
109
+
110
+ /**
111
+ * ListNext
112
+ * @param location Resource location.
113
+ * @param nextLink The nextLink from the previous successful call to the List method.
114
+ * @param options The options parameters.
115
+ */
116
+ private _listNext(
117
+ location: string,
118
+ nextLink: string,
119
+ options?: UsagesListNextOptionalParams
120
+ ): Promise<UsagesListNextResponse> {
121
+ return this.client.sendOperationRequest(
122
+ { location, nextLink, options },
123
+ listNextOperationSpec
124
+ );
125
+ }
126
+ }
127
+ // Operation Specifications
128
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
129
+
130
+ const listOperationSpec: coreClient.OperationSpec = {
131
+ path:
132
+ "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/usages",
133
+ httpMethod: "GET",
134
+ responses: {
135
+ 200: {
136
+ bodyMapper: Mappers.UsageListResult
137
+ },
138
+ default: {
139
+ bodyMapper: Mappers.ErrorResponse
140
+ }
141
+ },
142
+ queryParameters: [Parameters.apiVersion, Parameters.filter],
143
+ urlParameters: [
144
+ Parameters.$host,
145
+ Parameters.subscriptionId,
146
+ Parameters.location
147
+ ],
148
+ headerParameters: [Parameters.accept],
149
+ serializer
150
+ };
151
+ const listNextOperationSpec: coreClient.OperationSpec = {
152
+ path: "{nextLink}",
153
+ httpMethod: "GET",
154
+ responses: {
155
+ 200: {
156
+ bodyMapper: Mappers.UsageListResult
157
+ },
158
+ default: {
159
+ bodyMapper: Mappers.ErrorResponse
160
+ }
161
+ },
162
+ urlParameters: [
163
+ Parameters.$host,
164
+ Parameters.subscriptionId,
165
+ Parameters.nextLink,
166
+ Parameters.location
167
+ ],
168
+ headerParameters: [Parameters.accept],
169
+ serializer
170
+ };
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { PagedAsyncIterableIterator } from "@azure/core-paging";
10
- import { PollerLike, PollOperationState } from "@azure/core-lro";
10
+ import { SimplePollerLike, OperationState } from "@azure/core-lro";
11
11
  import {
12
12
  Account,
13
13
  AccountsListByResourceGroupOptionalParams,
@@ -76,8 +76,8 @@ export interface Accounts {
76
76
  account: Account,
77
77
  options?: AccountsCreateOptionalParams
78
78
  ): Promise<
79
- PollerLike<
80
- PollOperationState<AccountsCreateResponse>,
79
+ SimplePollerLike<
80
+ OperationState<AccountsCreateResponse>,
81
81
  AccountsCreateResponse
82
82
  >
83
83
  >;
@@ -108,8 +108,8 @@ export interface Accounts {
108
108
  account: Account,
109
109
  options?: AccountsUpdateOptionalParams
110
110
  ): Promise<
111
- PollerLike<
112
- PollOperationState<AccountsUpdateResponse>,
111
+ SimplePollerLike<
112
+ OperationState<AccountsUpdateResponse>,
113
113
  AccountsUpdateResponse
114
114
  >
115
115
  >;
@@ -136,7 +136,7 @@ export interface Accounts {
136
136
  resourceGroupName: string,
137
137
  accountName: string,
138
138
  options?: AccountsDeleteOptionalParams
139
- ): Promise<PollerLike<PollOperationState<void>, void>>;
139
+ ): Promise<SimplePollerLike<OperationState<void>, void>>;
140
140
  /**
141
141
  * Deletes a Cognitive Services account from the resource group.
142
142
  * @param resourceGroupName The name of the resource group. The name is case insensitive.
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { PagedAsyncIterableIterator } from "@azure/core-paging";
10
- import { PollerLike, PollOperationState } from "@azure/core-lro";
10
+ import { SimplePollerLike, OperationState } from "@azure/core-lro";
11
11
  import {
12
12
  CommitmentPlan,
13
13
  CommitmentPlansListOptionalParams,
@@ -120,7 +120,7 @@ export interface CommitmentPlans {
120
120
  accountName: string,
121
121
  commitmentPlanName: string,
122
122
  options?: CommitmentPlansDeleteOptionalParams
123
- ): Promise<PollerLike<PollOperationState<void>, void>>;
123
+ ): Promise<SimplePollerLike<OperationState<void>, void>>;
124
124
  /**
125
125
  * Deletes the specified commitmentPlan associated with the Cognitive Services account.
126
126
  * @param resourceGroupName The name of the resource group. The name is case insensitive.
@@ -149,8 +149,8 @@ export interface CommitmentPlans {
149
149
  commitmentPlan: CommitmentPlan,
150
150
  options?: CommitmentPlansCreateOrUpdatePlanOptionalParams
151
151
  ): Promise<
152
- PollerLike<
153
- PollOperationState<CommitmentPlansCreateOrUpdatePlanResponse>,
152
+ SimplePollerLike<
153
+ OperationState<CommitmentPlansCreateOrUpdatePlanResponse>,
154
154
  CommitmentPlansCreateOrUpdatePlanResponse
155
155
  >
156
156
  >;
@@ -182,8 +182,8 @@ export interface CommitmentPlans {
182
182
  commitmentPlan: PatchResourceTagsAndSku,
183
183
  options?: CommitmentPlansUpdatePlanOptionalParams
184
184
  ): Promise<
185
- PollerLike<
186
- PollOperationState<CommitmentPlansUpdatePlanResponse>,
185
+ SimplePollerLike<
186
+ OperationState<CommitmentPlansUpdatePlanResponse>,
187
187
  CommitmentPlansUpdatePlanResponse
188
188
  >
189
189
  >;
@@ -212,7 +212,7 @@ export interface CommitmentPlans {
212
212
  resourceGroupName: string,
213
213
  commitmentPlanName: string,
214
214
  options?: CommitmentPlansDeletePlanOptionalParams
215
- ): Promise<PollerLike<PollOperationState<void>, void>>;
215
+ ): Promise<SimplePollerLike<OperationState<void>, void>>;
216
216
  /**
217
217
  * Deletes a Cognitive Services commitment plan from the resource group.
218
218
  * @param resourceGroupName The name of the resource group. The name is case insensitive.
@@ -269,8 +269,8 @@ export interface CommitmentPlans {
269
269
  association: CommitmentPlanAccountAssociation,
270
270
  options?: CommitmentPlansCreateOrUpdateAssociationOptionalParams
271
271
  ): Promise<
272
- PollerLike<
273
- PollOperationState<CommitmentPlansCreateOrUpdateAssociationResponse>,
272
+ SimplePollerLike<
273
+ OperationState<CommitmentPlansCreateOrUpdateAssociationResponse>,
274
274
  CommitmentPlansCreateOrUpdateAssociationResponse
275
275
  >
276
276
  >;
@@ -305,7 +305,7 @@ export interface CommitmentPlans {
305
305
  commitmentPlanName: string,
306
306
  commitmentPlanAssociationName: string,
307
307
  options?: CommitmentPlansDeleteAssociationOptionalParams
308
- ): Promise<PollerLike<PollOperationState<void>, void>>;
308
+ ): Promise<SimplePollerLike<OperationState<void>, void>>;
309
309
  /**
310
310
  * Deletes the association of the Cognitive Services commitment plan.
311
311
  * @param resourceGroupName The name of the resource group. The name is case insensitive.
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { PagedAsyncIterableIterator } from "@azure/core-paging";
10
- import { PollerLike, PollOperationState } from "@azure/core-lro";
10
+ import { SimplePollerLike, OperationState } from "@azure/core-lro";
11
11
  import {
12
12
  Account,
13
13
  DeletedAccountsListOptionalParams,
@@ -51,7 +51,7 @@ export interface DeletedAccounts {
51
51
  resourceGroupName: string,
52
52
  accountName: string,
53
53
  options?: DeletedAccountsPurgeOptionalParams
54
- ): Promise<PollerLike<PollOperationState<void>, void>>;
54
+ ): Promise<SimplePollerLike<OperationState<void>, void>>;
55
55
  /**
56
56
  * Deletes a Cognitive Services account from the resource group.
57
57
  * @param location Resource location.
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { PagedAsyncIterableIterator } from "@azure/core-paging";
10
- import { PollerLike, PollOperationState } from "@azure/core-lro";
10
+ import { SimplePollerLike, OperationState } from "@azure/core-lro";
11
11
  import {
12
12
  Deployment,
13
13
  DeploymentsListOptionalParams,
@@ -60,8 +60,8 @@ export interface Deployments {
60
60
  deployment: Deployment,
61
61
  options?: DeploymentsCreateOrUpdateOptionalParams
62
62
  ): Promise<
63
- PollerLike<
64
- PollOperationState<DeploymentsCreateOrUpdateResponse>,
63
+ SimplePollerLike<
64
+ OperationState<DeploymentsCreateOrUpdateResponse>,
65
65
  DeploymentsCreateOrUpdateResponse
66
66
  >
67
67
  >;
@@ -92,7 +92,7 @@ export interface Deployments {
92
92
  accountName: string,
93
93
  deploymentName: string,
94
94
  options?: DeploymentsDeleteOptionalParams
95
- ): Promise<PollerLike<PollOperationState<void>, void>>;
95
+ ): Promise<SimplePollerLike<OperationState<void>, void>>;
96
96
  /**
97
97
  * Deletes the specified deployment associated with the Cognitive Services account.
98
98
  * @param resourceGroupName The name of the resource group. The name is case insensitive.
@@ -9,8 +9,10 @@
9
9
  export * from "./accounts";
10
10
  export * from "./deletedAccounts";
11
11
  export * from "./resourceSkus";
12
+ export * from "./usages";
12
13
  export * from "./operations";
13
14
  export * from "./commitmentTiers";
15
+ export * from "./models";
14
16
  export * from "./privateEndpointConnections";
15
17
  export * from "./privateLinkResources";
16
18
  export * from "./deployments";
@@ -0,0 +1,24 @@
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 { Model, ModelsListOptionalParams } from "../models";
11
+
12
+ /// <reference lib="esnext.asynciterable" />
13
+ /** Interface representing a Models. */
14
+ export interface Models {
15
+ /**
16
+ * List Models.
17
+ * @param location Resource location.
18
+ * @param options The options parameters.
19
+ */
20
+ list(
21
+ location: string,
22
+ options?: ModelsListOptionalParams
23
+ ): PagedAsyncIterableIterator<Model>;
24
+ }
@@ -6,7 +6,7 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
 
9
- import { PollerLike, PollOperationState } from "@azure/core-lro";
9
+ import { SimplePollerLike, OperationState } from "@azure/core-lro";
10
10
  import {
11
11
  PrivateEndpointConnectionsListOptionalParams,
12
12
  PrivateEndpointConnectionsListResponse,
@@ -62,8 +62,8 @@ export interface PrivateEndpointConnections {
62
62
  properties: PrivateEndpointConnection,
63
63
  options?: PrivateEndpointConnectionsCreateOrUpdateOptionalParams
64
64
  ): Promise<
65
- PollerLike<
66
- PollOperationState<PrivateEndpointConnectionsCreateOrUpdateResponse>,
65
+ SimplePollerLike<
66
+ OperationState<PrivateEndpointConnectionsCreateOrUpdateResponse>,
67
67
  PrivateEndpointConnectionsCreateOrUpdateResponse
68
68
  >
69
69
  >;
@@ -97,7 +97,7 @@ export interface PrivateEndpointConnections {
97
97
  accountName: string,
98
98
  privateEndpointConnectionName: string,
99
99
  options?: PrivateEndpointConnectionsDeleteOptionalParams
100
- ): Promise<PollerLike<PollOperationState<void>, void>>;
100
+ ): Promise<SimplePollerLike<OperationState<void>, void>>;
101
101
  /**
102
102
  * Deletes the specified private endpoint connection associated with the Cognitive Services account.
103
103
  * @param resourceGroupName The name of the resource group. The name is case insensitive.
@@ -0,0 +1,24 @@
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 { Usage, UsagesListOptionalParams } from "../models";
11
+
12
+ /// <reference lib="esnext.asynciterable" />
13
+ /** Interface representing a Usages. */
14
+ export interface Usages {
15
+ /**
16
+ * Get usages for the requested subscription
17
+ * @param location Resource location.
18
+ * @param options The options parameters.
19
+ */
20
+ list(
21
+ location: string,
22
+ options?: UsagesListOptionalParams
23
+ ): PagedAsyncIterableIterator<Usage>;
24
+ }