@azure/arm-managementgroups 1.1.0 → 2.0.0-alpha.20211214.2
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 +26 -0
- package/{LICENSE.txt → LICENSE} +2 -2
- package/README.md +78 -77
- package/dist/index.js +2881 -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/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 +16 -0
- package/dist-esm/src/lroImpl.d.ts.map +1 -0
- package/dist-esm/src/lroImpl.js +29 -0
- package/dist-esm/src/lroImpl.js.map +1 -0
- package/dist-esm/src/managementGroupsAPI.d.ts +34 -0
- package/dist-esm/src/managementGroupsAPI.d.ts.map +1 -0
- package/dist-esm/src/managementGroupsAPI.js +102 -0
- package/dist-esm/src/managementGroupsAPI.js.map +1 -0
- package/dist-esm/src/managementGroupsAPIContext.d.ts +14 -0
- package/dist-esm/src/managementGroupsAPIContext.d.ts.map +1 -0
- package/dist-esm/src/managementGroupsAPIContext.js +43 -0
- package/dist-esm/src/managementGroupsAPIContext.js.map +1 -0
- package/dist-esm/src/models/index.d.ts +956 -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 +39 -0
- package/dist-esm/src/models/mappers.d.ts.map +1 -0
- package/{esm → dist-esm/src}/models/mappers.js +776 -396
- package/dist-esm/src/models/mappers.js.map +1 -0
- package/dist-esm/src/models/parameters.d.ts +24 -0
- package/dist-esm/src/models/parameters.d.ts.map +1 -0
- package/dist-esm/src/models/parameters.js +200 -0
- package/dist-esm/src/models/parameters.js.map +1 -0
- package/dist-esm/src/operations/entities.d.ts +34 -0
- package/dist-esm/src/operations/entities.d.ts.map +1 -0
- package/dist-esm/src/operations/entities.js +142 -0
- package/dist-esm/src/operations/entities.js.map +1 -0
- package/dist-esm/src/operations/hierarchySettingsOperations.d.ts +52 -0
- package/dist-esm/src/operations/hierarchySettingsOperations.d.ts.map +1 -0
- package/dist-esm/src/operations/hierarchySettingsOperations.js +154 -0
- package/dist-esm/src/operations/hierarchySettingsOperations.js.map +1 -0
- package/{esm → dist-esm/src}/operations/index.d.ts +1 -0
- package/dist-esm/src/operations/index.d.ts.map +1 -0
- package/{esm → dist-esm/src}/operations/index.js +4 -5
- package/dist-esm/src/operations/index.js.map +1 -0
- package/dist-esm/src/operations/managementGroupSubscriptions.d.ts +62 -0
- package/dist-esm/src/operations/managementGroupSubscriptions.d.ts.map +1 -0
- package/dist-esm/src/operations/managementGroupSubscriptions.js +215 -0
- package/dist-esm/src/operations/managementGroupSubscriptions.js.map +1 -0
- package/dist-esm/src/operations/managementGroups.d.ts +109 -0
- package/dist-esm/src/operations/managementGroups.d.ts.map +1 -0
- package/dist-esm/src/operations/managementGroups.js +462 -0
- package/dist-esm/src/operations/managementGroups.js.map +1 -0
- package/dist-esm/src/operations/operations.d.ts +32 -0
- package/dist-esm/src/operations/operations.d.ts.map +1 -0
- package/dist-esm/src/operations/operations.js +120 -0
- package/dist-esm/src/operations/operations.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/entities.d.ts +12 -0
- package/dist-esm/src/operationsInterfaces/entities.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/entities.js +9 -0
- package/dist-esm/src/operationsInterfaces/entities.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/hierarchySettingsOperations.d.ts +44 -0
- package/dist-esm/src/operationsInterfaces/hierarchySettingsOperations.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/hierarchySettingsOperations.js +9 -0
- package/dist-esm/src/operationsInterfaces/hierarchySettingsOperations.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/index.d.ts +6 -0
- package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/index.js +13 -0
- package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/managementGroupSubscriptions.d.ts +37 -0
- package/dist-esm/src/operationsInterfaces/managementGroupSubscriptions.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/managementGroupSubscriptions.js +9 -0
- package/dist-esm/src/operationsInterfaces/managementGroupSubscriptions.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/managementGroups.d.ts +71 -0
- package/dist-esm/src/operationsInterfaces/managementGroups.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/managementGroups.js +9 -0
- package/dist-esm/src/operationsInterfaces/managementGroups.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/operations.d.ts +11 -0
- package/dist-esm/src/operationsInterfaces/operations.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/operations.js +9 -0
- package/dist-esm/src/operationsInterfaces/operations.js.map +1 -0
- package/dist-esm/test/sampleTest.d.ts +2 -0
- package/dist-esm/test/sampleTest.d.ts.map +1 -0
- package/dist-esm/test/sampleTest.js +40 -0
- package/dist-esm/test/sampleTest.js.map +1 -0
- package/package.json +71 -25
- package/review/arm-managementgroups.api.md +667 -0
- package/rollup.config.js +184 -27
- package/src/index.ts +13 -0
- package/src/lroImpl.ts +34 -0
- package/src/managementGroupsAPI.ts +160 -0
- package/src/managementGroupsAPIContext.ts +62 -0
- package/src/models/index.ts +1082 -0
- package/{lib → src}/models/mappers.ts +792 -400
- package/src/models/parameters.ts +232 -0
- package/src/operations/entities.ts +159 -0
- package/src/operations/hierarchySettingsOperations.ts +214 -0
- package/{lib → src}/operations/index.ts +4 -5
- package/src/operations/managementGroupSubscriptions.ts +294 -0
- package/src/operations/managementGroups.ts +592 -0
- package/src/operations/operations.ts +137 -0
- package/src/operationsInterfaces/entities.ts +23 -0
- package/src/operationsInterfaces/hierarchySettingsOperations.ts +80 -0
- package/src/operationsInterfaces/index.ts +13 -0
- package/src/operationsInterfaces/managementGroupSubscriptions.ts +69 -0
- package/src/operationsInterfaces/managementGroups.ts +131 -0
- package/src/operationsInterfaces/operations.ts +22 -0
- package/tsconfig.json +4 -4
- package/types/arm-managementgroups.d.ts +1266 -0
- package/types/tsdoc-metadata.json +11 -0
- package/dist/arm-managementgroups.js +0 -2007
- package/dist/arm-managementgroups.js.map +0 -1
- package/dist/arm-managementgroups.min.js +0 -1
- package/dist/arm-managementgroups.min.js.map +0 -1
- package/esm/managementGroupsAPI.d.ts +0 -68
- package/esm/managementGroupsAPI.d.ts.map +0 -1
- package/esm/managementGroupsAPI.js +0 -115
- package/esm/managementGroupsAPI.js.map +0 -1
- package/esm/managementGroupsAPIContext.d.ts +0 -14
- package/esm/managementGroupsAPIContext.d.ts.map +0 -1
- package/esm/managementGroupsAPIContext.js +0 -51
- package/esm/managementGroupsAPIContext.js.map +0 -1
- package/esm/models/entitiesMappers.d.ts +0 -2
- package/esm/models/entitiesMappers.d.ts.map +0 -1
- package/esm/models/entitiesMappers.js +0 -11
- package/esm/models/entitiesMappers.js.map +0 -1
- package/esm/models/index.d.ts +0 -1390
- package/esm/models/index.d.ts.map +0 -1
- package/esm/models/index.js +0 -10
- package/esm/models/index.js.map +0 -1
- package/esm/models/managementGroupSubscriptionsMappers.d.ts +0 -2
- package/esm/models/managementGroupSubscriptionsMappers.d.ts.map +0 -1
- package/esm/models/managementGroupSubscriptionsMappers.js +0 -11
- package/esm/models/managementGroupSubscriptionsMappers.js.map +0 -1
- package/esm/models/managementGroupsMappers.d.ts +0 -2
- package/esm/models/managementGroupsMappers.d.ts.map +0 -1
- package/esm/models/managementGroupsMappers.js +0 -11
- package/esm/models/managementGroupsMappers.js.map +0 -1
- package/esm/models/mappers.d.ts +0 -28
- package/esm/models/mappers.d.ts.map +0 -1
- package/esm/models/mappers.js.map +0 -1
- package/esm/models/operationsMappers.d.ts +0 -2
- package/esm/models/operationsMappers.d.ts.map +0 -1
- package/esm/models/operationsMappers.js +0 -11
- package/esm/models/operationsMappers.js.map +0 -1
- package/esm/models/parameters.d.ts +0 -18
- package/esm/models/parameters.d.ts.map +0 -1
- package/esm/models/parameters.js +0 -194
- package/esm/models/parameters.js.map +0 -1
- package/esm/operations/entities.d.ts +0 -46
- package/esm/operations/entities.d.ts.map +0 -1
- package/esm/operations/entities.js +0 -87
- package/esm/operations/entities.js.map +0 -1
- package/esm/operations/index.d.ts.map +0 -1
- package/esm/operations/index.js.map +0 -1
- package/esm/operations/managementGroupSubscriptions.d.ts +0 -55
- package/esm/operations/managementGroupSubscriptions.d.ts.map +0 -1
- package/esm/operations/managementGroupSubscriptions.js +0 -85
- package/esm/operations/managementGroupSubscriptions.js.map +0 -1
- package/esm/operations/managementGroups.d.ts +0 -120
- package/esm/operations/managementGroups.d.ts.map +0 -1
- package/esm/operations/managementGroups.js +0 -252
- package/esm/operations/managementGroups.js.map +0 -1
- package/esm/operations/operations.d.ts +0 -46
- package/esm/operations/operations.d.ts.map +0 -1
- package/esm/operations/operations.js +0 -77
- package/esm/operations/operations.js.map +0 -1
- package/lib/managementGroupsAPI.ts +0 -191
- package/lib/managementGroupsAPIContext.ts +0 -56
- package/lib/models/entitiesMappers.ts +0 -18
- package/lib/models/index.ts +0 -1466
- package/lib/models/managementGroupSubscriptionsMappers.ts +0 -15
- package/lib/models/managementGroupsMappers.ts +0 -29
- package/lib/models/operationsMappers.ts +0 -18
- package/lib/models/parameters.ts +0 -196
- package/lib/operations/entities.ts +0 -133
- package/lib/operations/managementGroupSubscriptions.ts +0 -140
- package/lib/operations/managementGroups.ts +0 -365
- package/lib/operations/operations.ts +0 -123
|
@@ -0,0 +1,592 @@
|
|
|
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 { ManagementGroups } 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 { ManagementGroupsAPIContext } from "../managementGroupsAPIContext";
|
|
15
|
+
import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro";
|
|
16
|
+
import { LroImpl } from "../lroImpl";
|
|
17
|
+
import {
|
|
18
|
+
ManagementGroupInfo,
|
|
19
|
+
ManagementGroupsListNextOptionalParams,
|
|
20
|
+
ManagementGroupsListOptionalParams,
|
|
21
|
+
DescendantInfo,
|
|
22
|
+
ManagementGroupsGetDescendantsNextOptionalParams,
|
|
23
|
+
ManagementGroupsGetDescendantsOptionalParams,
|
|
24
|
+
ManagementGroupsListResponse,
|
|
25
|
+
ManagementGroupsGetOptionalParams,
|
|
26
|
+
ManagementGroupsGetResponse,
|
|
27
|
+
CreateManagementGroupRequest,
|
|
28
|
+
ManagementGroupsCreateOrUpdateOptionalParams,
|
|
29
|
+
ManagementGroupsCreateOrUpdateResponse,
|
|
30
|
+
PatchManagementGroupRequest,
|
|
31
|
+
ManagementGroupsUpdateOptionalParams,
|
|
32
|
+
ManagementGroupsUpdateResponse,
|
|
33
|
+
ManagementGroupsDeleteOptionalParams,
|
|
34
|
+
ManagementGroupsDeleteResponse,
|
|
35
|
+
ManagementGroupsGetDescendantsResponse,
|
|
36
|
+
ManagementGroupsListNextResponse,
|
|
37
|
+
ManagementGroupsGetDescendantsNextResponse
|
|
38
|
+
} from "../models";
|
|
39
|
+
|
|
40
|
+
/// <reference lib="esnext.asynciterable" />
|
|
41
|
+
/** Class containing ManagementGroups operations. */
|
|
42
|
+
export class ManagementGroupsImpl implements ManagementGroups {
|
|
43
|
+
private readonly client: ManagementGroupsAPIContext;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Initialize a new instance of the class ManagementGroups class.
|
|
47
|
+
* @param client Reference to the service client
|
|
48
|
+
*/
|
|
49
|
+
constructor(client: ManagementGroupsAPIContext) {
|
|
50
|
+
this.client = client;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* List management groups for the authenticated user.
|
|
55
|
+
*
|
|
56
|
+
* @param options The options parameters.
|
|
57
|
+
*/
|
|
58
|
+
public list(
|
|
59
|
+
options?: ManagementGroupsListOptionalParams
|
|
60
|
+
): PagedAsyncIterableIterator<ManagementGroupInfo> {
|
|
61
|
+
const iter = this.listPagingAll(options);
|
|
62
|
+
return {
|
|
63
|
+
next() {
|
|
64
|
+
return iter.next();
|
|
65
|
+
},
|
|
66
|
+
[Symbol.asyncIterator]() {
|
|
67
|
+
return this;
|
|
68
|
+
},
|
|
69
|
+
byPage: () => {
|
|
70
|
+
return this.listPagingPage(options);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private async *listPagingPage(
|
|
76
|
+
options?: ManagementGroupsListOptionalParams
|
|
77
|
+
): AsyncIterableIterator<ManagementGroupInfo[]> {
|
|
78
|
+
let result = await this._list(options);
|
|
79
|
+
yield result.value || [];
|
|
80
|
+
let continuationToken = result.nextLink;
|
|
81
|
+
while (continuationToken) {
|
|
82
|
+
result = await this._listNext(continuationToken, options);
|
|
83
|
+
continuationToken = result.nextLink;
|
|
84
|
+
yield result.value || [];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private async *listPagingAll(
|
|
89
|
+
options?: ManagementGroupsListOptionalParams
|
|
90
|
+
): AsyncIterableIterator<ManagementGroupInfo> {
|
|
91
|
+
for await (const page of this.listPagingPage(options)) {
|
|
92
|
+
yield* page;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* List all entities that descend from a management group.
|
|
98
|
+
*
|
|
99
|
+
* @param groupId Management Group ID.
|
|
100
|
+
* @param options The options parameters.
|
|
101
|
+
*/
|
|
102
|
+
public listDescendants(
|
|
103
|
+
groupId: string,
|
|
104
|
+
options?: ManagementGroupsGetDescendantsOptionalParams
|
|
105
|
+
): PagedAsyncIterableIterator<DescendantInfo> {
|
|
106
|
+
const iter = this.getDescendantsPagingAll(groupId, options);
|
|
107
|
+
return {
|
|
108
|
+
next() {
|
|
109
|
+
return iter.next();
|
|
110
|
+
},
|
|
111
|
+
[Symbol.asyncIterator]() {
|
|
112
|
+
return this;
|
|
113
|
+
},
|
|
114
|
+
byPage: () => {
|
|
115
|
+
return this.getDescendantsPagingPage(groupId, options);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private async *getDescendantsPagingPage(
|
|
121
|
+
groupId: string,
|
|
122
|
+
options?: ManagementGroupsGetDescendantsOptionalParams
|
|
123
|
+
): AsyncIterableIterator<DescendantInfo[]> {
|
|
124
|
+
let result = await this._getDescendants(groupId, options);
|
|
125
|
+
yield result.value || [];
|
|
126
|
+
let continuationToken = result.nextLink;
|
|
127
|
+
while (continuationToken) {
|
|
128
|
+
result = await this._getDescendantsNext(
|
|
129
|
+
groupId,
|
|
130
|
+
continuationToken,
|
|
131
|
+
options
|
|
132
|
+
);
|
|
133
|
+
continuationToken = result.nextLink;
|
|
134
|
+
yield result.value || [];
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private async *getDescendantsPagingAll(
|
|
139
|
+
groupId: string,
|
|
140
|
+
options?: ManagementGroupsGetDescendantsOptionalParams
|
|
141
|
+
): AsyncIterableIterator<DescendantInfo> {
|
|
142
|
+
for await (const page of this.getDescendantsPagingPage(groupId, options)) {
|
|
143
|
+
yield* page;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* List management groups for the authenticated user.
|
|
149
|
+
*
|
|
150
|
+
* @param options The options parameters.
|
|
151
|
+
*/
|
|
152
|
+
private _list(
|
|
153
|
+
options?: ManagementGroupsListOptionalParams
|
|
154
|
+
): Promise<ManagementGroupsListResponse> {
|
|
155
|
+
return this.client.sendOperationRequest({ options }, listOperationSpec);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Get the details of the management group.
|
|
160
|
+
*
|
|
161
|
+
* @param groupId Management Group ID.
|
|
162
|
+
* @param options The options parameters.
|
|
163
|
+
*/
|
|
164
|
+
get(
|
|
165
|
+
groupId: string,
|
|
166
|
+
options?: ManagementGroupsGetOptionalParams
|
|
167
|
+
): Promise<ManagementGroupsGetResponse> {
|
|
168
|
+
return this.client.sendOperationRequest(
|
|
169
|
+
{ groupId, options },
|
|
170
|
+
getOperationSpec
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Create or update a management group.
|
|
176
|
+
* If a management group is already created and a subsequent create request is issued with different
|
|
177
|
+
* properties, the management group properties will be updated.
|
|
178
|
+
*
|
|
179
|
+
* @param groupId Management Group ID.
|
|
180
|
+
* @param createManagementGroupRequest Management group creation parameters.
|
|
181
|
+
* @param options The options parameters.
|
|
182
|
+
*/
|
|
183
|
+
async beginCreateOrUpdate(
|
|
184
|
+
groupId: string,
|
|
185
|
+
createManagementGroupRequest: CreateManagementGroupRequest,
|
|
186
|
+
options?: ManagementGroupsCreateOrUpdateOptionalParams
|
|
187
|
+
): Promise<
|
|
188
|
+
PollerLike<
|
|
189
|
+
PollOperationState<ManagementGroupsCreateOrUpdateResponse>,
|
|
190
|
+
ManagementGroupsCreateOrUpdateResponse
|
|
191
|
+
>
|
|
192
|
+
> {
|
|
193
|
+
const directSendOperation = async (
|
|
194
|
+
args: coreClient.OperationArguments,
|
|
195
|
+
spec: coreClient.OperationSpec
|
|
196
|
+
): Promise<ManagementGroupsCreateOrUpdateResponse> => {
|
|
197
|
+
return this.client.sendOperationRequest(args, spec);
|
|
198
|
+
};
|
|
199
|
+
const sendOperation = async (
|
|
200
|
+
args: coreClient.OperationArguments,
|
|
201
|
+
spec: coreClient.OperationSpec
|
|
202
|
+
) => {
|
|
203
|
+
let currentRawResponse:
|
|
204
|
+
| coreClient.FullOperationResponse
|
|
205
|
+
| undefined = undefined;
|
|
206
|
+
const providedCallback = args.options?.onResponse;
|
|
207
|
+
const callback: coreClient.RawResponseCallback = (
|
|
208
|
+
rawResponse: coreClient.FullOperationResponse,
|
|
209
|
+
flatResponse: unknown
|
|
210
|
+
) => {
|
|
211
|
+
currentRawResponse = rawResponse;
|
|
212
|
+
providedCallback?.(rawResponse, flatResponse);
|
|
213
|
+
};
|
|
214
|
+
const updatedArgs = {
|
|
215
|
+
...args,
|
|
216
|
+
options: {
|
|
217
|
+
...args.options,
|
|
218
|
+
onResponse: callback
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const flatResponse = await directSendOperation(updatedArgs, spec);
|
|
222
|
+
return {
|
|
223
|
+
flatResponse,
|
|
224
|
+
rawResponse: {
|
|
225
|
+
statusCode: currentRawResponse!.status,
|
|
226
|
+
body: currentRawResponse!.parsedBody,
|
|
227
|
+
headers: currentRawResponse!.headers.toJSON()
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
const lro = new LroImpl(
|
|
233
|
+
sendOperation,
|
|
234
|
+
{ groupId, createManagementGroupRequest, options },
|
|
235
|
+
createOrUpdateOperationSpec
|
|
236
|
+
);
|
|
237
|
+
return new LroEngine(lro, {
|
|
238
|
+
resumeFrom: options?.resumeFrom,
|
|
239
|
+
intervalInMs: options?.updateIntervalInMs,
|
|
240
|
+
lroResourceLocationConfig: "azure-async-operation"
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Create or update a management group.
|
|
246
|
+
* If a management group is already created and a subsequent create request is issued with different
|
|
247
|
+
* properties, the management group properties will be updated.
|
|
248
|
+
*
|
|
249
|
+
* @param groupId Management Group ID.
|
|
250
|
+
* @param createManagementGroupRequest Management group creation parameters.
|
|
251
|
+
* @param options The options parameters.
|
|
252
|
+
*/
|
|
253
|
+
async beginCreateOrUpdateAndWait(
|
|
254
|
+
groupId: string,
|
|
255
|
+
createManagementGroupRequest: CreateManagementGroupRequest,
|
|
256
|
+
options?: ManagementGroupsCreateOrUpdateOptionalParams
|
|
257
|
+
): Promise<ManagementGroupsCreateOrUpdateResponse> {
|
|
258
|
+
const poller = await this.beginCreateOrUpdate(
|
|
259
|
+
groupId,
|
|
260
|
+
createManagementGroupRequest,
|
|
261
|
+
options
|
|
262
|
+
);
|
|
263
|
+
return poller.pollUntilDone();
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Update a management group.
|
|
268
|
+
*
|
|
269
|
+
* @param groupId Management Group ID.
|
|
270
|
+
* @param patchGroupRequest Management group patch parameters.
|
|
271
|
+
* @param options The options parameters.
|
|
272
|
+
*/
|
|
273
|
+
update(
|
|
274
|
+
groupId: string,
|
|
275
|
+
patchGroupRequest: PatchManagementGroupRequest,
|
|
276
|
+
options?: ManagementGroupsUpdateOptionalParams
|
|
277
|
+
): Promise<ManagementGroupsUpdateResponse> {
|
|
278
|
+
return this.client.sendOperationRequest(
|
|
279
|
+
{ groupId, patchGroupRequest, options },
|
|
280
|
+
updateOperationSpec
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Delete management group.
|
|
286
|
+
* If a management group contains child resources, the request will fail.
|
|
287
|
+
*
|
|
288
|
+
* @param groupId Management Group ID.
|
|
289
|
+
* @param options The options parameters.
|
|
290
|
+
*/
|
|
291
|
+
async beginDelete(
|
|
292
|
+
groupId: string,
|
|
293
|
+
options?: ManagementGroupsDeleteOptionalParams
|
|
294
|
+
): Promise<
|
|
295
|
+
PollerLike<
|
|
296
|
+
PollOperationState<ManagementGroupsDeleteResponse>,
|
|
297
|
+
ManagementGroupsDeleteResponse
|
|
298
|
+
>
|
|
299
|
+
> {
|
|
300
|
+
const directSendOperation = async (
|
|
301
|
+
args: coreClient.OperationArguments,
|
|
302
|
+
spec: coreClient.OperationSpec
|
|
303
|
+
): Promise<ManagementGroupsDeleteResponse> => {
|
|
304
|
+
return this.client.sendOperationRequest(args, spec);
|
|
305
|
+
};
|
|
306
|
+
const sendOperation = async (
|
|
307
|
+
args: coreClient.OperationArguments,
|
|
308
|
+
spec: coreClient.OperationSpec
|
|
309
|
+
) => {
|
|
310
|
+
let currentRawResponse:
|
|
311
|
+
| coreClient.FullOperationResponse
|
|
312
|
+
| undefined = undefined;
|
|
313
|
+
const providedCallback = args.options?.onResponse;
|
|
314
|
+
const callback: coreClient.RawResponseCallback = (
|
|
315
|
+
rawResponse: coreClient.FullOperationResponse,
|
|
316
|
+
flatResponse: unknown
|
|
317
|
+
) => {
|
|
318
|
+
currentRawResponse = rawResponse;
|
|
319
|
+
providedCallback?.(rawResponse, flatResponse);
|
|
320
|
+
};
|
|
321
|
+
const updatedArgs = {
|
|
322
|
+
...args,
|
|
323
|
+
options: {
|
|
324
|
+
...args.options,
|
|
325
|
+
onResponse: callback
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
const flatResponse = await directSendOperation(updatedArgs, spec);
|
|
329
|
+
return {
|
|
330
|
+
flatResponse,
|
|
331
|
+
rawResponse: {
|
|
332
|
+
statusCode: currentRawResponse!.status,
|
|
333
|
+
body: currentRawResponse!.parsedBody,
|
|
334
|
+
headers: currentRawResponse!.headers.toJSON()
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
const lro = new LroImpl(
|
|
340
|
+
sendOperation,
|
|
341
|
+
{ groupId, options },
|
|
342
|
+
deleteOperationSpec
|
|
343
|
+
);
|
|
344
|
+
return new LroEngine(lro, {
|
|
345
|
+
resumeFrom: options?.resumeFrom,
|
|
346
|
+
intervalInMs: options?.updateIntervalInMs,
|
|
347
|
+
lroResourceLocationConfig: "azure-async-operation"
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Delete management group.
|
|
353
|
+
* If a management group contains child resources, the request will fail.
|
|
354
|
+
*
|
|
355
|
+
* @param groupId Management Group ID.
|
|
356
|
+
* @param options The options parameters.
|
|
357
|
+
*/
|
|
358
|
+
async beginDeleteAndWait(
|
|
359
|
+
groupId: string,
|
|
360
|
+
options?: ManagementGroupsDeleteOptionalParams
|
|
361
|
+
): Promise<ManagementGroupsDeleteResponse> {
|
|
362
|
+
const poller = await this.beginDelete(groupId, options);
|
|
363
|
+
return poller.pollUntilDone();
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* List all entities that descend from a management group.
|
|
368
|
+
*
|
|
369
|
+
* @param groupId Management Group ID.
|
|
370
|
+
* @param options The options parameters.
|
|
371
|
+
*/
|
|
372
|
+
private _getDescendants(
|
|
373
|
+
groupId: string,
|
|
374
|
+
options?: ManagementGroupsGetDescendantsOptionalParams
|
|
375
|
+
): Promise<ManagementGroupsGetDescendantsResponse> {
|
|
376
|
+
return this.client.sendOperationRequest(
|
|
377
|
+
{ groupId, options },
|
|
378
|
+
getDescendantsOperationSpec
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* ListNext
|
|
384
|
+
* @param nextLink The nextLink from the previous successful call to the List method.
|
|
385
|
+
* @param options The options parameters.
|
|
386
|
+
*/
|
|
387
|
+
private _listNext(
|
|
388
|
+
nextLink: string,
|
|
389
|
+
options?: ManagementGroupsListNextOptionalParams
|
|
390
|
+
): Promise<ManagementGroupsListNextResponse> {
|
|
391
|
+
return this.client.sendOperationRequest(
|
|
392
|
+
{ nextLink, options },
|
|
393
|
+
listNextOperationSpec
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* GetDescendantsNext
|
|
399
|
+
* @param groupId Management Group ID.
|
|
400
|
+
* @param nextLink The nextLink from the previous successful call to the GetDescendants method.
|
|
401
|
+
* @param options The options parameters.
|
|
402
|
+
*/
|
|
403
|
+
private _getDescendantsNext(
|
|
404
|
+
groupId: string,
|
|
405
|
+
nextLink: string,
|
|
406
|
+
options?: ManagementGroupsGetDescendantsNextOptionalParams
|
|
407
|
+
): Promise<ManagementGroupsGetDescendantsNextResponse> {
|
|
408
|
+
return this.client.sendOperationRequest(
|
|
409
|
+
{ groupId, nextLink, options },
|
|
410
|
+
getDescendantsNextOperationSpec
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
// Operation Specifications
|
|
415
|
+
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
|
|
416
|
+
|
|
417
|
+
const listOperationSpec: coreClient.OperationSpec = {
|
|
418
|
+
path: "/providers/Microsoft.Management/managementGroups",
|
|
419
|
+
httpMethod: "GET",
|
|
420
|
+
responses: {
|
|
421
|
+
200: {
|
|
422
|
+
bodyMapper: Mappers.ManagementGroupListResult
|
|
423
|
+
},
|
|
424
|
+
default: {
|
|
425
|
+
bodyMapper: Mappers.ErrorResponse
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
queryParameters: [Parameters.apiVersion, Parameters.skiptoken],
|
|
429
|
+
urlParameters: [Parameters.$host],
|
|
430
|
+
headerParameters: [Parameters.accept, Parameters.cacheControl],
|
|
431
|
+
serializer
|
|
432
|
+
};
|
|
433
|
+
const getOperationSpec: coreClient.OperationSpec = {
|
|
434
|
+
path: "/providers/Microsoft.Management/managementGroups/{groupId}",
|
|
435
|
+
httpMethod: "GET",
|
|
436
|
+
responses: {
|
|
437
|
+
200: {
|
|
438
|
+
bodyMapper: Mappers.ManagementGroup
|
|
439
|
+
},
|
|
440
|
+
default: {
|
|
441
|
+
bodyMapper: Mappers.ErrorResponse
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
queryParameters: [
|
|
445
|
+
Parameters.apiVersion,
|
|
446
|
+
Parameters.expand,
|
|
447
|
+
Parameters.recurse,
|
|
448
|
+
Parameters.filter
|
|
449
|
+
],
|
|
450
|
+
urlParameters: [Parameters.$host, Parameters.groupId],
|
|
451
|
+
headerParameters: [Parameters.accept, Parameters.cacheControl],
|
|
452
|
+
serializer
|
|
453
|
+
};
|
|
454
|
+
const createOrUpdateOperationSpec: coreClient.OperationSpec = {
|
|
455
|
+
path: "/providers/Microsoft.Management/managementGroups/{groupId}",
|
|
456
|
+
httpMethod: "PUT",
|
|
457
|
+
responses: {
|
|
458
|
+
200: {
|
|
459
|
+
bodyMapper: Mappers.ManagementGroup
|
|
460
|
+
},
|
|
461
|
+
201: {
|
|
462
|
+
bodyMapper: Mappers.ManagementGroup
|
|
463
|
+
},
|
|
464
|
+
202: {
|
|
465
|
+
bodyMapper: Mappers.ManagementGroup
|
|
466
|
+
},
|
|
467
|
+
204: {
|
|
468
|
+
bodyMapper: Mappers.ManagementGroup
|
|
469
|
+
},
|
|
470
|
+
default: {
|
|
471
|
+
bodyMapper: Mappers.ErrorResponse
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
requestBody: Parameters.createManagementGroupRequest,
|
|
475
|
+
queryParameters: [Parameters.apiVersion],
|
|
476
|
+
urlParameters: [Parameters.$host, Parameters.groupId],
|
|
477
|
+
headerParameters: [
|
|
478
|
+
Parameters.accept,
|
|
479
|
+
Parameters.cacheControl,
|
|
480
|
+
Parameters.contentType
|
|
481
|
+
],
|
|
482
|
+
mediaType: "json",
|
|
483
|
+
serializer
|
|
484
|
+
};
|
|
485
|
+
const updateOperationSpec: coreClient.OperationSpec = {
|
|
486
|
+
path: "/providers/Microsoft.Management/managementGroups/{groupId}",
|
|
487
|
+
httpMethod: "PATCH",
|
|
488
|
+
responses: {
|
|
489
|
+
200: {
|
|
490
|
+
bodyMapper: Mappers.ManagementGroup
|
|
491
|
+
},
|
|
492
|
+
default: {
|
|
493
|
+
bodyMapper: Mappers.ErrorResponse
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
requestBody: Parameters.patchGroupRequest,
|
|
497
|
+
queryParameters: [Parameters.apiVersion],
|
|
498
|
+
urlParameters: [Parameters.$host, Parameters.groupId],
|
|
499
|
+
headerParameters: [
|
|
500
|
+
Parameters.accept,
|
|
501
|
+
Parameters.cacheControl,
|
|
502
|
+
Parameters.contentType
|
|
503
|
+
],
|
|
504
|
+
mediaType: "json",
|
|
505
|
+
serializer
|
|
506
|
+
};
|
|
507
|
+
const deleteOperationSpec: coreClient.OperationSpec = {
|
|
508
|
+
path: "/providers/Microsoft.Management/managementGroups/{groupId}",
|
|
509
|
+
httpMethod: "DELETE",
|
|
510
|
+
responses: {
|
|
511
|
+
200: {
|
|
512
|
+
bodyMapper: Mappers.AzureAsyncOperationResults,
|
|
513
|
+
headersMapper: Mappers.ManagementGroupsDeleteHeaders
|
|
514
|
+
},
|
|
515
|
+
201: {
|
|
516
|
+
bodyMapper: Mappers.AzureAsyncOperationResults,
|
|
517
|
+
headersMapper: Mappers.ManagementGroupsDeleteHeaders
|
|
518
|
+
},
|
|
519
|
+
202: {
|
|
520
|
+
bodyMapper: Mappers.AzureAsyncOperationResults,
|
|
521
|
+
headersMapper: Mappers.ManagementGroupsDeleteHeaders
|
|
522
|
+
},
|
|
523
|
+
204: {
|
|
524
|
+
bodyMapper: Mappers.AzureAsyncOperationResults,
|
|
525
|
+
headersMapper: Mappers.ManagementGroupsDeleteHeaders
|
|
526
|
+
},
|
|
527
|
+
default: {
|
|
528
|
+
bodyMapper: Mappers.ErrorResponse
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
queryParameters: [Parameters.apiVersion],
|
|
532
|
+
urlParameters: [Parameters.$host, Parameters.groupId],
|
|
533
|
+
headerParameters: [Parameters.accept, Parameters.cacheControl],
|
|
534
|
+
serializer
|
|
535
|
+
};
|
|
536
|
+
const getDescendantsOperationSpec: coreClient.OperationSpec = {
|
|
537
|
+
path:
|
|
538
|
+
"/providers/Microsoft.Management/managementGroups/{groupId}/descendants",
|
|
539
|
+
httpMethod: "GET",
|
|
540
|
+
responses: {
|
|
541
|
+
200: {
|
|
542
|
+
bodyMapper: Mappers.DescendantListResult
|
|
543
|
+
},
|
|
544
|
+
default: {
|
|
545
|
+
bodyMapper: Mappers.ErrorResponse
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
queryParameters: [
|
|
549
|
+
Parameters.apiVersion,
|
|
550
|
+
Parameters.skiptoken,
|
|
551
|
+
Parameters.top
|
|
552
|
+
],
|
|
553
|
+
urlParameters: [Parameters.$host, Parameters.groupId],
|
|
554
|
+
headerParameters: [Parameters.accept],
|
|
555
|
+
serializer
|
|
556
|
+
};
|
|
557
|
+
const listNextOperationSpec: coreClient.OperationSpec = {
|
|
558
|
+
path: "{nextLink}",
|
|
559
|
+
httpMethod: "GET",
|
|
560
|
+
responses: {
|
|
561
|
+
200: {
|
|
562
|
+
bodyMapper: Mappers.ManagementGroupListResult
|
|
563
|
+
},
|
|
564
|
+
default: {
|
|
565
|
+
bodyMapper: Mappers.ErrorResponse
|
|
566
|
+
}
|
|
567
|
+
},
|
|
568
|
+
queryParameters: [Parameters.apiVersion, Parameters.skiptoken],
|
|
569
|
+
urlParameters: [Parameters.$host, Parameters.nextLink],
|
|
570
|
+
headerParameters: [Parameters.accept, Parameters.cacheControl],
|
|
571
|
+
serializer
|
|
572
|
+
};
|
|
573
|
+
const getDescendantsNextOperationSpec: coreClient.OperationSpec = {
|
|
574
|
+
path: "{nextLink}",
|
|
575
|
+
httpMethod: "GET",
|
|
576
|
+
responses: {
|
|
577
|
+
200: {
|
|
578
|
+
bodyMapper: Mappers.DescendantListResult
|
|
579
|
+
},
|
|
580
|
+
default: {
|
|
581
|
+
bodyMapper: Mappers.ErrorResponse
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
queryParameters: [
|
|
585
|
+
Parameters.apiVersion,
|
|
586
|
+
Parameters.skiptoken,
|
|
587
|
+
Parameters.top
|
|
588
|
+
],
|
|
589
|
+
urlParameters: [Parameters.$host, Parameters.groupId, Parameters.nextLink],
|
|
590
|
+
headerParameters: [Parameters.accept],
|
|
591
|
+
serializer
|
|
592
|
+
};
|