@azure/arm-graphservices 1.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.
- package/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/README.md +109 -0
- package/dist/index.js +1313 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +1 -0
- package/dist/index.min.js.map +1 -0
- package/dist-esm/samples-dev/accountCreateAndUpdateSample.d.ts +2 -0
- package/dist-esm/samples-dev/accountCreateAndUpdateSample.d.ts.map +1 -0
- package/dist-esm/samples-dev/accountCreateAndUpdateSample.js +43 -0
- package/dist-esm/samples-dev/accountCreateAndUpdateSample.js.map +1 -0
- package/dist-esm/samples-dev/accountDeleteSample.d.ts +2 -0
- package/dist-esm/samples-dev/accountDeleteSample.d.ts.map +1 -0
- package/dist-esm/samples-dev/accountDeleteSample.js +39 -0
- package/dist-esm/samples-dev/accountDeleteSample.js.map +1 -0
- package/dist-esm/samples-dev/accountGetSample.d.ts +2 -0
- package/dist-esm/samples-dev/accountGetSample.d.ts.map +1 -0
- package/dist-esm/samples-dev/accountGetSample.js +39 -0
- package/dist-esm/samples-dev/accountGetSample.js.map +1 -0
- package/dist-esm/samples-dev/accountUpdateSample.d.ts +2 -0
- package/dist-esm/samples-dev/accountUpdateSample.d.ts.map +1 -0
- package/dist-esm/samples-dev/accountUpdateSample.js +42 -0
- package/dist-esm/samples-dev/accountUpdateSample.js.map +1 -0
- package/dist-esm/samples-dev/accountsListByResourceGroupSample.d.ts +2 -0
- package/dist-esm/samples-dev/accountsListByResourceGroupSample.d.ts.map +1 -0
- package/dist-esm/samples-dev/accountsListByResourceGroupSample.js +52 -0
- package/dist-esm/samples-dev/accountsListByResourceGroupSample.js.map +1 -0
- package/dist-esm/samples-dev/accountsListBySubscriptionSample.d.ts +2 -0
- package/dist-esm/samples-dev/accountsListBySubscriptionSample.d.ts.map +1 -0
- package/dist-esm/samples-dev/accountsListBySubscriptionSample.js +51 -0
- package/dist-esm/samples-dev/accountsListBySubscriptionSample.js.map +1 -0
- package/dist-esm/samples-dev/operationListSample.d.ts +2 -0
- package/dist-esm/samples-dev/operationListSample.d.ts.map +1 -0
- package/dist-esm/samples-dev/operationListSample.js +51 -0
- package/dist-esm/samples-dev/operationListSample.js.map +1 -0
- package/dist-esm/src/graphServices.d.ts +22 -0
- package/dist-esm/src/graphServices.d.ts.map +1 -0
- package/dist-esm/src/graphServices.js +102 -0
- package/dist-esm/src/graphServices.js.map +1 -0
- package/dist-esm/src/index.d.ts +6 -0
- package/dist-esm/src/index.d.ts.map +1 -0
- package/dist-esm/src/index.js +13 -0
- package/dist-esm/src/index.js.map +1 -0
- package/dist-esm/src/lroImpl.d.ts +11 -0
- package/dist-esm/src/lroImpl.d.ts.map +1 -0
- package/dist-esm/src/lroImpl.js +21 -0
- package/dist-esm/src/lroImpl.js.map +1 -0
- package/dist-esm/src/models/index.d.ts +320 -0
- package/dist-esm/src/models/index.d.ts.map +1 -0
- package/dist-esm/src/models/index.js +46 -0
- package/dist-esm/src/models/index.js.map +1 -0
- package/dist-esm/src/models/mappers.d.ts +15 -0
- package/dist-esm/src/models/mappers.d.ts.map +1 -0
- package/dist-esm/src/models/mappers.js +384 -0
- package/dist-esm/src/models/mappers.js.map +1 -0
- package/dist-esm/src/models/parameters.d.ts +12 -0
- package/dist-esm/src/models/parameters.d.ts.map +1 -0
- package/dist-esm/src/models/parameters.js +109 -0
- package/dist-esm/src/models/parameters.js.map +1 -0
- package/dist-esm/src/operations/account.d.ts +52 -0
- package/dist-esm/src/operations/account.d.ts.map +1 -0
- package/dist-esm/src/operations/account.js +208 -0
- package/dist-esm/src/operations/account.js.map +1 -0
- package/dist-esm/src/operations/accounts.d.ts +53 -0
- package/dist-esm/src/operations/accounts.d.ts.map +1 -0
- package/dist-esm/src/operations/accounts.js +252 -0
- package/dist-esm/src/operations/accounts.js.map +1 -0
- package/dist-esm/src/operations/index.d.ts +4 -0
- package/dist-esm/src/operations/index.d.ts.map +1 -0
- package/dist-esm/src/operations/index.js +11 -0
- package/dist-esm/src/operations/index.js.map +1 -0
- package/dist-esm/src/operations/operationOperations.d.ts +32 -0
- package/dist-esm/src/operations/operationOperations.d.ts.map +1 -0
- package/dist-esm/src/operations/operationOperations.js +131 -0
- package/dist-esm/src/operations/operationOperations.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/account.d.ts +44 -0
- package/dist-esm/src/operationsInterfaces/account.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/account.js +9 -0
- package/dist-esm/src/operationsInterfaces/account.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/accounts.d.ts +17 -0
- package/dist-esm/src/operationsInterfaces/accounts.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/accounts.js +9 -0
- package/dist-esm/src/operationsInterfaces/accounts.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/index.d.ts +4 -0
- package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/index.js +11 -0
- package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/operationOperations.d.ts +11 -0
- package/dist-esm/src/operationsInterfaces/operationOperations.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/operationOperations.js +9 -0
- package/dist-esm/src/operationsInterfaces/operationOperations.js.map +1 -0
- package/dist-esm/src/pagingHelper.d.ts +13 -0
- package/dist-esm/src/pagingHelper.d.ts.map +1 -0
- package/dist-esm/src/pagingHelper.js +32 -0
- package/dist-esm/src/pagingHelper.js.map +1 -0
- package/dist-esm/test/graphservices_operations_test.spec.d.ts +4 -0
- package/dist-esm/test/graphservices_operations_test.spec.d.ts.map +1 -0
- package/dist-esm/test/graphservices_operations_test.spec.js +55 -0
- package/dist-esm/test/graphservices_operations_test.spec.js.map +1 -0
- package/package.json +123 -0
- package/review/arm-graphservices.api.md +262 -0
- package/rollup.config.js +122 -0
- package/src/graphServices.ts +148 -0
- package/src/index.ts +13 -0
- package/src/lroImpl.ts +42 -0
- package/src/models/index.ts +364 -0
- package/src/models/mappers.ts +408 -0
- package/src/models/parameters.ts +127 -0
- package/src/operations/account.ts +295 -0
- package/src/operations/accounts.ts +303 -0
- package/src/operations/index.ts +11 -0
- package/src/operations/operationOperations.ts +149 -0
- package/src/operationsInterfaces/account.ts +90 -0
- package/src/operationsInterfaces/accounts.ts +35 -0
- package/src/operationsInterfaces/index.ts +11 -0
- package/src/operationsInterfaces/operationOperations.ts +22 -0
- package/src/pagingHelper.ts +39 -0
- package/tsconfig.json +33 -0
- package/types/arm-graphservices.d.ts +459 -0
- package/types/tsdoc-metadata.json +11 -0
|
@@ -0,0 +1,295 @@
|
|
|
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 { Account } from "../operationsInterfaces";
|
|
10
|
+
import * as coreClient from "@azure/core-client";
|
|
11
|
+
import * as Mappers from "../models/mappers";
|
|
12
|
+
import * as Parameters from "../models/parameters";
|
|
13
|
+
import { GraphServices } from "../graphServices";
|
|
14
|
+
import {
|
|
15
|
+
SimplePollerLike,
|
|
16
|
+
OperationState,
|
|
17
|
+
createHttpPoller
|
|
18
|
+
} from "@azure/core-lro";
|
|
19
|
+
import { createLroSpec } from "../lroImpl";
|
|
20
|
+
import {
|
|
21
|
+
AccountGetOptionalParams,
|
|
22
|
+
AccountGetResponse,
|
|
23
|
+
AccountResource,
|
|
24
|
+
AccountCreateAndUpdateOptionalParams,
|
|
25
|
+
AccountCreateAndUpdateResponse,
|
|
26
|
+
AccountPatchResource,
|
|
27
|
+
AccountUpdateOptionalParams,
|
|
28
|
+
AccountUpdateResponse,
|
|
29
|
+
AccountDeleteOptionalParams
|
|
30
|
+
} from "../models";
|
|
31
|
+
|
|
32
|
+
/** Class containing Account operations. */
|
|
33
|
+
export class AccountImpl implements Account {
|
|
34
|
+
private readonly client: GraphServices;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Initialize a new instance of the class Account class.
|
|
38
|
+
* @param client Reference to the service client
|
|
39
|
+
*/
|
|
40
|
+
constructor(client: GraphServices) {
|
|
41
|
+
this.client = client;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Returns account resource for a given name.
|
|
46
|
+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
|
|
47
|
+
* @param resourceName The name of the resource.
|
|
48
|
+
* @param options The options parameters.
|
|
49
|
+
*/
|
|
50
|
+
get(
|
|
51
|
+
resourceGroupName: string,
|
|
52
|
+
resourceName: string,
|
|
53
|
+
options?: AccountGetOptionalParams
|
|
54
|
+
): Promise<AccountGetResponse> {
|
|
55
|
+
return this.client.sendOperationRequest(
|
|
56
|
+
{ resourceGroupName, resourceName, options },
|
|
57
|
+
getOperationSpec
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Create or update account resource.
|
|
63
|
+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
|
|
64
|
+
* @param resourceName The name of the resource.
|
|
65
|
+
* @param accountResource Account details.
|
|
66
|
+
* @param options The options parameters.
|
|
67
|
+
*/
|
|
68
|
+
async beginCreateAndUpdate(
|
|
69
|
+
resourceGroupName: string,
|
|
70
|
+
resourceName: string,
|
|
71
|
+
accountResource: AccountResource,
|
|
72
|
+
options?: AccountCreateAndUpdateOptionalParams
|
|
73
|
+
): Promise<
|
|
74
|
+
SimplePollerLike<
|
|
75
|
+
OperationState<AccountCreateAndUpdateResponse>,
|
|
76
|
+
AccountCreateAndUpdateResponse
|
|
77
|
+
>
|
|
78
|
+
> {
|
|
79
|
+
const directSendOperation = async (
|
|
80
|
+
args: coreClient.OperationArguments,
|
|
81
|
+
spec: coreClient.OperationSpec
|
|
82
|
+
): Promise<AccountCreateAndUpdateResponse> => {
|
|
83
|
+
return this.client.sendOperationRequest(args, spec);
|
|
84
|
+
};
|
|
85
|
+
const sendOperationFn = async (
|
|
86
|
+
args: coreClient.OperationArguments,
|
|
87
|
+
spec: coreClient.OperationSpec
|
|
88
|
+
) => {
|
|
89
|
+
let currentRawResponse:
|
|
90
|
+
| coreClient.FullOperationResponse
|
|
91
|
+
| undefined = undefined;
|
|
92
|
+
const providedCallback = args.options?.onResponse;
|
|
93
|
+
const callback: coreClient.RawResponseCallback = (
|
|
94
|
+
rawResponse: coreClient.FullOperationResponse,
|
|
95
|
+
flatResponse: unknown
|
|
96
|
+
) => {
|
|
97
|
+
currentRawResponse = rawResponse;
|
|
98
|
+
providedCallback?.(rawResponse, flatResponse);
|
|
99
|
+
};
|
|
100
|
+
const updatedArgs = {
|
|
101
|
+
...args,
|
|
102
|
+
options: {
|
|
103
|
+
...args.options,
|
|
104
|
+
onResponse: callback
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const flatResponse = await directSendOperation(updatedArgs, spec);
|
|
108
|
+
return {
|
|
109
|
+
flatResponse,
|
|
110
|
+
rawResponse: {
|
|
111
|
+
statusCode: currentRawResponse!.status,
|
|
112
|
+
body: currentRawResponse!.parsedBody,
|
|
113
|
+
headers: currentRawResponse!.headers.toJSON()
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const lro = createLroSpec({
|
|
119
|
+
sendOperationFn,
|
|
120
|
+
args: { resourceGroupName, resourceName, accountResource, options },
|
|
121
|
+
spec: createAndUpdateOperationSpec
|
|
122
|
+
});
|
|
123
|
+
const poller = await createHttpPoller<
|
|
124
|
+
AccountCreateAndUpdateResponse,
|
|
125
|
+
OperationState<AccountCreateAndUpdateResponse>
|
|
126
|
+
>(lro, {
|
|
127
|
+
restoreFrom: options?.resumeFrom,
|
|
128
|
+
intervalInMs: options?.updateIntervalInMs,
|
|
129
|
+
resourceLocationConfig: "azure-async-operation"
|
|
130
|
+
});
|
|
131
|
+
await poller.poll();
|
|
132
|
+
return poller;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Create or update account resource.
|
|
137
|
+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
|
|
138
|
+
* @param resourceName The name of the resource.
|
|
139
|
+
* @param accountResource Account details.
|
|
140
|
+
* @param options The options parameters.
|
|
141
|
+
*/
|
|
142
|
+
async beginCreateAndUpdateAndWait(
|
|
143
|
+
resourceGroupName: string,
|
|
144
|
+
resourceName: string,
|
|
145
|
+
accountResource: AccountResource,
|
|
146
|
+
options?: AccountCreateAndUpdateOptionalParams
|
|
147
|
+
): Promise<AccountCreateAndUpdateResponse> {
|
|
148
|
+
const poller = await this.beginCreateAndUpdate(
|
|
149
|
+
resourceGroupName,
|
|
150
|
+
resourceName,
|
|
151
|
+
accountResource,
|
|
152
|
+
options
|
|
153
|
+
);
|
|
154
|
+
return poller.pollUntilDone();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Update account details.
|
|
159
|
+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
|
|
160
|
+
* @param resourceName The name of the resource.
|
|
161
|
+
* @param accountResource Account patch details.
|
|
162
|
+
* @param options The options parameters.
|
|
163
|
+
*/
|
|
164
|
+
update(
|
|
165
|
+
resourceGroupName: string,
|
|
166
|
+
resourceName: string,
|
|
167
|
+
accountResource: AccountPatchResource,
|
|
168
|
+
options?: AccountUpdateOptionalParams
|
|
169
|
+
): Promise<AccountUpdateResponse> {
|
|
170
|
+
return this.client.sendOperationRequest(
|
|
171
|
+
{ resourceGroupName, resourceName, accountResource, options },
|
|
172
|
+
updateOperationSpec
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Deletes a account resource.
|
|
178
|
+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
|
|
179
|
+
* @param resourceName The name of the resource.
|
|
180
|
+
* @param options The options parameters.
|
|
181
|
+
*/
|
|
182
|
+
delete(
|
|
183
|
+
resourceGroupName: string,
|
|
184
|
+
resourceName: string,
|
|
185
|
+
options?: AccountDeleteOptionalParams
|
|
186
|
+
): Promise<void> {
|
|
187
|
+
return this.client.sendOperationRequest(
|
|
188
|
+
{ resourceGroupName, resourceName, options },
|
|
189
|
+
deleteOperationSpec
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
// Operation Specifications
|
|
194
|
+
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
|
|
195
|
+
|
|
196
|
+
const getOperationSpec: coreClient.OperationSpec = {
|
|
197
|
+
path:
|
|
198
|
+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}",
|
|
199
|
+
httpMethod: "GET",
|
|
200
|
+
responses: {
|
|
201
|
+
200: {
|
|
202
|
+
bodyMapper: Mappers.AccountResource
|
|
203
|
+
},
|
|
204
|
+
default: {
|
|
205
|
+
bodyMapper: Mappers.ErrorResponse
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
queryParameters: [Parameters.apiVersion],
|
|
209
|
+
urlParameters: [
|
|
210
|
+
Parameters.$host,
|
|
211
|
+
Parameters.subscriptionId,
|
|
212
|
+
Parameters.resourceGroupName,
|
|
213
|
+
Parameters.resourceName
|
|
214
|
+
],
|
|
215
|
+
headerParameters: [Parameters.accept],
|
|
216
|
+
serializer
|
|
217
|
+
};
|
|
218
|
+
const createAndUpdateOperationSpec: coreClient.OperationSpec = {
|
|
219
|
+
path:
|
|
220
|
+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}",
|
|
221
|
+
httpMethod: "PUT",
|
|
222
|
+
responses: {
|
|
223
|
+
200: {
|
|
224
|
+
bodyMapper: Mappers.AccountResource
|
|
225
|
+
},
|
|
226
|
+
201: {
|
|
227
|
+
bodyMapper: Mappers.AccountResource
|
|
228
|
+
},
|
|
229
|
+
202: {
|
|
230
|
+
bodyMapper: Mappers.AccountResource
|
|
231
|
+
},
|
|
232
|
+
204: {
|
|
233
|
+
bodyMapper: Mappers.AccountResource
|
|
234
|
+
},
|
|
235
|
+
default: {
|
|
236
|
+
bodyMapper: Mappers.ErrorResponse
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
requestBody: Parameters.accountResource,
|
|
240
|
+
queryParameters: [Parameters.apiVersion],
|
|
241
|
+
urlParameters: [
|
|
242
|
+
Parameters.$host,
|
|
243
|
+
Parameters.subscriptionId,
|
|
244
|
+
Parameters.resourceGroupName,
|
|
245
|
+
Parameters.resourceName
|
|
246
|
+
],
|
|
247
|
+
headerParameters: [Parameters.accept, Parameters.contentType],
|
|
248
|
+
mediaType: "json",
|
|
249
|
+
serializer
|
|
250
|
+
};
|
|
251
|
+
const updateOperationSpec: coreClient.OperationSpec = {
|
|
252
|
+
path:
|
|
253
|
+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}",
|
|
254
|
+
httpMethod: "PATCH",
|
|
255
|
+
responses: {
|
|
256
|
+
200: {
|
|
257
|
+
bodyMapper: Mappers.AccountResource
|
|
258
|
+
},
|
|
259
|
+
default: {
|
|
260
|
+
bodyMapper: Mappers.ErrorResponse
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
requestBody: Parameters.accountResource1,
|
|
264
|
+
queryParameters: [Parameters.apiVersion],
|
|
265
|
+
urlParameters: [
|
|
266
|
+
Parameters.$host,
|
|
267
|
+
Parameters.subscriptionId,
|
|
268
|
+
Parameters.resourceGroupName,
|
|
269
|
+
Parameters.resourceName
|
|
270
|
+
],
|
|
271
|
+
headerParameters: [Parameters.accept, Parameters.contentType],
|
|
272
|
+
mediaType: "json",
|
|
273
|
+
serializer
|
|
274
|
+
};
|
|
275
|
+
const deleteOperationSpec: coreClient.OperationSpec = {
|
|
276
|
+
path:
|
|
277
|
+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}",
|
|
278
|
+
httpMethod: "DELETE",
|
|
279
|
+
responses: {
|
|
280
|
+
200: {},
|
|
281
|
+
204: {},
|
|
282
|
+
default: {
|
|
283
|
+
bodyMapper: Mappers.ErrorResponse
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
queryParameters: [Parameters.apiVersion],
|
|
287
|
+
urlParameters: [
|
|
288
|
+
Parameters.$host,
|
|
289
|
+
Parameters.subscriptionId,
|
|
290
|
+
Parameters.resourceGroupName,
|
|
291
|
+
Parameters.resourceName
|
|
292
|
+
],
|
|
293
|
+
headerParameters: [Parameters.accept],
|
|
294
|
+
serializer
|
|
295
|
+
};
|
|
@@ -0,0 +1,303 @@
|
|
|
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 { Accounts } 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 { GraphServices } from "../graphServices";
|
|
16
|
+
import {
|
|
17
|
+
AccountResource,
|
|
18
|
+
AccountsListByResourceGroupNextOptionalParams,
|
|
19
|
+
AccountsListByResourceGroupOptionalParams,
|
|
20
|
+
AccountsListByResourceGroupResponse,
|
|
21
|
+
AccountsListBySubscriptionNextOptionalParams,
|
|
22
|
+
AccountsListBySubscriptionOptionalParams,
|
|
23
|
+
AccountsListBySubscriptionResponse,
|
|
24
|
+
AccountsListByResourceGroupNextResponse,
|
|
25
|
+
AccountsListBySubscriptionNextResponse
|
|
26
|
+
} from "../models";
|
|
27
|
+
|
|
28
|
+
/// <reference lib="esnext.asynciterable" />
|
|
29
|
+
/** Class containing Accounts operations. */
|
|
30
|
+
export class AccountsImpl implements Accounts {
|
|
31
|
+
private readonly client: GraphServices;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Initialize a new instance of the class Accounts class.
|
|
35
|
+
* @param client Reference to the service client
|
|
36
|
+
*/
|
|
37
|
+
constructor(client: GraphServices) {
|
|
38
|
+
this.client = client;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Returns list of accounts apps.
|
|
43
|
+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
|
|
44
|
+
* @param options The options parameters.
|
|
45
|
+
*/
|
|
46
|
+
public listByResourceGroup(
|
|
47
|
+
resourceGroupName: string,
|
|
48
|
+
options?: AccountsListByResourceGroupOptionalParams
|
|
49
|
+
): PagedAsyncIterableIterator<AccountResource> {
|
|
50
|
+
const iter = this.listByResourceGroupPagingAll(resourceGroupName, options);
|
|
51
|
+
return {
|
|
52
|
+
next() {
|
|
53
|
+
return iter.next();
|
|
54
|
+
},
|
|
55
|
+
[Symbol.asyncIterator]() {
|
|
56
|
+
return this;
|
|
57
|
+
},
|
|
58
|
+
byPage: (settings?: PageSettings) => {
|
|
59
|
+
if (settings?.maxPageSize) {
|
|
60
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
61
|
+
}
|
|
62
|
+
return this.listByResourceGroupPagingPage(
|
|
63
|
+
resourceGroupName,
|
|
64
|
+
options,
|
|
65
|
+
settings
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private async *listByResourceGroupPagingPage(
|
|
72
|
+
resourceGroupName: string,
|
|
73
|
+
options?: AccountsListByResourceGroupOptionalParams,
|
|
74
|
+
settings?: PageSettings
|
|
75
|
+
): AsyncIterableIterator<AccountResource[]> {
|
|
76
|
+
let result: AccountsListByResourceGroupResponse;
|
|
77
|
+
let continuationToken = settings?.continuationToken;
|
|
78
|
+
if (!continuationToken) {
|
|
79
|
+
result = await this._listByResourceGroup(resourceGroupName, options);
|
|
80
|
+
let page = result.value || [];
|
|
81
|
+
continuationToken = result.nextLink;
|
|
82
|
+
setContinuationToken(page, continuationToken);
|
|
83
|
+
yield page;
|
|
84
|
+
}
|
|
85
|
+
while (continuationToken) {
|
|
86
|
+
result = await this._listByResourceGroupNext(
|
|
87
|
+
resourceGroupName,
|
|
88
|
+
continuationToken,
|
|
89
|
+
options
|
|
90
|
+
);
|
|
91
|
+
continuationToken = result.nextLink;
|
|
92
|
+
let page = result.value || [];
|
|
93
|
+
setContinuationToken(page, continuationToken);
|
|
94
|
+
yield page;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private async *listByResourceGroupPagingAll(
|
|
99
|
+
resourceGroupName: string,
|
|
100
|
+
options?: AccountsListByResourceGroupOptionalParams
|
|
101
|
+
): AsyncIterableIterator<AccountResource> {
|
|
102
|
+
for await (const page of this.listByResourceGroupPagingPage(
|
|
103
|
+
resourceGroupName,
|
|
104
|
+
options
|
|
105
|
+
)) {
|
|
106
|
+
yield* page;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Returns list of accounts belonging to a subscription.
|
|
112
|
+
* @param options The options parameters.
|
|
113
|
+
*/
|
|
114
|
+
public listBySubscription(
|
|
115
|
+
options?: AccountsListBySubscriptionOptionalParams
|
|
116
|
+
): PagedAsyncIterableIterator<AccountResource> {
|
|
117
|
+
const iter = this.listBySubscriptionPagingAll(options);
|
|
118
|
+
return {
|
|
119
|
+
next() {
|
|
120
|
+
return iter.next();
|
|
121
|
+
},
|
|
122
|
+
[Symbol.asyncIterator]() {
|
|
123
|
+
return this;
|
|
124
|
+
},
|
|
125
|
+
byPage: (settings?: PageSettings) => {
|
|
126
|
+
if (settings?.maxPageSize) {
|
|
127
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
128
|
+
}
|
|
129
|
+
return this.listBySubscriptionPagingPage(options, settings);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
private async *listBySubscriptionPagingPage(
|
|
135
|
+
options?: AccountsListBySubscriptionOptionalParams,
|
|
136
|
+
settings?: PageSettings
|
|
137
|
+
): AsyncIterableIterator<AccountResource[]> {
|
|
138
|
+
let result: AccountsListBySubscriptionResponse;
|
|
139
|
+
let continuationToken = settings?.continuationToken;
|
|
140
|
+
if (!continuationToken) {
|
|
141
|
+
result = await this._listBySubscription(options);
|
|
142
|
+
let page = result.value || [];
|
|
143
|
+
continuationToken = result.nextLink;
|
|
144
|
+
setContinuationToken(page, continuationToken);
|
|
145
|
+
yield page;
|
|
146
|
+
}
|
|
147
|
+
while (continuationToken) {
|
|
148
|
+
result = await this._listBySubscriptionNext(continuationToken, options);
|
|
149
|
+
continuationToken = result.nextLink;
|
|
150
|
+
let page = result.value || [];
|
|
151
|
+
setContinuationToken(page, continuationToken);
|
|
152
|
+
yield page;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
private async *listBySubscriptionPagingAll(
|
|
157
|
+
options?: AccountsListBySubscriptionOptionalParams
|
|
158
|
+
): AsyncIterableIterator<AccountResource> {
|
|
159
|
+
for await (const page of this.listBySubscriptionPagingPage(options)) {
|
|
160
|
+
yield* page;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Returns list of accounts apps.
|
|
166
|
+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
|
|
167
|
+
* @param options The options parameters.
|
|
168
|
+
*/
|
|
169
|
+
private _listByResourceGroup(
|
|
170
|
+
resourceGroupName: string,
|
|
171
|
+
options?: AccountsListByResourceGroupOptionalParams
|
|
172
|
+
): Promise<AccountsListByResourceGroupResponse> {
|
|
173
|
+
return this.client.sendOperationRequest(
|
|
174
|
+
{ resourceGroupName, options },
|
|
175
|
+
listByResourceGroupOperationSpec
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Returns list of accounts belonging to a subscription.
|
|
181
|
+
* @param options The options parameters.
|
|
182
|
+
*/
|
|
183
|
+
private _listBySubscription(
|
|
184
|
+
options?: AccountsListBySubscriptionOptionalParams
|
|
185
|
+
): Promise<AccountsListBySubscriptionResponse> {
|
|
186
|
+
return this.client.sendOperationRequest(
|
|
187
|
+
{ options },
|
|
188
|
+
listBySubscriptionOperationSpec
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* ListByResourceGroupNext
|
|
194
|
+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
|
|
195
|
+
* @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method.
|
|
196
|
+
* @param options The options parameters.
|
|
197
|
+
*/
|
|
198
|
+
private _listByResourceGroupNext(
|
|
199
|
+
resourceGroupName: string,
|
|
200
|
+
nextLink: string,
|
|
201
|
+
options?: AccountsListByResourceGroupNextOptionalParams
|
|
202
|
+
): Promise<AccountsListByResourceGroupNextResponse> {
|
|
203
|
+
return this.client.sendOperationRequest(
|
|
204
|
+
{ resourceGroupName, nextLink, options },
|
|
205
|
+
listByResourceGroupNextOperationSpec
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* ListBySubscriptionNext
|
|
211
|
+
* @param nextLink The nextLink from the previous successful call to the ListBySubscription method.
|
|
212
|
+
* @param options The options parameters.
|
|
213
|
+
*/
|
|
214
|
+
private _listBySubscriptionNext(
|
|
215
|
+
nextLink: string,
|
|
216
|
+
options?: AccountsListBySubscriptionNextOptionalParams
|
|
217
|
+
): Promise<AccountsListBySubscriptionNextResponse> {
|
|
218
|
+
return this.client.sendOperationRequest(
|
|
219
|
+
{ nextLink, options },
|
|
220
|
+
listBySubscriptionNextOperationSpec
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
// Operation Specifications
|
|
225
|
+
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
|
|
226
|
+
|
|
227
|
+
const listByResourceGroupOperationSpec: coreClient.OperationSpec = {
|
|
228
|
+
path:
|
|
229
|
+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts",
|
|
230
|
+
httpMethod: "GET",
|
|
231
|
+
responses: {
|
|
232
|
+
200: {
|
|
233
|
+
bodyMapper: Mappers.AccountResourceList
|
|
234
|
+
},
|
|
235
|
+
default: {
|
|
236
|
+
bodyMapper: Mappers.ErrorResponse
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
queryParameters: [Parameters.apiVersion],
|
|
240
|
+
urlParameters: [
|
|
241
|
+
Parameters.$host,
|
|
242
|
+
Parameters.subscriptionId,
|
|
243
|
+
Parameters.resourceGroupName
|
|
244
|
+
],
|
|
245
|
+
headerParameters: [Parameters.accept],
|
|
246
|
+
serializer
|
|
247
|
+
};
|
|
248
|
+
const listBySubscriptionOperationSpec: coreClient.OperationSpec = {
|
|
249
|
+
path:
|
|
250
|
+
"/subscriptions/{subscriptionId}/providers/Microsoft.GraphServices/accounts",
|
|
251
|
+
httpMethod: "GET",
|
|
252
|
+
responses: {
|
|
253
|
+
200: {
|
|
254
|
+
bodyMapper: Mappers.AccountResourceList
|
|
255
|
+
},
|
|
256
|
+
default: {
|
|
257
|
+
bodyMapper: Mappers.ErrorResponse
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
queryParameters: [Parameters.apiVersion],
|
|
261
|
+
urlParameters: [Parameters.$host, Parameters.subscriptionId],
|
|
262
|
+
headerParameters: [Parameters.accept],
|
|
263
|
+
serializer
|
|
264
|
+
};
|
|
265
|
+
const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = {
|
|
266
|
+
path: "{nextLink}",
|
|
267
|
+
httpMethod: "GET",
|
|
268
|
+
responses: {
|
|
269
|
+
200: {
|
|
270
|
+
bodyMapper: Mappers.AccountResourceList
|
|
271
|
+
},
|
|
272
|
+
default: {
|
|
273
|
+
bodyMapper: Mappers.ErrorResponse
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
urlParameters: [
|
|
277
|
+
Parameters.$host,
|
|
278
|
+
Parameters.subscriptionId,
|
|
279
|
+
Parameters.resourceGroupName,
|
|
280
|
+
Parameters.nextLink
|
|
281
|
+
],
|
|
282
|
+
headerParameters: [Parameters.accept],
|
|
283
|
+
serializer
|
|
284
|
+
};
|
|
285
|
+
const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = {
|
|
286
|
+
path: "{nextLink}",
|
|
287
|
+
httpMethod: "GET",
|
|
288
|
+
responses: {
|
|
289
|
+
200: {
|
|
290
|
+
bodyMapper: Mappers.AccountResourceList
|
|
291
|
+
},
|
|
292
|
+
default: {
|
|
293
|
+
bodyMapper: Mappers.ErrorResponse
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
urlParameters: [
|
|
297
|
+
Parameters.$host,
|
|
298
|
+
Parameters.subscriptionId,
|
|
299
|
+
Parameters.nextLink
|
|
300
|
+
],
|
|
301
|
+
headerParameters: [Parameters.accept],
|
|
302
|
+
serializer
|
|
303
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export * from "./accounts";
|
|
10
|
+
export * from "./account";
|
|
11
|
+
export * from "./operationOperations";
|