diff --git a/sdk/managementgroups/arm-managementgroups/src/managementGroupsAPIContext.ts b/sdk/managementgroups/arm-managementgroups/src/managementGroupsAPIContext.ts index 464d9645d43f..2288e8176315 100644 --- a/sdk/managementgroups/arm-managementgroups/src/managementGroupsAPIContext.ts +++ b/sdk/managementgroups/arm-managementgroups/src/managementGroupsAPIContext.ts @@ -48,7 +48,7 @@ export class ManagementGroupsAPIContext extends msRestAzure.AzureServiceClient { super(credentials, options); - this.apiVersion = '2020-02-01'; + this.apiVersion = '2020-05-01'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; diff --git a/sdk/managementgroups/arm-managementgroups/src/models/hierarchySettingsOperationsMappers.ts b/sdk/managementgroups/arm-managementgroups/src/models/hierarchySettingsOperationsMappers.ts index 626601d9efc1..2c05760d58bb 100644 --- a/sdk/managementgroups/arm-managementgroups/src/models/hierarchySettingsOperationsMappers.ts +++ b/sdk/managementgroups/arm-managementgroups/src/models/hierarchySettingsOperationsMappers.ts @@ -13,6 +13,7 @@ export { CreateManagementGroupRequest, CreateOrUpdateSettingsRequest, CreateParentGroupInfo, + DescendantParentGroupInfo, EntityHierarchyItem, ErrorDetails, ErrorResponse, @@ -23,5 +24,6 @@ export { ManagementGroupChildInfo, ManagementGroupDetails, ManagementGroupPathElement, - ParentGroupInfo + ParentGroupInfo, + SubscriptionUnderManagementGroup } from "../models/mappers"; diff --git a/sdk/managementgroups/arm-managementgroups/src/models/index.ts b/sdk/managementgroups/arm-managementgroups/src/models/index.ts index ac90464b2f29..d0cc39daece0 100644 --- a/sdk/managementgroups/arm-managementgroups/src/models/index.ts +++ b/sdk/managementgroups/arm-managementgroups/src/models/index.ts @@ -157,6 +157,56 @@ export interface ManagementGroupInfo { displayName?: string; } +/** + * The ID of the parent management group. + */ +export interface DescendantParentGroupInfo { + /** + * The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + id?: string; +} + +/** + * The details of subscription under management group. + */ +export interface SubscriptionUnderManagementGroup extends BaseResource { + /** + * The fully qualified ID for the subscription. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/subscriptions/0000000-0000-0000-0000-000000000001 + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly id?: string; + /** + * The type of the resource. For example, Microsoft.Management/managementGroups/subscriptions + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly type?: string; + /** + * The stringified id of the subscription. For example, 00000000-0000-0000-0000-000000000000 + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly name?: string; + /** + * The AAD Tenant ID associated with the subscription. For example, + * 00000000-0000-0000-0000-000000000000 + */ + tenant?: string; + /** + * The friendly name of the subscription. + */ + displayName?: string; + /** + * Parent. + */ + parent?: DescendantParentGroupInfo; + /** + * The state of the subscription. + */ + state?: string; +} + /** * (Optional) The ID of the parent management group. */ @@ -221,10 +271,6 @@ export interface ManagementGroupChildInfo { * The friendly name of the child resource. */ displayName?: string; - /** - * The roles definitions associated with the management group. - */ - roles?: string[]; /** * The list of children. */ @@ -274,10 +320,6 @@ export interface ManagementGroup extends BaseResource { * The friendly name of the management group. */ displayName?: string; - /** - * The role definitions associated with the management group. - */ - roles?: string[]; /** * Details. */ @@ -471,17 +513,6 @@ export interface CreateOrUpdateSettingsRequest extends BaseResource { defaultManagementGroup?: string; } -/** - * The ID of the parent management group. - */ -export interface DescendantParentGroupInfo { - /** - * The fully qualified ID for the parent management group. For example, - * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - */ - id?: string; -} - /** * The descendant. */ @@ -635,7 +666,7 @@ export interface PatchManagementGroupRequest { * (Optional) The fully qualified ID for the parent management group. For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 */ - parentId?: string; + parentGroupId?: string; } /** @@ -711,11 +742,6 @@ export interface CreateManagementGroupChildInfo { * **NOTE: This property will not be serialized. It can only be populated by the server.** */ readonly displayName?: string; - /** - * The roles definitions associated with the management group. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly roles?: string[]; /** * The list of children. * **NOTE: This property will not be serialized. It can only be populated by the server.** @@ -753,11 +779,6 @@ export interface CreateManagementGroupRequest extends BaseResource { * to the groupId. */ displayName?: string; - /** - * The roles definitions associated with the management group. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly roles?: string[]; /** * Details. */ @@ -779,7 +800,7 @@ export interface CheckNameAvailabilityRequest { name?: string; /** * fully qualified resource type which includes provider namespace. Possible values include: - * 'Microsoft.Management/managementGroup' + * 'Microsoft.Management/managementGroups' */ type?: Type; } @@ -901,6 +922,16 @@ export interface ManagementGroupSubscriptionsDeleteMethodOptionalParams extends cacheControl?: string; } +/** + * Optional Parameters. + */ +export interface ManagementGroupSubscriptionsGetSubscriptionOptionalParams extends msRest.RequestOptionsBase { + /** + * Indicates that the request shouldn't utilize any caches. Default value: 'no-cache'. + */ + cacheControl?: string; +} + /** * Optional Parameters. */ @@ -1065,6 +1096,19 @@ export interface DescendantListResult extends Array { readonly nextLink?: string; } +/** + * @interface + * The details of all subscriptions under management group. + * @extends Array + */ +export interface ListSubscriptionUnderManagementGroup extends Array { + /** + * The URL to use for getting the next set of results. + * **NOTE: This property will not be serialized. It can only be populated by the server.** + */ + readonly nextLink?: string; +} + /** * @interface * Describes the result of the request to list Microsoft.Management operations. @@ -1115,11 +1159,11 @@ export type Status = 'NotStarted' | 'NotStartedButGroupsExist' | 'Started' | 'Fa /** * Defines values for Type. - * Possible values include: 'Microsoft.Management/managementGroup' + * Possible values include: 'Microsoft.Management/managementGroups' * @readonly * @enum {string} */ -export type Type = 'Microsoft.Management/managementGroup'; +export type Type = 'Microsoft.Management/managementGroups'; /** * Defines values for Type1. @@ -1361,6 +1405,86 @@ export type ManagementGroupsGetDescendantsNextResponse = DescendantListResult & }; }; +/** + * Contains response data for the create operation. + */ +export type ManagementGroupSubscriptionsCreateResponse = SubscriptionUnderManagementGroup & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SubscriptionUnderManagementGroup; + }; +}; + +/** + * Contains response data for the getSubscription operation. + */ +export type ManagementGroupSubscriptionsGetSubscriptionResponse = SubscriptionUnderManagementGroup & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: SubscriptionUnderManagementGroup; + }; +}; + +/** + * Contains response data for the getSubscriptionsUnderManagementGroup operation. + */ +export type ManagementGroupSubscriptionsGetSubscriptionsUnderManagementGroupResponse = ListSubscriptionUnderManagementGroup & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ListSubscriptionUnderManagementGroup; + }; +}; + +/** + * Contains response data for the getSubscriptionsUnderManagementGroupNext operation. + */ +export type ManagementGroupSubscriptionsGetSubscriptionsUnderManagementGroupNextResponse = ListSubscriptionUnderManagementGroup & { + /** + * The underlying HTTP response. + */ + _response: msRest.HttpResponse & { + /** + * The response body as text (string format) + */ + bodyAsText: string; + + /** + * The response body as parsed JSON or XML + */ + parsedBody: ListSubscriptionUnderManagementGroup; + }; +}; + /** * Contains response data for the list operation. */ diff --git a/sdk/managementgroups/arm-managementgroups/src/models/managementGroupSubscriptionsMappers.ts b/sdk/managementgroups/arm-managementgroups/src/models/managementGroupSubscriptionsMappers.ts index c0c5dd425fbd..a7ae19c9a020 100644 --- a/sdk/managementgroups/arm-managementgroups/src/models/managementGroupSubscriptionsMappers.ts +++ b/sdk/managementgroups/arm-managementgroups/src/models/managementGroupSubscriptionsMappers.ts @@ -7,6 +7,22 @@ */ export { + BaseResource, + CreateManagementGroupChildInfo, + CreateManagementGroupDetails, + CreateManagementGroupRequest, + CreateOrUpdateSettingsRequest, + CreateParentGroupInfo, + DescendantParentGroupInfo, + EntityHierarchyItem, ErrorDetails, - ErrorResponse + ErrorResponse, + HierarchySettings, + ListSubscriptionUnderManagementGroup, + ManagementGroup, + ManagementGroupChildInfo, + ManagementGroupDetails, + ManagementGroupPathElement, + ParentGroupInfo, + SubscriptionUnderManagementGroup } from "../models/mappers"; diff --git a/sdk/managementgroups/arm-managementgroups/src/models/managementGroupsMappers.ts b/sdk/managementgroups/arm-managementgroups/src/models/managementGroupsMappers.ts index 7e45d5c8ac2e..f2d5487080bb 100644 --- a/sdk/managementgroups/arm-managementgroups/src/models/managementGroupsMappers.ts +++ b/sdk/managementgroups/arm-managementgroups/src/models/managementGroupsMappers.ts @@ -30,5 +30,6 @@ export { ManagementGroupsCreateOrUpdateHeaders, ManagementGroupsDeleteHeaders, ParentGroupInfo, - PatchManagementGroupRequest + PatchManagementGroupRequest, + SubscriptionUnderManagementGroup } from "../models/mappers"; diff --git a/sdk/managementgroups/arm-managementgroups/src/models/mappers.ts b/sdk/managementgroups/arm-managementgroups/src/models/mappers.ts index beb8927adfe9..3f419ab97006 100644 --- a/sdk/managementgroups/arm-managementgroups/src/models/mappers.ts +++ b/sdk/managementgroups/arm-managementgroups/src/models/mappers.ts @@ -229,6 +229,79 @@ export const ManagementGroupInfo: msRest.CompositeMapper = { } }; +export const DescendantParentGroupInfo: msRest.CompositeMapper = { + serializedName: "DescendantParentGroupInfo", + type: { + name: "Composite", + className: "DescendantParentGroupInfo", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + } + } + } +}; + +export const SubscriptionUnderManagementGroup: msRest.CompositeMapper = { + serializedName: "SubscriptionUnderManagementGroup", + type: { + name: "Composite", + className: "SubscriptionUnderManagementGroup", + modelProperties: { + id: { + readOnly: true, + serializedName: "id", + type: { + name: "String" + } + }, + type: { + readOnly: true, + serializedName: "type", + type: { + name: "String" + } + }, + name: { + readOnly: true, + serializedName: "name", + type: { + name: "String" + } + }, + tenant: { + serializedName: "properties.tenant", + type: { + name: "String" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + parent: { + nullable: true, + serializedName: "properties.parent", + type: { + name: "Composite", + className: "DescendantParentGroupInfo" + } + }, + state: { + serializedName: "properties.state", + type: { + name: "String" + } + } + } + } +}; + export const ParentGroupInfo: msRest.CompositeMapper = { serializedName: "ParentGroupInfo", type: { @@ -322,17 +395,6 @@ export const ManagementGroupChildInfo: msRest.CompositeMapper = { name: "String" } }, - roles: { - serializedName: "roles", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, children: { serializedName: "children", type: { @@ -410,18 +472,6 @@ export const ManagementGroup: msRest.CompositeMapper = { name: "String" } }, - roles: { - nullable: true, - serializedName: "properties.roles", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, details: { serializedName: "properties.details", type: { @@ -701,22 +751,6 @@ export const CreateOrUpdateSettingsRequest: msRest.CompositeMapper = { } }; -export const DescendantParentGroupInfo: msRest.CompositeMapper = { - serializedName: "DescendantParentGroupInfo", - type: { - name: "Composite", - className: "DescendantParentGroupInfo", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - } - } - } -}; - export const DescendantInfo: msRest.CompositeMapper = { serializedName: "DescendantInfo", type: { @@ -962,9 +996,9 @@ export const PatchManagementGroupRequest: msRest.CompositeMapper = { name: "String" } }, - parentId: { + parentGroupId: { nullable: true, - serializedName: "parentId", + serializedName: "parentGroupId", type: { name: "String" } @@ -1075,18 +1109,6 @@ export const CreateManagementGroupChildInfo: msRest.CompositeMapper = { name: "String" } }, - roles: { - readOnly: true, - serializedName: "roles", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, children: { readOnly: true, serializedName: "children", @@ -1144,19 +1166,6 @@ export const CreateManagementGroupRequest: msRest.CompositeMapper = { name: "String" } }, - roles: { - nullable: true, - readOnly: true, - serializedName: "properties.roles", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, details: { serializedName: "properties.details", type: { @@ -1199,7 +1208,7 @@ export const CheckNameAvailabilityRequest: msRest.CompositeMapper = { type: { name: "Enum", allowedValues: [ - "Microsoft.Management/managementGroup" + "Microsoft.Management/managementGroups" ] } } @@ -1309,6 +1318,35 @@ export const DescendantListResult: msRest.CompositeMapper = { } }; +export const ListSubscriptionUnderManagementGroup: msRest.CompositeMapper = { + serializedName: "ListSubscriptionUnderManagementGroup", + type: { + name: "Composite", + className: "ListSubscriptionUnderManagementGroup", + modelProperties: { + value: { + serializedName: "", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SubscriptionUnderManagementGroup" + } + } + } + }, + nextLink: { + readOnly: true, + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + export const OperationListResult: msRest.CompositeMapper = { serializedName: "OperationListResult", type: { diff --git a/sdk/managementgroups/arm-managementgroups/src/operations/managementGroupSubscriptions.ts b/sdk/managementgroups/arm-managementgroups/src/operations/managementGroupSubscriptions.ts index 0fb4a351cb1e..2c70ad88ee98 100644 --- a/sdk/managementgroups/arm-managementgroups/src/operations/managementGroupSubscriptions.ts +++ b/sdk/managementgroups/arm-managementgroups/src/operations/managementGroupSubscriptions.ts @@ -31,23 +31,23 @@ export class ManagementGroupSubscriptions { * @param groupId Management Group ID. * @param subscriptionId Subscription ID. * @param [options] The optional parameters - * @returns Promise + * @returns Promise */ - create(groupId: string, subscriptionId: string, options?: Models.ManagementGroupSubscriptionsCreateOptionalParams): Promise; + create(groupId: string, subscriptionId: string, options?: Models.ManagementGroupSubscriptionsCreateOptionalParams): Promise; /** * @param groupId Management Group ID. * @param subscriptionId Subscription ID. * @param callback The callback */ - create(groupId: string, subscriptionId: string, callback: msRest.ServiceCallback): void; + create(groupId: string, subscriptionId: string, callback: msRest.ServiceCallback): void; /** * @param groupId Management Group ID. * @param subscriptionId Subscription ID. * @param options The optional parameters * @param callback The callback */ - create(groupId: string, subscriptionId: string, options: Models.ManagementGroupSubscriptionsCreateOptionalParams, callback: msRest.ServiceCallback): void; - create(groupId: string, subscriptionId: string, options?: Models.ManagementGroupSubscriptionsCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + create(groupId: string, subscriptionId: string, options: Models.ManagementGroupSubscriptionsCreateOptionalParams, callback: msRest.ServiceCallback): void; + create(groupId: string, subscriptionId: string, options?: Models.ManagementGroupSubscriptionsCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { return this.client.sendOperationRequest( { groupId, @@ -55,7 +55,7 @@ export class ManagementGroupSubscriptions { options }, createOperationSpec, - callback); + callback) as Promise; } /** @@ -89,6 +89,96 @@ export class ManagementGroupSubscriptions { deleteMethodOperationSpec, callback); } + + /** + * Retrieves details about given subscription which is associated with the management group. + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param [options] The optional parameters + * @returns Promise + */ + getSubscription(groupId: string, subscriptionId: string, options?: Models.ManagementGroupSubscriptionsGetSubscriptionOptionalParams): Promise; + /** + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param callback The callback + */ + getSubscription(groupId: string, subscriptionId: string, callback: msRest.ServiceCallback): void; + /** + * @param groupId Management Group ID. + * @param subscriptionId Subscription ID. + * @param options The optional parameters + * @param callback The callback + */ + getSubscription(groupId: string, subscriptionId: string, options: Models.ManagementGroupSubscriptionsGetSubscriptionOptionalParams, callback: msRest.ServiceCallback): void; + getSubscription(groupId: string, subscriptionId: string, options?: Models.ManagementGroupSubscriptionsGetSubscriptionOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + groupId, + subscriptionId, + options + }, + getSubscriptionOperationSpec, + callback) as Promise; + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * @param groupId Management Group ID. + * @param [options] The optional parameters + * @returns + * Promise + */ + getSubscriptionsUnderManagementGroup(groupId: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param groupId Management Group ID. + * @param callback The callback + */ + getSubscriptionsUnderManagementGroup(groupId: string, callback: msRest.ServiceCallback): void; + /** + * @param groupId Management Group ID. + * @param options The optional parameters + * @param callback The callback + */ + getSubscriptionsUnderManagementGroup(groupId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getSubscriptionsUnderManagementGroup(groupId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + groupId, + options + }, + getSubscriptionsUnderManagementGroupOperationSpec, + callback) as Promise; + } + + /** + * Retrieves details about all subscriptions which are associated with the management group. + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param [options] The optional parameters + * @returns + * Promise + */ + getSubscriptionsUnderManagementGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param callback The callback + */ + getSubscriptionsUnderManagementGroupNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + /** + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param options The optional parameters + * @param callback The callback + */ + getSubscriptionsUnderManagementGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; + getSubscriptionsUnderManagementGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + return this.client.sendOperationRequest( + { + nextPageLink, + options + }, + getSubscriptionsUnderManagementGroupNextOperationSpec, + callback) as Promise; + } } // Operation Specifications @@ -108,8 +198,9 @@ const createOperationSpec: msRest.OperationSpec = { Parameters.acceptLanguage ], responses: { - 200: {}, - 204: {}, + 200: { + bodyMapper: Mappers.SubscriptionUnderManagementGroup + }, default: { bodyMapper: Mappers.ErrorResponse } @@ -140,3 +231,73 @@ const deleteMethodOperationSpec: msRest.OperationSpec = { }, serializer }; + +const getSubscriptionOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}", + urlParameters: [ + Parameters.groupId, + Parameters.subscriptionId + ], + queryParameters: [ + Parameters.apiVersion + ], + headerParameters: [ + Parameters.cacheControl, + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.SubscriptionUnderManagementGroup + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const getSubscriptionsUnderManagementGroupOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + path: "providers/Microsoft.Management/managementGroups/{groupId}/subscriptions", + urlParameters: [ + Parameters.groupId + ], + queryParameters: [ + Parameters.apiVersion, + Parameters.skiptoken + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ListSubscriptionUnderManagementGroup + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +}; + +const getSubscriptionsUnderManagementGroupNextOperationSpec: msRest.OperationSpec = { + httpMethod: "GET", + baseUrl: "https://management.azure.com", + path: "{nextLink}", + urlParameters: [ + Parameters.nextPageLink + ], + headerParameters: [ + Parameters.acceptLanguage + ], + responses: { + 200: { + bodyMapper: Mappers.ListSubscriptionUnderManagementGroup + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + serializer +};