From 771331bc10ae4d2ec791fd21436074acd52c9f44 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Tue, 1 Sep 2020 06:34:35 +0000 Subject: [PATCH] Generated from f9e1635ffe9eb7312399beee4e58888e5679e0a8 Fix managementgroup output-folders in go SDK --- .../src/Generated/EntitiesOperations.cs | 63 +- .../Generated/EntitiesOperationsExtensions.cs | 92 +- .../Generated/HierarchySettingsOperations.cs | 954 ++++++++++++++++++ .../HierarchySettingsOperationsExtensions.cs | 220 ++++ .../src/Generated/IEntitiesOperations.cs | 38 +- .../Generated/IHierarchySettingsOperations.cs | 152 +++ ...IManagementGroupSubscriptionsOperations.cs | 85 +- .../Generated/IManagementGroupsAPIClient.cs | 45 +- .../Generated/IManagementGroupsOperations.cs | 102 +- .../ManagementGroupSubscriptionsOperations.cs | 584 ++++++++++- ...tGroupSubscriptionsOperationsExtensions.cs | 141 ++- .../Generated/ManagementGroupsAPIClient.cs | 87 +- .../Generated/ManagementGroupsOperations.cs | 451 ++++++++- .../ManagementGroupsOperationsExtensions.cs | 170 +++- .../Models/AzureAsyncOperationResults.cs | 108 ++ .../Models/CheckNameAvailabilityRequest.cs | 4 +- .../Models/CreateManagementGroupChildInfo.cs | 16 +- .../Models/CreateManagementGroupRequest.cs | 15 +- .../Models/CreateOrUpdateSettingsRequest.cs | 81 ++ .../src/Generated/Models/DescendantInfo.cs | 96 ++ .../Models/DescendantParentGroupInfo.cs | 55 + .../Generated/Models/EntityHierarchyItem.cs | 4 +- .../src/Generated/Models/EntityInfo.cs | 30 +- .../src/Generated/Models/HierarchySettings.cs | 120 +++ .../Generated/Models/HierarchySettingsInfo.cs | 119 +++ .../Generated/Models/HierarchySettingsList.cs | 62 ++ .../src/Generated/Models/ManagementGroup.cs | 25 +- .../Models/ManagementGroupChildInfo.cs | 17 +- .../Generated/Models/ManagementGroupInfo.cs | 4 +- .../Models/ManagementGroupPathElement.cs | 59 ++ .../ManagementGroupsCreateOrUpdateHeaders.cs | 84 ++ .../Models/ManagementGroupsDeleteHeaders.cs | 84 ++ .../src/Generated/Models/OperationResults.cs | 31 +- .../Models/PatchManagementGroupRequest.cs | 12 +- .../SubscriptionUnderManagementGroup.cs | 116 +++ .../src/Generated/Models/Type.cs | 12 +- .../Generated/SdkInfo_ManagementGroupsAPI.cs | 15 +- 37 files changed, 4032 insertions(+), 321 deletions(-) create mode 100644 sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/HierarchySettingsOperations.cs create mode 100644 sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/HierarchySettingsOperationsExtensions.cs create mode 100644 sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IHierarchySettingsOperations.cs create mode 100644 sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/AzureAsyncOperationResults.cs create mode 100644 sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CreateOrUpdateSettingsRequest.cs create mode 100644 sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/DescendantInfo.cs create mode 100644 sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/DescendantParentGroupInfo.cs create mode 100644 sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/HierarchySettings.cs create mode 100644 sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/HierarchySettingsInfo.cs create mode 100644 sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/HierarchySettingsList.cs create mode 100644 sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupPathElement.cs create mode 100644 sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupsCreateOrUpdateHeaders.cs create mode 100644 sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupsDeleteHeaders.cs create mode 100644 sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/SubscriptionUnderManagementGroup.cs diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/EntitiesOperations.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/EntitiesOperations.cs index a3fc386d0abf0..7373b7a14b618 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/EntitiesOperations.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/EntitiesOperations.cs @@ -53,21 +53,8 @@ internal EntitiesOperations(ManagementGroupsAPIClient client) /// /// List all entities (Management Groups, Subscriptions, etc.) for the /// authenticated user. + /// /// - /// - /// Page continuation token is only used if a previous operation returned a - /// partial result. If a previous response contains a nextLink element, the - /// value of the nextLink element will include a token parameter that specifies - /// a starting point to use for subsequent calls. - /// - /// - /// Number of entities to skip over when retrieving results. Passing this in - /// will override $skipToken. - /// - /// - /// Number of elements to return when retrieving results. Passing this in will - /// override $skipToken. - /// /// /// This parameter specifies the fields to include in the response. Can include /// any combination of @@ -77,15 +64,23 @@ internal EntitiesOperations(ManagementGroupsAPIClient client) /// /// /// The $search parameter is used in conjunction with the $filter parameter to - /// return three different outputs depending on the parameter passed in. With - /// $search=AllowedParents the API will return the entity info of all groups - /// that the requested entity will be able to reparent to as determined by the - /// user's permissions. With $search=AllowedChildren the API will return the - /// entity info of all entities that can be added as children of the requested - /// entity. With $search=ParentAndFirstLevelChildren the API will return the - /// parent and first level of children that the user has either direct access - /// to or indirect access via one of their descendants. Possible values - /// include: 'AllowedParents', 'AllowedChildren', 'ParentAndFirstLevelChildren' + /// return three different outputs depending on the parameter passed in. + /// With $search=AllowedParents the API will return the entity info of all + /// groups that the requested entity will be able to reparent to as determined + /// by the user's permissions. + /// With $search=AllowedChildren the API will return the entity info of all + /// entities that can be added as children of the requested entity. + /// With $search=ParentAndFirstLevelChildren the API will return the parent and + /// first level of children that the user has either direct access to or + /// indirect access via one of their descendants. + /// With $search=ParentOnly the API will return only the group if the user has + /// access to at least one of the descendants of the group. + /// With $search=ChildrenOnly the API will return only the first level of + /// children of the group entity info specified in $filter. The user must have + /// direct access to the children entities or one of it's descendants for it to + /// show up in the results. Possible values include: 'AllowedParents', + /// 'AllowedChildren', 'ParentAndFirstLevelChildren', 'ParentOnly', + /// 'ChildrenOnly' /// /// /// The filter parameter allows you to filter on the the name or display name @@ -128,7 +123,7 @@ internal EntitiesOperations(ManagementGroupsAPIClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string skiptoken = default(string), int? skip = default(int?), int? top = default(int?), string select = default(string), string search = default(string), string filter = default(string), string view = default(string), string groupName = default(string), string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string select = default(string), string search = default(string), string filter = default(string), string view = default(string), string groupName = default(string), string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -141,9 +136,6 @@ internal EntitiesOperations(ManagementGroupsAPIClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("skiptoken", skiptoken); - tracingParameters.Add("skip", skip); - tracingParameters.Add("top", top); tracingParameters.Add("select", select); tracingParameters.Add("search", search); tracingParameters.Add("filter", filter); @@ -161,17 +153,17 @@ internal EntitiesOperations(ManagementGroupsAPIClient client) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } - if (skiptoken != null) + if (Client.Skiptoken != null) { - _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(Client.Skiptoken))); } - if (skip != null) + if (Client.Skip != null) { - _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.Skip, Client.SerializationSettings).Trim('"')))); } - if (top != null) + if (Client.Top != null) { - _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.Top, Client.SerializationSettings).Trim('"')))); } if (select != null) { @@ -179,7 +171,7 @@ internal EntitiesOperations(ManagementGroupsAPIClient client) } if (search != null) { - _queryParameters.Add(string.Format("$search={0}", System.Uri.EscapeDataString(search))); + _queryParameters.Add(string.Format("$search={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(search, Client.SerializationSettings).Trim('"')))); } if (filter != null) { @@ -187,7 +179,7 @@ internal EntitiesOperations(ManagementGroupsAPIClient client) } if (view != null) { - _queryParameters.Add(string.Format("$view={0}", System.Uri.EscapeDataString(view))); + _queryParameters.Add(string.Format("$view={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(view, Client.SerializationSettings).Trim('"')))); } if (groupName != null) { @@ -324,6 +316,7 @@ internal EntitiesOperations(ManagementGroupsAPIClient client) /// /// List all entities (Management Groups, Subscriptions, etc.) for the /// authenticated user. + /// /// /// /// The NextLink from the previous successful call to List operation. diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/EntitiesOperationsExtensions.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/EntitiesOperationsExtensions.cs index bfab0048ca718..4fd1e48d2931b 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/EntitiesOperationsExtensions.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/EntitiesOperationsExtensions.cs @@ -24,24 +24,11 @@ public static partial class EntitiesOperationsExtensions /// /// List all entities (Management Groups, Subscriptions, etc.) for the /// authenticated user. + /// /// /// /// The operations group for this extension method. /// - /// - /// Page continuation token is only used if a previous operation returned a - /// partial result. If a previous response contains a nextLink element, the - /// value of the nextLink element will include a token parameter that specifies - /// a starting point to use for subsequent calls. - /// - /// - /// Number of entities to skip over when retrieving results. Passing this in - /// will override $skipToken. - /// - /// - /// Number of elements to return when retrieving results. Passing this in will - /// override $skipToken. - /// /// /// This parameter specifies the fields to include in the response. Can include /// any combination of @@ -51,15 +38,23 @@ public static partial class EntitiesOperationsExtensions /// /// /// The $search parameter is used in conjunction with the $filter parameter to - /// return three different outputs depending on the parameter passed in. With - /// $search=AllowedParents the API will return the entity info of all groups - /// that the requested entity will be able to reparent to as determined by the - /// user's permissions. With $search=AllowedChildren the API will return the - /// entity info of all entities that can be added as children of the requested - /// entity. With $search=ParentAndFirstLevelChildren the API will return the - /// parent and first level of children that the user has either direct access - /// to or indirect access via one of their descendants. Possible values - /// include: 'AllowedParents', 'AllowedChildren', 'ParentAndFirstLevelChildren' + /// return three different outputs depending on the parameter passed in. + /// With $search=AllowedParents the API will return the entity info of all + /// groups that the requested entity will be able to reparent to as determined + /// by the user's permissions. + /// With $search=AllowedChildren the API will return the entity info of all + /// entities that can be added as children of the requested entity. + /// With $search=ParentAndFirstLevelChildren the API will return the parent and + /// first level of children that the user has either direct access to or + /// indirect access via one of their descendants. + /// With $search=ParentOnly the API will return only the group if the user has + /// access to at least one of the descendants of the group. + /// With $search=ChildrenOnly the API will return only the first level of + /// children of the group entity info specified in $filter. The user must have + /// direct access to the children entities or one of it's descendants for it to + /// show up in the results. Possible values include: 'AllowedParents', + /// 'AllowedChildren', 'ParentAndFirstLevelChildren', 'ParentOnly', + /// 'ChildrenOnly' /// /// /// The filter parameter allows you to filter on the the name or display name @@ -81,32 +76,19 @@ public static partial class EntitiesOperationsExtensions /// /// Indicates that the request shouldn't utilize any caches. /// - public static IPage List(this IEntitiesOperations operations, string skiptoken = default(string), int? skip = default(int?), int? top = default(int?), string select = default(string), string search = default(string), string filter = default(string), string view = default(string), string groupName = default(string), string cacheControl = "no-cache") + public static IPage List(this IEntitiesOperations operations, string select = default(string), string search = default(string), string filter = default(string), string view = default(string), string groupName = default(string), string cacheControl = "no-cache") { - return operations.ListAsync(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl).GetAwaiter().GetResult(); + return operations.ListAsync(select, search, filter, view, groupName, cacheControl).GetAwaiter().GetResult(); } /// /// List all entities (Management Groups, Subscriptions, etc.) for the /// authenticated user. + /// /// /// /// The operations group for this extension method. /// - /// - /// Page continuation token is only used if a previous operation returned a - /// partial result. If a previous response contains a nextLink element, the - /// value of the nextLink element will include a token parameter that specifies - /// a starting point to use for subsequent calls. - /// - /// - /// Number of entities to skip over when retrieving results. Passing this in - /// will override $skipToken. - /// - /// - /// Number of elements to return when retrieving results. Passing this in will - /// override $skipToken. - /// /// /// This parameter specifies the fields to include in the response. Can include /// any combination of @@ -116,15 +98,23 @@ public static partial class EntitiesOperationsExtensions /// /// /// The $search parameter is used in conjunction with the $filter parameter to - /// return three different outputs depending on the parameter passed in. With - /// $search=AllowedParents the API will return the entity info of all groups - /// that the requested entity will be able to reparent to as determined by the - /// user's permissions. With $search=AllowedChildren the API will return the - /// entity info of all entities that can be added as children of the requested - /// entity. With $search=ParentAndFirstLevelChildren the API will return the - /// parent and first level of children that the user has either direct access - /// to or indirect access via one of their descendants. Possible values - /// include: 'AllowedParents', 'AllowedChildren', 'ParentAndFirstLevelChildren' + /// return three different outputs depending on the parameter passed in. + /// With $search=AllowedParents the API will return the entity info of all + /// groups that the requested entity will be able to reparent to as determined + /// by the user's permissions. + /// With $search=AllowedChildren the API will return the entity info of all + /// entities that can be added as children of the requested entity. + /// With $search=ParentAndFirstLevelChildren the API will return the parent and + /// first level of children that the user has either direct access to or + /// indirect access via one of their descendants. + /// With $search=ParentOnly the API will return only the group if the user has + /// access to at least one of the descendants of the group. + /// With $search=ChildrenOnly the API will return only the first level of + /// children of the group entity info specified in $filter. The user must have + /// direct access to the children entities or one of it's descendants for it to + /// show up in the results. Possible values include: 'AllowedParents', + /// 'AllowedChildren', 'ParentAndFirstLevelChildren', 'ParentOnly', + /// 'ChildrenOnly' /// /// /// The filter parameter allows you to filter on the the name or display name @@ -149,9 +139,9 @@ public static partial class EntitiesOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IEntitiesOperations operations, string skiptoken = default(string), int? skip = default(int?), int? top = default(int?), string select = default(string), string search = default(string), string filter = default(string), string view = default(string), string groupName = default(string), string cacheControl = "no-cache", CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IEntitiesOperations operations, string select = default(string), string search = default(string), string filter = default(string), string view = default(string), string groupName = default(string), string cacheControl = "no-cache", CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(skiptoken, skip, top, select, search, filter, view, groupName, cacheControl, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(select, search, filter, view, groupName, cacheControl, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -160,6 +150,7 @@ public static partial class EntitiesOperationsExtensions /// /// List all entities (Management Groups, Subscriptions, etc.) for the /// authenticated user. + /// /// /// /// The operations group for this extension method. @@ -178,6 +169,7 @@ public static IPage ListNext(this IEntitiesOperations operations, st /// /// List all entities (Management Groups, Subscriptions, etc.) for the /// authenticated user. + /// /// /// /// The operations group for this extension method. diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/HierarchySettingsOperations.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/HierarchySettingsOperations.cs new file mode 100644 index 0000000000000..87e4392eb9cda --- /dev/null +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/HierarchySettingsOperations.cs @@ -0,0 +1,954 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagementGroups +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HierarchySettingsOperations operations. + /// + internal partial class HierarchySettingsOperations : IServiceOperations, IHierarchySettingsOperations + { + /// + /// Initializes a new instance of the HierarchySettingsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal HierarchySettingsOperations(ManagementGroupsAPIClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ManagementGroupsAPIClient + /// + public ManagementGroupsAPIClient Client { get; private set; } + + /// + /// Gets all the hierarchy settings defined at the Management Group level. + /// Settings can only be set on the root Management Group of the hierarchy. + /// + /// + /// + /// Management Group ID. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (groupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{groupId}/settings").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the hierarchy settings defined at the Management Group level. Settings + /// can only be set on the root Management Group of the hierarchy. + /// + /// + /// + /// Management Group ID. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (groupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{groupId}/settings/default").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the hierarchy settings defined at the Management Group + /// level. + /// + /// + /// + /// Management Group ID. + /// + /// + /// Tenant level settings request parameter. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (groupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (createTenantSettingsRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "createTenantSettingsRequest"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("createTenantSettingsRequest", createTenantSettingsRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{groupId}/settings/default").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(createTenantSettingsRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(createTenantSettingsRequest, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates the hierarchy settings defined at the Management Group level. + /// + /// + /// + /// Management Group ID. + /// + /// + /// Tenant level settings request parameter. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (groupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (createTenantSettingsRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "createTenantSettingsRequest"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("createTenantSettingsRequest", createTenantSettingsRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{groupId}/settings/default").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(createTenantSettingsRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(createTenantSettingsRequest, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the hierarchy settings defined at the Management Group level. + /// + /// + /// + /// Management Group ID. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (groupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{groupId}/settings/default").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/HierarchySettingsOperationsExtensions.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/HierarchySettingsOperationsExtensions.cs new file mode 100644 index 0000000000000..42af29051f8d8 --- /dev/null +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/HierarchySettingsOperationsExtensions.cs @@ -0,0 +1,220 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagementGroups +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for HierarchySettingsOperations. + /// + public static partial class HierarchySettingsOperationsExtensions + { + /// + /// Gets all the hierarchy settings defined at the Management Group level. + /// Settings can only be set on the root Management Group of the hierarchy. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + public static HierarchySettingsList List(this IHierarchySettingsOperations operations, string groupId) + { + return operations.ListAsync(groupId).GetAwaiter().GetResult(); + } + + /// + /// Gets all the hierarchy settings defined at the Management Group level. + /// Settings can only be set on the root Management Group of the hierarchy. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IHierarchySettingsOperations operations, string groupId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(groupId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the hierarchy settings defined at the Management Group level. Settings + /// can only be set on the root Management Group of the hierarchy. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + public static HierarchySettings Get(this IHierarchySettingsOperations operations, string groupId) + { + return operations.GetAsync(groupId).GetAwaiter().GetResult(); + } + + /// + /// Gets the hierarchy settings defined at the Management Group level. Settings + /// can only be set on the root Management Group of the hierarchy. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IHierarchySettingsOperations operations, string groupId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(groupId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the hierarchy settings defined at the Management Group + /// level. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + /// + /// Tenant level settings request parameter. + /// + public static HierarchySettings CreateOrUpdate(this IHierarchySettingsOperations operations, string groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) + { + return operations.CreateOrUpdateAsync(groupId, createTenantSettingsRequest).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the hierarchy settings defined at the Management Group + /// level. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + /// + /// Tenant level settings request parameter. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IHierarchySettingsOperations operations, string groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(groupId, createTenantSettingsRequest, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the hierarchy settings defined at the Management Group level. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + /// + /// Tenant level settings request parameter. + /// + public static HierarchySettings Update(this IHierarchySettingsOperations operations, string groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest) + { + return operations.UpdateAsync(groupId, createTenantSettingsRequest).GetAwaiter().GetResult(); + } + + /// + /// Updates the hierarchy settings defined at the Management Group level. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + /// + /// Tenant level settings request parameter. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IHierarchySettingsOperations operations, string groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(groupId, createTenantSettingsRequest, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the hierarchy settings defined at the Management Group level. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + public static void Delete(this IHierarchySettingsOperations operations, string groupId) + { + operations.DeleteAsync(groupId).GetAwaiter().GetResult(); + } + + /// + /// Deletes the hierarchy settings defined at the Management Group level. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IHierarchySettingsOperations operations, string groupId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(groupId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IEntitiesOperations.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IEntitiesOperations.cs index a01108b946617..87117857e0e57 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IEntitiesOperations.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IEntitiesOperations.cs @@ -26,22 +26,8 @@ public partial interface IEntitiesOperations /// /// List all entities (Management Groups, Subscriptions, etc.) for the /// authenticated user. + /// /// - /// - /// Page continuation token is only used if a previous operation - /// returned a partial result. If a previous response contains a - /// nextLink element, the value of the nextLink element will include a - /// token parameter that specifies a starting point to use for - /// subsequent calls. - /// - /// - /// Number of entities to skip over when retrieving results. Passing - /// this in will override $skipToken. - /// - /// - /// Number of elements to return when retrieving results. Passing this - /// in will override $skipToken. - /// /// /// This parameter specifies the fields to include in the response. Can /// include any combination of @@ -53,16 +39,23 @@ public partial interface IEntitiesOperations /// /// The $search parameter is used in conjunction with the $filter /// parameter to return three different outputs depending on the - /// parameter passed in. With $search=AllowedParents the API will - /// return the entity info of all groups that the requested entity will - /// be able to reparent to as determined by the user's permissions. + /// parameter passed in. + /// With $search=AllowedParents the API will return the entity info of + /// all groups that the requested entity will be able to reparent to as + /// determined by the user's permissions. /// With $search=AllowedChildren the API will return the entity info of /// all entities that can be added as children of the requested entity. /// With $search=ParentAndFirstLevelChildren the API will return the /// parent and first level of children that the user has either direct - /// access to or indirect access via one of their descendants. Possible - /// values include: 'AllowedParents', 'AllowedChildren', - /// 'ParentAndFirstLevelChildren' + /// access to or indirect access via one of their descendants. + /// With $search=ParentOnly the API will return only the group if the + /// user has access to at least one of the descendants of the group. + /// With $search=ChildrenOnly the API will return only the first level + /// of children of the group entity info specified in $filter. The + /// user must have direct access to the children entities or one of + /// it's descendants for it to show up in the results. Possible values + /// include: 'AllowedParents', 'AllowedChildren', + /// 'ParentAndFirstLevelChildren', 'ParentOnly', 'ChildrenOnly' /// /// /// The filter parameter allows you to filter on the the name or @@ -100,10 +93,11 @@ public partial interface IEntitiesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string skiptoken = default(string), int? skip = default(int?), int? top = default(int?), string select = default(string), string search = default(string), string filter = default(string), string view = default(string), string groupName = default(string), string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string select = default(string), string search = default(string), string filter = default(string), string view = default(string), string groupName = default(string), string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List all entities (Management Groups, Subscriptions, etc.) for the /// authenticated user. + /// /// /// /// The NextLink from the previous successful call to List operation. diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IHierarchySettingsOperations.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IHierarchySettingsOperations.cs new file mode 100644 index 0000000000000..e0e0d8aec67dc --- /dev/null +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IHierarchySettingsOperations.cs @@ -0,0 +1,152 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagementGroups +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HierarchySettingsOperations operations. + /// + public partial interface IHierarchySettingsOperations + { + /// + /// Gets all the hierarchy settings defined at the Management Group + /// level. Settings can only be set on the root Management Group of the + /// hierarchy. + /// + /// + /// + /// Management Group ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the hierarchy settings defined at the Management Group level. + /// Settings can only be set on the root Management Group of the + /// hierarchy. + /// + /// + /// + /// Management Group ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the hierarchy settings defined at the Management + /// Group level. + /// + /// + /// + /// Management Group ID. + /// + /// + /// Tenant level settings request parameter. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the hierarchy settings defined at the Management Group + /// level. + /// + /// + /// + /// Management Group ID. + /// + /// + /// Tenant level settings request parameter. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string groupId, CreateOrUpdateSettingsRequest createTenantSettingsRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the hierarchy settings defined at the Management Group + /// level. + /// + /// + /// + /// Management Group ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IManagementGroupSubscriptionsOperations.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IManagementGroupSubscriptionsOperations.cs index 2384b59ffef82..ffd0d7a67937c 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IManagementGroupSubscriptionsOperations.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IManagementGroupSubscriptionsOperations.cs @@ -25,6 +25,7 @@ public partial interface IManagementGroupSubscriptionsOperations { /// /// Associates existing subscription with the management group. + /// /// /// /// Management Group ID. @@ -44,12 +45,16 @@ public partial interface IManagementGroupSubscriptionsOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// - Task CreateWithHttpMessagesAsync(string groupId, string subscriptionId, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateWithHttpMessagesAsync(string groupId, string subscriptionId, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// De-associates subscription from the management group. + /// /// /// /// Management Group ID. @@ -73,5 +78,83 @@ public partial interface IManagementGroupSubscriptionsOperations /// Thrown when a required parameter is null /// Task DeleteWithHttpMessagesAsync(string groupId, string subscriptionId, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves details about given subscription which is associated with + /// the management group. + /// + /// + /// + /// Management Group ID. + /// + /// + /// Subscription ID. + /// + /// + /// Indicates that the request shouldn't utilize any caches. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetSubscriptionWithHttpMessagesAsync(string groupId, string subscriptionId, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves details about all subscriptions which are associated with + /// the management group. + /// + /// + /// + /// Management Group ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetSubscriptionsUnderManagementGroupWithHttpMessagesAsync(string groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieves details about all subscriptions which are associated with + /// the management group. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetSubscriptionsUnderManagementGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IManagementGroupsAPIClient.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IManagementGroupsAPIClient.cs index 774bcab175bf4..fd3e863e7f717 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IManagementGroupsAPIClient.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IManagementGroupsAPIClient.cs @@ -24,6 +24,7 @@ namespace Microsoft.Azure.Management.ManagementGroups /// subscriptions/resources into an organizational hierarchy and centrally /// manage access control, policies, alerting and reporting for those /// resources. + /// /// public partial interface IManagementGroupsAPIClient : System.IDisposable { @@ -54,19 +55,48 @@ public partial interface IManagementGroupsAPIClient : System.IDisposable string ApiVersion { get; } /// - /// Gets or sets the preferred language for the response. + /// The id of the operation result. Possible values include: 'create', + /// 'delete' + /// + string OperationResultId { get; set; } + + /// + /// Number of entities to skip over when retrieving results. Passing + /// this in will override $skipToken. + /// + int? Skip { get; set; } + + /// + /// Number of elements to return when retrieving results. Passing this + /// in will override $skipToken. + /// + int? Top { get; set; } + + /// + /// Page continuation token is only used if a previous operation + /// returned a partial result. + /// If a previous response contains a nextLink element, the value of + /// the nextLink element will include a token parameter that specifies + /// a starting point to use for subsequent calls. + /// + /// + string Skiptoken { get; set; } + + /// + /// The preferred language for the response. /// string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running - /// Operations. Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. /// int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is generated - /// and included in each request. Default is true. + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. /// bool? GenerateClientRequestId { get; set; } @@ -81,6 +111,11 @@ public partial interface IManagementGroupsAPIClient : System.IDisposable /// IManagementGroupSubscriptionsOperations ManagementGroupSubscriptions { get; } + /// + /// Gets the IHierarchySettingsOperations. + /// + IHierarchySettingsOperations HierarchySettings { get; } + /// /// Gets the IOperations. /// diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IManagementGroupsOperations.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IManagementGroupsOperations.cs index 597faf9130ade..f61d8d34f2fb0 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IManagementGroupsOperations.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IManagementGroupsOperations.cs @@ -25,17 +25,11 @@ public partial interface IManagementGroupsOperations { /// /// List management groups for the authenticated user. + /// /// /// /// Indicates that the request shouldn't utilize any caches. /// - /// - /// Page continuation token is only used if a previous operation - /// returned a partial result. If a previous response contains a - /// nextLink element, the value of the nextLink element will include a - /// token parameter that specifies a starting point to use for - /// subsequent calls. - /// /// /// The headers that will be added to request. /// @@ -51,17 +45,19 @@ public partial interface IManagementGroupsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string cacheControl = "no-cache", string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the details of the management group. + /// /// /// /// Management Group ID. /// /// /// The $expand=children query string parameter allows clients to - /// request inclusion of children in the response payload. Possible - /// values include: 'children' + /// request inclusion of children in the response payload. + /// $expand=path includes the path from the root group to the current + /// group. Possible values include: 'children', 'path' /// /// /// The $recurse=true query string parameter allows clients to request @@ -92,10 +88,11 @@ public partial interface IManagementGroupsOperations /// Task> GetWithHttpMessagesAsync(string groupId, string expand = default(string), bool? recurse = default(bool?), string filter = default(string), string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Create or update a management group. If a management group is - /// already created and a subsequent create request is issued with - /// different properties, the management group properties will be - /// updated. + /// Create or update a management group. + /// If a management group is already created and a subsequent create + /// request is issued with different properties, the management group + /// properties will be updated. + /// /// /// /// Management Group ID. @@ -121,9 +118,10 @@ public partial interface IManagementGroupsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string groupId, CreateManagementGroupRequest createManagementGroupRequest, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string groupId, CreateManagementGroupRequest createManagementGroupRequest, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update a management group. + /// /// /// /// Management Group ID. @@ -151,8 +149,10 @@ public partial interface IManagementGroupsOperations /// Task> UpdateWithHttpMessagesAsync(string groupId, PatchManagementGroupRequest patchGroupRequest, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete management group. If a management group contains child - /// resources, the request will fail. + /// Delete management group. + /// If a management group contains child resources, the request will + /// fail. + /// /// /// /// Management Group ID. @@ -175,12 +175,36 @@ public partial interface IManagementGroupsOperations /// /// Thrown when a required parameter is null /// - Task> DeleteWithHttpMessagesAsync(string groupId, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> DeleteWithHttpMessagesAsync(string groupId, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all entities that descend from a management group. + /// + /// + /// + /// Management Group ID. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetDescendantsWithHttpMessagesAsync(string groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Create or update a management group. If a management group is - /// already created and a subsequent create request is issued with - /// different properties, the management group properties will be - /// updated. + /// Create or update a management group. + /// If a management group is already created and a subsequent create + /// request is issued with different properties, the management group + /// properties will be updated. + /// /// /// /// Management Group ID. @@ -206,10 +230,12 @@ public partial interface IManagementGroupsOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string groupId, CreateManagementGroupRequest createManagementGroupRequest, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string groupId, CreateManagementGroupRequest createManagementGroupRequest, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete management group. If a management group contains child - /// resources, the request will fail. + /// Delete management group. + /// If a management group contains child resources, the request will + /// fail. + /// /// /// /// Management Group ID. @@ -232,9 +258,10 @@ public partial interface IManagementGroupsOperations /// /// Thrown when a required parameter is null /// - Task> BeginDeleteWithHttpMessagesAsync(string groupId, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginDeleteWithHttpMessagesAsync(string groupId, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List management groups for the authenticated user. + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -258,5 +285,28 @@ public partial interface IManagementGroupsOperations /// Thrown when a required parameter is null /// Task>> ListNextWithHttpMessagesAsync(string nextPageLink, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all entities that descend from a management group. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetDescendantsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupSubscriptionsOperations.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupSubscriptionsOperations.cs index 9007f4c65c61c..9beb6638c5dc4 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupSubscriptionsOperations.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupSubscriptionsOperations.cs @@ -52,6 +52,7 @@ internal ManagementGroupSubscriptionsOperations(ManagementGroupsAPIClient client /// /// Associates existing subscription with the management group. + /// /// /// /// Management Group ID. @@ -71,6 +72,9 @@ internal ManagementGroupSubscriptionsOperations(ManagementGroupsAPIClient client /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -80,7 +84,7 @@ internal ManagementGroupSubscriptionsOperations(ManagementGroupsAPIClient client /// /// A response object containing the response body and response headers. /// - public async Task CreateWithHttpMessagesAsync(string groupId, string subscriptionId, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateWithHttpMessagesAsync(string groupId, string subscriptionId, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (groupId == null) { @@ -183,7 +187,7 @@ internal ManagementGroupSubscriptionsOperations(ManagementGroupsAPIClient client HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -213,13 +217,31 @@ internal ManagementGroupSubscriptionsOperations(ManagementGroupsAPIClient client throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -229,6 +251,7 @@ internal ManagementGroupSubscriptionsOperations(ManagementGroupsAPIClient client /// /// De-associates subscription from the management group. + /// /// /// /// Management Group ID. @@ -360,7 +383,7 @@ internal ManagementGroupSubscriptionsOperations(ManagementGroupsAPIClient client HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -404,5 +427,558 @@ internal ManagementGroupSubscriptionsOperations(ManagementGroupsAPIClient client return _result; } + /// + /// Retrieves details about given subscription which is associated with the + /// management group. + /// + /// + /// + /// Management Group ID. + /// + /// + /// Subscription ID. + /// + /// + /// Indicates that the request shouldn't utilize any caches. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetSubscriptionWithHttpMessagesAsync(string groupId, string subscriptionId, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (groupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupId"); + } + if (subscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("subscriptionId", subscriptionId); + tracingParameters.Add("cacheControl", cacheControl); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetSubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{groupId}/subscriptions/{subscriptionId}").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (cacheControl != null) + { + if (_httpRequest.Headers.Contains("Cache-Control")) + { + _httpRequest.Headers.Remove("Cache-Control"); + } + _httpRequest.Headers.TryAddWithoutValidation("Cache-Control", cacheControl); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves details about all subscriptions which are associated with the + /// management group. + /// + /// + /// + /// Management Group ID. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetSubscriptionsUnderManagementGroupWithHttpMessagesAsync(string groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (groupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetSubscriptionsUnderManagementGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{groupId}/subscriptions").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (Client.Skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(Client.Skiptoken))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Retrieves details about all subscriptions which are associated with the + /// management group. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetSubscriptionsUnderManagementGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetSubscriptionsUnderManagementGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupSubscriptionsOperationsExtensions.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupSubscriptionsOperationsExtensions.cs index a3fc6e27a62bf..27858e6f03967 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupSubscriptionsOperationsExtensions.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupSubscriptionsOperationsExtensions.cs @@ -23,6 +23,7 @@ public static partial class ManagementGroupSubscriptionsOperationsExtensions { /// /// Associates existing subscription with the management group. + /// /// /// /// The operations group for this extension method. @@ -36,13 +37,14 @@ public static partial class ManagementGroupSubscriptionsOperationsExtensions /// /// Indicates that the request shouldn't utilize any caches. /// - public static void Create(this IManagementGroupSubscriptionsOperations operations, string groupId, string subscriptionId, string cacheControl = "no-cache") + public static SubscriptionUnderManagementGroup Create(this IManagementGroupSubscriptionsOperations operations, string groupId, string subscriptionId, string cacheControl = "no-cache") { - operations.CreateAsync(groupId, subscriptionId, cacheControl).GetAwaiter().GetResult(); + return operations.CreateAsync(groupId, subscriptionId, cacheControl).GetAwaiter().GetResult(); } /// /// Associates existing subscription with the management group. + /// /// /// /// The operations group for this extension method. @@ -59,13 +61,17 @@ public static void Create(this IManagementGroupSubscriptionsOperations operation /// /// The cancellation token. /// - public static async Task CreateAsync(this IManagementGroupSubscriptionsOperations operations, string groupId, string subscriptionId, string cacheControl = "no-cache", CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateAsync(this IManagementGroupSubscriptionsOperations operations, string groupId, string subscriptionId, string cacheControl = "no-cache", CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.CreateWithHttpMessagesAsync(groupId, subscriptionId, cacheControl, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.CreateWithHttpMessagesAsync(groupId, subscriptionId, cacheControl, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// /// De-associates subscription from the management group. + /// /// /// /// The operations group for this extension method. @@ -86,6 +92,7 @@ public static void Delete(this IManagementGroupSubscriptionsOperations operation /// /// De-associates subscription from the management group. + /// /// /// /// The operations group for this extension method. @@ -107,5 +114,131 @@ public static void Delete(this IManagementGroupSubscriptionsOperations operation (await operations.DeleteWithHttpMessagesAsync(groupId, subscriptionId, cacheControl, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Retrieves details about given subscription which is associated with the + /// management group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + /// + /// Subscription ID. + /// + /// + /// Indicates that the request shouldn't utilize any caches. + /// + public static SubscriptionUnderManagementGroup GetSubscription(this IManagementGroupSubscriptionsOperations operations, string groupId, string subscriptionId, string cacheControl = "no-cache") + { + return operations.GetSubscriptionAsync(groupId, subscriptionId, cacheControl).GetAwaiter().GetResult(); + } + + /// + /// Retrieves details about given subscription which is associated with the + /// management group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + /// + /// Subscription ID. + /// + /// + /// Indicates that the request shouldn't utilize any caches. + /// + /// + /// The cancellation token. + /// + public static async Task GetSubscriptionAsync(this IManagementGroupSubscriptionsOperations operations, string groupId, string subscriptionId, string cacheControl = "no-cache", CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetSubscriptionWithHttpMessagesAsync(groupId, subscriptionId, cacheControl, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves details about all subscriptions which are associated with the + /// management group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + public static IPage GetSubscriptionsUnderManagementGroup(this IManagementGroupSubscriptionsOperations operations, string groupId) + { + return operations.GetSubscriptionsUnderManagementGroupAsync(groupId).GetAwaiter().GetResult(); + } + + /// + /// Retrieves details about all subscriptions which are associated with the + /// management group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + /// + /// The cancellation token. + /// + public static async Task> GetSubscriptionsUnderManagementGroupAsync(this IManagementGroupSubscriptionsOperations operations, string groupId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetSubscriptionsUnderManagementGroupWithHttpMessagesAsync(groupId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Retrieves details about all subscriptions which are associated with the + /// management group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage GetSubscriptionsUnderManagementGroupNext(this IManagementGroupSubscriptionsOperations operations, string nextPageLink) + { + return operations.GetSubscriptionsUnderManagementGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Retrieves details about all subscriptions which are associated with the + /// management group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> GetSubscriptionsUnderManagementGroupNextAsync(this IManagementGroupSubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetSubscriptionsUnderManagementGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsAPIClient.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsAPIClient.cs index 92035b29c06df..d5997742ec4f2 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsAPIClient.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsAPIClient.cs @@ -28,6 +28,7 @@ namespace Microsoft.Azure.Management.ManagementGroups /// subscriptions/resources into an organizational hierarchy and centrally /// manage access control, policies, alerting and reporting for those /// resources. + /// /// public partial class ManagementGroupsAPIClient : ServiceClient, IManagementGroupsAPIClient, IAzureClient { @@ -58,19 +59,47 @@ public partial class ManagementGroupsAPIClient : ServiceClient - /// Gets or sets the preferred language for the response. + /// The id of the operation result. Possible values include: 'create', 'delete' + /// + public string OperationResultId { get; set; } + + /// + /// Number of entities to skip over when retrieving results. Passing this in + /// will override $skipToken. + /// + public int? Skip { get; set; } + + /// + /// Number of elements to return when retrieving results. Passing this in will + /// override $skipToken. + /// + public int? Top { get; set; } + + /// + /// Page continuation token is only used if a previous operation returned a + /// partial result. + /// If a previous response contains a nextLink element, the value of the + /// nextLink element will include a token parameter that specifies a starting + /// point to use for subsequent calls. + /// + /// + public string Skiptoken { get; set; } + + /// + /// The preferred language for the response. /// public string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running Operations. - /// Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. /// public int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is generated and - /// included in each request. Default is true. + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. /// public bool? GenerateClientRequestId { get; set; } @@ -84,6 +113,11 @@ public partial class ManagementGroupsAPIClient : ServiceClient public virtual IManagementGroupSubscriptionsOperations ManagementGroupSubscriptions { get; private set; } + /// + /// Gets the IHierarchySettingsOperations. + /// + public virtual IHierarchySettingsOperations HierarchySettings { get; private set; } + /// /// Gets the IOperations. /// @@ -94,6 +128,19 @@ public partial class ManagementGroupsAPIClient : ServiceClient public virtual IEntitiesOperations Entities { get; private set; } + /// + /// Initializes a new instance of the ManagementGroupsAPIClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ManagementGroupsAPIClient.Dispose(). False: will not dispose provided httpClient + protected ManagementGroupsAPIClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + /// /// Initializes a new instance of the ManagementGroupsAPIClient class. /// @@ -189,6 +236,33 @@ public ManagementGroupsAPIClient(ServiceClientCredentials credentials, params De } } + /// + /// Initializes a new instance of the ManagementGroupsAPIClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling ManagementGroupsAPIClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public ManagementGroupsAPIClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + /// /// Initializes a new instance of the ManagementGroupsAPIClient class. /// @@ -297,10 +371,11 @@ private void Initialize() { ManagementGroups = new ManagementGroupsOperations(this); ManagementGroupSubscriptions = new ManagementGroupSubscriptionsOperations(this); + HierarchySettings = new HierarchySettingsOperations(this); Operations = new Operations(this); Entities = new EntitiesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2018-03-01-preview"; + ApiVersion = "2020-05-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsOperations.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsOperations.cs index 8929c0f83e528..26272a5bfc796 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsOperations.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsOperations.cs @@ -52,16 +52,11 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) /// /// List management groups for the authenticated user. + /// /// /// /// Indicates that the request shouldn't utilize any caches. /// - /// - /// Page continuation token is only used if a previous operation returned a - /// partial result. If a previous response contains a nextLink element, the - /// value of the nextLink element will include a token parameter that specifies - /// a starting point to use for subsequent calls. - /// /// /// Headers that will be added to request. /// @@ -83,7 +78,7 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string cacheControl = "no-cache", string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -97,7 +92,6 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("cacheControl", cacheControl); - tracingParameters.Add("skiptoken", skiptoken); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -109,9 +103,9 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } - if (skiptoken != null) + if (Client.Skiptoken != null) { - _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(Client.Skiptoken))); } if (_queryParameters.Count > 0) { @@ -243,14 +237,16 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) /// /// Get the details of the management group. + /// /// /// /// Management Group ID. /// /// /// The $expand=children query string parameter allows clients to request - /// inclusion of children in the response payload. Possible values include: - /// 'children' + /// inclusion of children in the response payload. $expand=path includes the + /// path from the root group to the current group. Possible values include: + /// 'children', 'path' /// /// /// The $recurse=true query string parameter allows clients to request @@ -321,7 +317,7 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) } if (expand != null) { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expand, Client.SerializationSettings).Trim('"')))); } if (recurse != null) { @@ -460,9 +456,11 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) } /// - /// Create or update a management group. If a management group is already - /// created and a subsequent create request is issued with different - /// properties, the management group properties will be updated. + /// Create or update a management group. + /// If a management group is already created and a subsequent create request is + /// issued with different properties, the management group properties will be + /// updated. + /// /// /// /// Management Group ID. @@ -479,15 +477,16 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string groupId, CreateManagementGroupRequest createManagementGroupRequest, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string groupId, CreateManagementGroupRequest createManagementGroupRequest, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(groupId, createManagementGroupRequest, cacheControl, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(groupId, createManagementGroupRequest, cacheControl, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Update a management group. + /// /// /// /// Management Group ID. @@ -690,8 +689,9 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) } /// - /// Delete management group. If a management group contains child resources, - /// the request will fail. + /// Delete management group. + /// If a management group contains child resources, the request will fail. + /// /// /// /// Management Group ID. @@ -705,17 +705,205 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) /// /// The cancellation token. /// - public async Task> DeleteWithHttpMessagesAsync(string groupId, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> DeleteWithHttpMessagesAsync(string groupId, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(groupId, cacheControl, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(groupId, cacheControl, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Create or update a management group. If a management group is already - /// created and a subsequent create request is issued with different - /// properties, the management group properties will be updated. + /// List all entities that descend from a management group. + /// + /// + /// + /// Management Group ID. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetDescendantsWithHttpMessagesAsync(string groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (groupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDescendants", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Management/managementGroups/{groupId}/descendants").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (Client.Skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(Client.Skiptoken))); + } + if (Client.Top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.Top, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update a management group. + /// If a management group is already created and a subsequent create request is + /// issued with different properties, the management group properties will be + /// updated. + /// /// /// /// Management Group ID. @@ -747,7 +935,7 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string groupId, CreateManagementGroupRequest createManagementGroupRequest, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string groupId, CreateManagementGroupRequest createManagementGroupRequest, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (groupId == null) { @@ -885,7 +1073,7 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -916,7 +1104,7 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -928,6 +1116,19 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -936,8 +1137,9 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) } /// - /// Delete management group. If a management group contains child resources, - /// the request will fail. + /// Delete management group. + /// If a management group contains child resources, the request will fail. + /// /// /// /// Management Group ID. @@ -966,7 +1168,7 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginDeleteWithHttpMessagesAsync(string groupId, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginDeleteWithHttpMessagesAsync(string groupId, string cacheControl = "no-cache", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (groupId == null) { @@ -1093,7 +1295,7 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1106,7 +1308,7 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1118,6 +1320,19 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1127,6 +1342,7 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) /// /// List management groups for the authenticated user. + /// /// /// /// The NextLink from the previous successful call to List operation. @@ -1305,5 +1521,174 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) return _result; } + /// + /// List all entities that descend from a management group. + /// + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetDescendantsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDescendantsNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsOperationsExtensions.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsOperationsExtensions.cs index 89c2e9917d991..a33207991c78a 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsOperationsExtensions.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsOperationsExtensions.cs @@ -23,6 +23,7 @@ public static partial class ManagementGroupsOperationsExtensions { /// /// List management groups for the authenticated user. + /// /// /// /// The operations group for this extension method. @@ -30,19 +31,14 @@ public static partial class ManagementGroupsOperationsExtensions /// /// Indicates that the request shouldn't utilize any caches. /// - /// - /// Page continuation token is only used if a previous operation returned a - /// partial result. If a previous response contains a nextLink element, the - /// value of the nextLink element will include a token parameter that specifies - /// a starting point to use for subsequent calls. - /// - public static IPage List(this IManagementGroupsOperations operations, string cacheControl = "no-cache", string skiptoken = default(string)) + public static IPage List(this IManagementGroupsOperations operations, string cacheControl = "no-cache") { - return operations.ListAsync(cacheControl, skiptoken).GetAwaiter().GetResult(); + return operations.ListAsync(cacheControl).GetAwaiter().GetResult(); } /// /// List management groups for the authenticated user. + /// /// /// /// The operations group for this extension method. @@ -50,18 +46,12 @@ public static partial class ManagementGroupsOperationsExtensions /// /// Indicates that the request shouldn't utilize any caches. /// - /// - /// Page continuation token is only used if a previous operation returned a - /// partial result. If a previous response contains a nextLink element, the - /// value of the nextLink element will include a token parameter that specifies - /// a starting point to use for subsequent calls. - /// /// /// The cancellation token. /// - public static async Task> ListAsync(this IManagementGroupsOperations operations, string cacheControl = "no-cache", string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IManagementGroupsOperations operations, string cacheControl = "no-cache", CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(cacheControl, skiptoken, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(cacheControl, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -69,6 +59,7 @@ public static partial class ManagementGroupsOperationsExtensions /// /// Get the details of the management group. + /// /// /// /// The operations group for this extension method. @@ -78,8 +69,9 @@ public static partial class ManagementGroupsOperationsExtensions /// /// /// The $expand=children query string parameter allows clients to request - /// inclusion of children in the response payload. Possible values include: - /// 'children' + /// inclusion of children in the response payload. $expand=path includes the + /// path from the root group to the current group. Possible values include: + /// 'children', 'path' /// /// /// The $recurse=true query string parameter allows clients to request @@ -100,6 +92,7 @@ public static partial class ManagementGroupsOperationsExtensions /// /// Get the details of the management group. + /// /// /// /// The operations group for this extension method. @@ -109,8 +102,9 @@ public static partial class ManagementGroupsOperationsExtensions /// /// /// The $expand=children query string parameter allows clients to request - /// inclusion of children in the response payload. Possible values include: - /// 'children' + /// inclusion of children in the response payload. $expand=path includes the + /// path from the root group to the current group. Possible values include: + /// 'children', 'path' /// /// /// The $recurse=true query string parameter allows clients to request @@ -136,9 +130,11 @@ public static partial class ManagementGroupsOperationsExtensions } /// - /// Create or update a management group. If a management group is already - /// created and a subsequent create request is issued with different - /// properties, the management group properties will be updated. + /// Create or update a management group. + /// If a management group is already created and a subsequent create request is + /// issued with different properties, the management group properties will be + /// updated. + /// /// /// /// The operations group for this extension method. @@ -158,9 +154,11 @@ public static object CreateOrUpdate(this IManagementGroupsOperations operations, } /// - /// Create or update a management group. If a management group is already - /// created and a subsequent create request is issued with different - /// properties, the management group properties will be updated. + /// Create or update a management group. + /// If a management group is already created and a subsequent create request is + /// issued with different properties, the management group properties will be + /// updated. + /// /// /// /// The operations group for this extension method. @@ -187,6 +185,7 @@ public static object CreateOrUpdate(this IManagementGroupsOperations operations, /// /// Update a management group. + /// /// /// /// The operations group for this extension method. @@ -207,6 +206,7 @@ public static ManagementGroup Update(this IManagementGroupsOperations operations /// /// Update a management group. + /// /// /// /// The operations group for this extension method. @@ -232,8 +232,9 @@ public static ManagementGroup Update(this IManagementGroupsOperations operations } /// - /// Delete management group. If a management group contains child resources, - /// the request will fail. + /// Delete management group. + /// If a management group contains child resources, the request will fail. + /// /// /// /// The operations group for this extension method. @@ -244,14 +245,15 @@ public static ManagementGroup Update(this IManagementGroupsOperations operations /// /// Indicates that the request shouldn't utilize any caches. /// - public static OperationResults Delete(this IManagementGroupsOperations operations, string groupId, string cacheControl = "no-cache") + public static AzureAsyncOperationResults Delete(this IManagementGroupsOperations operations, string groupId, string cacheControl = "no-cache") { return operations.DeleteAsync(groupId, cacheControl).GetAwaiter().GetResult(); } /// - /// Delete management group. If a management group contains child resources, - /// the request will fail. + /// Delete management group. + /// If a management group contains child resources, the request will fail. + /// /// /// /// The operations group for this extension method. @@ -265,7 +267,7 @@ public static OperationResults Delete(this IManagementGroupsOperations operation /// /// The cancellation token. /// - public static async Task DeleteAsync(this IManagementGroupsOperations operations, string groupId, string cacheControl = "no-cache", CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IManagementGroupsOperations operations, string groupId, string cacheControl = "no-cache", CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.DeleteWithHttpMessagesAsync(groupId, cacheControl, null, cancellationToken).ConfigureAwait(false)) { @@ -274,9 +276,47 @@ public static OperationResults Delete(this IManagementGroupsOperations operation } /// - /// Create or update a management group. If a management group is already - /// created and a subsequent create request is issued with different - /// properties, the management group properties will be updated. + /// List all entities that descend from a management group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + public static IPage GetDescendants(this IManagementGroupsOperations operations, string groupId) + { + return operations.GetDescendantsAsync(groupId).GetAwaiter().GetResult(); + } + + /// + /// List all entities that descend from a management group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + /// + /// The cancellation token. + /// + public static async Task> GetDescendantsAsync(this IManagementGroupsOperations operations, string groupId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDescendantsWithHttpMessagesAsync(groupId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a management group. + /// If a management group is already created and a subsequent create request is + /// issued with different properties, the management group properties will be + /// updated. + /// /// /// /// The operations group for this extension method. @@ -296,9 +336,11 @@ public static object BeginCreateOrUpdate(this IManagementGroupsOperations operat } /// - /// Create or update a management group. If a management group is already - /// created and a subsequent create request is issued with different - /// properties, the management group properties will be updated. + /// Create or update a management group. + /// If a management group is already created and a subsequent create request is + /// issued with different properties, the management group properties will be + /// updated. + /// /// /// /// The operations group for this extension method. @@ -324,8 +366,9 @@ public static object BeginCreateOrUpdate(this IManagementGroupsOperations operat } /// - /// Delete management group. If a management group contains child resources, - /// the request will fail. + /// Delete management group. + /// If a management group contains child resources, the request will fail. + /// /// /// /// The operations group for this extension method. @@ -336,14 +379,15 @@ public static object BeginCreateOrUpdate(this IManagementGroupsOperations operat /// /// Indicates that the request shouldn't utilize any caches. /// - public static OperationResults BeginDelete(this IManagementGroupsOperations operations, string groupId, string cacheControl = "no-cache") + public static AzureAsyncOperationResults BeginDelete(this IManagementGroupsOperations operations, string groupId, string cacheControl = "no-cache") { return operations.BeginDeleteAsync(groupId, cacheControl).GetAwaiter().GetResult(); } /// - /// Delete management group. If a management group contains child resources, - /// the request will fail. + /// Delete management group. + /// If a management group contains child resources, the request will fail. + /// /// /// /// The operations group for this extension method. @@ -357,7 +401,7 @@ public static OperationResults BeginDelete(this IManagementGroupsOperations oper /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IManagementGroupsOperations operations, string groupId, string cacheControl = "no-cache", CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this IManagementGroupsOperations operations, string groupId, string cacheControl = "no-cache", CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(groupId, cacheControl, null, cancellationToken).ConfigureAwait(false)) { @@ -367,6 +411,7 @@ public static OperationResults BeginDelete(this IManagementGroupsOperations oper /// /// List management groups for the authenticated user. + /// /// /// /// The operations group for this extension method. @@ -384,6 +429,7 @@ public static IPage ListNext(this IManagementGroupsOperatio /// /// List management groups for the authenticated user. + /// /// /// /// The operations group for this extension method. @@ -405,5 +451,41 @@ public static IPage ListNext(this IManagementGroupsOperatio } } + /// + /// List all entities that descend from a management group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage GetDescendantsNext(this IManagementGroupsOperations operations, string nextPageLink) + { + return operations.GetDescendantsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List all entities that descend from a management group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> GetDescendantsNextAsync(this IManagementGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDescendantsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/AzureAsyncOperationResults.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/AzureAsyncOperationResults.cs new file mode 100644 index 0000000000000..193272ebfb6ce --- /dev/null +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/AzureAsyncOperationResults.cs @@ -0,0 +1,108 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagementGroups.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The results of Azure-AsyncOperation. + /// + [Rest.Serialization.JsonTransformation] + public partial class AzureAsyncOperationResults + { + /// + /// Initializes a new instance of the AzureAsyncOperationResults class. + /// + public AzureAsyncOperationResults() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureAsyncOperationResults class. + /// + /// The fully qualified ID for the management group. + /// For example, + /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + /// The type of the resource. For example, + /// Microsoft.Management/managementGroups + /// The name of the management group. For example, + /// 00000000-0000-0000-0000-000000000000 + /// The current status of the asynchronous + /// operation performed . For example, Running, Succeeded, + /// Failed + /// The AAD Tenant ID associated with the + /// management group. For example, + /// 00000000-0000-0000-0000-000000000000 + /// The friendly name of the management + /// group. + public AzureAsyncOperationResults(string id = default(string), string type = default(string), string name = default(string), string status = default(string), string tenantId = default(string), string displayName = default(string)) + { + Id = id; + Type = type; + Name = name; + Status = status; + TenantId = tenantId; + DisplayName = displayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the fully qualified ID for the management group. For example, + /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the type of the resource. For example, + /// Microsoft.Management/managementGroups + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the name of the management group. For example, + /// 00000000-0000-0000-0000-000000000000 + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the current status of the asynchronous operation performed . + /// For example, Running, Succeeded, Failed + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets or sets the AAD Tenant ID associated with the management + /// group. For example, 00000000-0000-0000-0000-000000000000 + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the friendly name of the management group. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + } +} diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CheckNameAvailabilityRequest.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CheckNameAvailabilityRequest.cs index dcb26f6cd8296..dbd68cd3e4ce4 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CheckNameAvailabilityRequest.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CheckNameAvailabilityRequest.cs @@ -34,7 +34,7 @@ public CheckNameAvailabilityRequest() /// the name to check for availability /// fully qualified resource type which includes /// provider namespace. Possible values include: - /// '/providers/Microsoft.Management/managementGroups' + /// 'Microsoft.Management/managementGroups' public CheckNameAvailabilityRequest(string name = default(string), Type? type = default(Type?)) { Name = name; @@ -56,7 +56,7 @@ public CheckNameAvailabilityRequest() /// /// Gets or sets fully qualified resource type which includes provider /// namespace. Possible values include: - /// '/providers/Microsoft.Management/managementGroups' + /// 'Microsoft.Management/managementGroups' /// [JsonProperty(PropertyName = "type")] public Type? Type { get; set; } diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CreateManagementGroupChildInfo.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CreateManagementGroupChildInfo.cs index 955db046aea01..fbaa6e58176cc 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CreateManagementGroupChildInfo.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CreateManagementGroupChildInfo.cs @@ -40,16 +40,13 @@ public CreateManagementGroupChildInfo() /// The name of the child entity. /// The friendly name of the child /// resource. - /// The roles definitions associated with the - /// management group. /// The list of children. - public CreateManagementGroupChildInfo(string type = default(string), string id = default(string), string name = default(string), string displayName = default(string), IList roles = default(IList), IList children = default(IList)) + public CreateManagementGroupChildInfo(string type = default(string), string id = default(string), string name = default(string), string displayName = default(string), IList children = default(IList)) { Type = type; Id = id; Name = name; DisplayName = displayName; - Roles = roles; Children = children; CustomInit(); } @@ -64,9 +61,8 @@ public CreateManagementGroupChildInfo() /// /// /// The fully qualified resource type which includes provider namespace - /// (e.g. /providers/Microsoft.Management/managementGroups). Possible - /// values include: '/providers/Microsoft.Management/managementGroups', - /// '/subscriptions' + /// (e.g. Microsoft.Management/managementGroups). Possible values + /// include: 'Microsoft.Management/managementGroups', '/subscriptions' /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } @@ -91,12 +87,6 @@ public CreateManagementGroupChildInfo() [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; private set; } - /// - /// Gets the roles definitions associated with the management group. - /// - [JsonProperty(PropertyName = "roles")] - public IList Roles { get; private set; } - /// /// Gets the list of children. /// diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CreateManagementGroupRequest.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CreateManagementGroupRequest.cs index dfe81304c3f53..ac4942b13a041 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CreateManagementGroupRequest.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CreateManagementGroupRequest.cs @@ -41,7 +41,7 @@ public CreateManagementGroupRequest() /// For example, /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 /// The type of the resource. For example, - /// /providers/Microsoft.Management/managementGroups + /// Microsoft.Management/managementGroups /// The name of the management group. For example, /// 00000000-0000-0000-0000-000000000000 /// The AAD Tenant ID associated with the @@ -50,18 +50,15 @@ public CreateManagementGroupRequest() /// The friendly name of the management /// group. If no value is passed then this field will be set to the /// groupId. - /// The roles definitions associated with the - /// management group. /// Details /// The list of children. - public CreateManagementGroupRequest(string id = default(string), string type = default(string), string name = default(string), string tenantId = default(string), string displayName = default(string), IList roles = default(IList), CreateManagementGroupDetails details = default(CreateManagementGroupDetails), IList children = default(IList)) + public CreateManagementGroupRequest(string id = default(string), string type = default(string), string name = default(string), string tenantId = default(string), string displayName = default(string), CreateManagementGroupDetails details = default(CreateManagementGroupDetails), IList children = default(IList)) { Id = id; Type = type; Name = name; TenantId = tenantId; DisplayName = displayName; - Roles = roles; Details = details; Children = children; CustomInit(); @@ -81,7 +78,7 @@ public CreateManagementGroupRequest() /// /// Gets the type of the resource. For example, - /// /providers/Microsoft.Management/managementGroups + /// Microsoft.Management/managementGroups /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } @@ -107,12 +104,6 @@ public CreateManagementGroupRequest() [JsonProperty(PropertyName = "properties.displayName")] public string DisplayName { get; set; } - /// - /// Gets the roles definitions associated with the management group. - /// - [JsonProperty(PropertyName = "properties.roles")] - public IList Roles { get; private set; } - /// /// Gets or sets details /// diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CreateOrUpdateSettingsRequest.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CreateOrUpdateSettingsRequest.cs new file mode 100644 index 0000000000000..4eadc039c93c8 --- /dev/null +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/CreateOrUpdateSettingsRequest.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagementGroups.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Parameters for creating or updating Management Group settings + /// + [Rest.Serialization.JsonTransformation] + public partial class CreateOrUpdateSettingsRequest : IResource + { + /// + /// Initializes a new instance of the CreateOrUpdateSettingsRequest + /// class. + /// + public CreateOrUpdateSettingsRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CreateOrUpdateSettingsRequest + /// class. + /// + /// Indicates + /// whether RBAC access is required upon group creation under the root + /// Management Group. If set to true, user will require + /// Microsoft.Management/managementGroups/write action on the root + /// Management Group scope in order to create new Groups directly under + /// the root. This will prevent new users from creating new Management + /// Groups, unless they are given access. + /// Settings that sets the default + /// Management Group under which new subscriptions get added in this + /// tenant. For example, + /// /providers/Microsoft.Management/managementGroups/defaultGroup + public CreateOrUpdateSettingsRequest(bool? requireAuthorizationForGroupCreation = default(bool?), string defaultManagementGroup = default(string)) + { + RequireAuthorizationForGroupCreation = requireAuthorizationForGroupCreation; + DefaultManagementGroup = defaultManagementGroup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether RBAC access is required upon group + /// creation under the root Management Group. If set to true, user will + /// require Microsoft.Management/managementGroups/write action on the + /// root Management Group scope in order to create new Groups directly + /// under the root. This will prevent new users from creating new + /// Management Groups, unless they are given access. + /// + [JsonProperty(PropertyName = "properties.requireAuthorizationForGroupCreation")] + public bool? RequireAuthorizationForGroupCreation { get; set; } + + /// + /// Gets or sets settings that sets the default Management Group under + /// which new subscriptions get added in this tenant. For example, + /// /providers/Microsoft.Management/managementGroups/defaultGroup + /// + [JsonProperty(PropertyName = "properties.defaultManagementGroup")] + public string DefaultManagementGroup { get; set; } + + } +} diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/DescendantInfo.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/DescendantInfo.cs new file mode 100644 index 0000000000000..9daf4ccd201b7 --- /dev/null +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/DescendantInfo.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagementGroups.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The descendant. + /// + [Rest.Serialization.JsonTransformation] + public partial class DescendantInfo + { + /// + /// Initializes a new instance of the DescendantInfo class. + /// + public DescendantInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DescendantInfo class. + /// + /// The fully qualified ID for the descendant. For + /// example, + /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + /// or /subscriptions/0000000-0000-0000-0000-000000000000 + /// The type of the resource. For example, + /// Microsoft.Management/managementGroups or /subscriptions + /// The name of the descendant. For example, + /// 00000000-0000-0000-0000-000000000000 + /// The friendly name of the management + /// group. + /// Parent + public DescendantInfo(string id = default(string), string type = default(string), string name = default(string), string displayName = default(string), DescendantParentGroupInfo parent = default(DescendantParentGroupInfo)) + { + Id = id; + Type = type; + Name = name; + DisplayName = displayName; + Parent = parent; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the fully qualified ID for the descendant. For example, + /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + /// or /subscriptions/0000000-0000-0000-0000-000000000000 + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the type of the resource. For example, + /// Microsoft.Management/managementGroups or /subscriptions + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the name of the descendant. For example, + /// 00000000-0000-0000-0000-000000000000 + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets the friendly name of the management group. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets parent + /// + [JsonProperty(PropertyName = "properties.parent")] + public DescendantParentGroupInfo Parent { get; set; } + + } +} diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/DescendantParentGroupInfo.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/DescendantParentGroupInfo.cs new file mode 100644 index 0000000000000..7988d461e814e --- /dev/null +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/DescendantParentGroupInfo.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagementGroups.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The ID of the parent management group. + /// + public partial class DescendantParentGroupInfo + { + /// + /// Initializes a new instance of the DescendantParentGroupInfo class. + /// + public DescendantParentGroupInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DescendantParentGroupInfo class. + /// + /// The fully qualified ID for the parent management + /// group. For example, + /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + public DescendantParentGroupInfo(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the fully qualified ID for the parent management + /// group. For example, + /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/EntityHierarchyItem.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/EntityHierarchyItem.cs index d04b7d7990783..1366fb8e6eb46 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/EntityHierarchyItem.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/EntityHierarchyItem.cs @@ -39,7 +39,7 @@ public EntityHierarchyItem() /// For example, /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 /// The type of the resource. For example, - /// /providers/Microsoft.Management/managementGroups + /// Microsoft.Management/managementGroups /// The name of the management group. For example, /// 00000000-0000-0000-0000-000000000000 /// The friendly name of the management @@ -71,7 +71,7 @@ public EntityHierarchyItem() /// /// Gets the type of the resource. For example, - /// /providers/Microsoft.Management/managementGroups + /// Microsoft.Management/managementGroups /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/EntityInfo.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/EntityInfo.cs index 56543eb2f2563..592a760a81da4 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/EntityInfo.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/EntityInfo.cs @@ -38,7 +38,7 @@ public EntityInfo() /// example, /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 /// The type of the resource. For example, - /// /providers/Microsoft.Management/managementGroups + /// Microsoft.Management/managementGroups /// The name of the entity. For example, /// 00000000-0000-0000-0000-000000000000 /// The AAD Tenant ID associated with the @@ -49,11 +49,13 @@ public EntityInfo() /// Permissions /// Inherited Permissions /// Number of Descendants + /// Number of Children + /// Number of Child Groups /// The parent display name chain /// from the root group to the immediate parent /// The parent name chain from the root /// group to the immediate parent - public EntityInfo(string id = default(string), string type = default(string), string name = default(string), string tenantId = default(string), string displayName = default(string), EntityParentGroupInfo parent = default(EntityParentGroupInfo), string permissions = default(string), string inheritedPermissions = default(string), int? numberOfDescendants = default(int?), IList parentDisplayNameChain = default(IList), IList parentNameChain = default(IList)) + public EntityInfo(string id = default(string), string type = default(string), string name = default(string), string tenantId = default(string), string displayName = default(string), EntityParentGroupInfo parent = default(EntityParentGroupInfo), string permissions = default(string), string inheritedPermissions = default(string), int? numberOfDescendants = default(int?), int? numberOfChildren = default(int?), int? numberOfChildGroups = default(int?), IList parentDisplayNameChain = default(IList), IList parentNameChain = default(IList)) { Id = id; Type = type; @@ -64,6 +66,8 @@ public EntityInfo() Permissions = permissions; InheritedPermissions = inheritedPermissions; NumberOfDescendants = numberOfDescendants; + NumberOfChildren = numberOfChildren; + NumberOfChildGroups = numberOfChildGroups; ParentDisplayNameChain = parentDisplayNameChain; ParentNameChain = parentNameChain; CustomInit(); @@ -83,7 +87,7 @@ public EntityInfo() /// /// Gets the type of the resource. For example, - /// /providers/Microsoft.Management/managementGroups + /// Microsoft.Management/managementGroups /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } @@ -138,6 +142,26 @@ public EntityInfo() [JsonProperty(PropertyName = "properties.numberOfDescendants")] public int? NumberOfDescendants { get; set; } + /// + /// Gets or sets number of Children + /// + /// + /// Number of children is the number of Groups and Subscriptions that + /// are exactly one level underneath the current Group. + /// + [JsonProperty(PropertyName = "properties.numberOfChildren")] + public int? NumberOfChildren { get; set; } + + /// + /// Gets or sets number of Child Groups + /// + /// + /// Number of children is the number of Groups that are exactly one + /// level underneath the current Group. + /// + [JsonProperty(PropertyName = "properties.numberOfChildGroups")] + public int? NumberOfChildGroups { get; set; } + /// /// Gets or sets the parent display name chain from the root group to /// the immediate parent diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/HierarchySettings.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/HierarchySettings.cs new file mode 100644 index 0000000000000..0ac33a9cf7e49 --- /dev/null +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/HierarchySettings.cs @@ -0,0 +1,120 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagementGroups.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Settings defined at the Management Group scope. + /// + [Rest.Serialization.JsonTransformation] + public partial class HierarchySettings : IResource + { + /// + /// Initializes a new instance of the HierarchySettings class. + /// + public HierarchySettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HierarchySettings class. + /// + /// The fully qualified ID for the settings object. + /// For example, + /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. + /// The type of the resource. For example, + /// Microsoft.Management/managementGroups/settings. + /// The name of the object. In this case, + /// default. + /// The AAD Tenant ID associated with the + /// hierarchy settings. For example, + /// 00000000-0000-0000-0000-000000000000 + /// Indicates + /// whether RBAC access is required upon group creation under the root + /// Management Group. If set to true, user will require + /// Microsoft.Management/managementGroups/write action on the root + /// Management Group scope in order to create new Groups directly under + /// the root. This will prevent new users from creating new Management + /// Groups, unless they are given access. + /// Settings that sets the default + /// Management Group under which new subscriptions get added in this + /// tenant. For example, + /// /providers/Microsoft.Management/managementGroups/defaultGroup + public HierarchySettings(string id = default(string), string type = default(string), string name = default(string), string tenantId = default(string), bool? requireAuthorizationForGroupCreation = default(bool?), string defaultManagementGroup = default(string)) + { + Id = id; + Type = type; + Name = name; + TenantId = tenantId; + RequireAuthorizationForGroupCreation = requireAuthorizationForGroupCreation; + DefaultManagementGroup = defaultManagementGroup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the fully qualified ID for the settings object. For example, + /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the type of the resource. For example, + /// Microsoft.Management/managementGroups/settings. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the name of the object. In this case, default. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets the AAD Tenant ID associated with the hierarchy + /// settings. For example, 00000000-0000-0000-0000-000000000000 + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets indicates whether RBAC access is required upon group + /// creation under the root Management Group. If set to true, user will + /// require Microsoft.Management/managementGroups/write action on the + /// root Management Group scope in order to create new Groups directly + /// under the root. This will prevent new users from creating new + /// Management Groups, unless they are given access. + /// + [JsonProperty(PropertyName = "properties.requireAuthorizationForGroupCreation")] + public bool? RequireAuthorizationForGroupCreation { get; set; } + + /// + /// Gets or sets settings that sets the default Management Group under + /// which new subscriptions get added in this tenant. For example, + /// /providers/Microsoft.Management/managementGroups/defaultGroup + /// + [JsonProperty(PropertyName = "properties.defaultManagementGroup")] + public string DefaultManagementGroup { get; set; } + + } +} diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/HierarchySettingsInfo.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/HierarchySettingsInfo.cs new file mode 100644 index 0000000000000..1e2132d057b02 --- /dev/null +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/HierarchySettingsInfo.cs @@ -0,0 +1,119 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagementGroups.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The hierarchy settings resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class HierarchySettingsInfo + { + /// + /// Initializes a new instance of the HierarchySettingsInfo class. + /// + public HierarchySettingsInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HierarchySettingsInfo class. + /// + /// The fully qualified ID for the settings object. + /// For example, + /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. + /// The type of the resource. For example, + /// Microsoft.Management/managementGroups/settings. + /// The name of the object. In this case, + /// default. + /// The AAD Tenant ID associated with the + /// hierarchy settings. For example, + /// 00000000-0000-0000-0000-000000000000 + /// Indicates + /// whether RBAC access is required upon group creation under the root + /// Management Group. If set to true, user will require + /// Microsoft.Management/managementGroups/write action on the root + /// Management Group scope in order to create new Groups directly under + /// the root. This will prevent new users from creating new Management + /// Groups, unless they are given access. + /// Settings that sets the default + /// Management Group under which new subscriptions get added in this + /// tenant. For example, + /// /providers/Microsoft.Management/managementGroups/defaultGroup + public HierarchySettingsInfo(string id = default(string), string type = default(string), string name = default(string), string tenantId = default(string), bool? requireAuthorizationForGroupCreation = default(bool?), string defaultManagementGroup = default(string)) + { + Id = id; + Type = type; + Name = name; + TenantId = tenantId; + RequireAuthorizationForGroupCreation = requireAuthorizationForGroupCreation; + DefaultManagementGroup = defaultManagementGroup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the fully qualified ID for the settings object. For example, + /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/settings/default. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the type of the resource. For example, + /// Microsoft.Management/managementGroups/settings. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the name of the object. In this case, default. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets the AAD Tenant ID associated with the hierarchy + /// settings. For example, 00000000-0000-0000-0000-000000000000 + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets indicates whether RBAC access is required upon group + /// creation under the root Management Group. If set to true, user will + /// require Microsoft.Management/managementGroups/write action on the + /// root Management Group scope in order to create new Groups directly + /// under the root. This will prevent new users from creating new + /// Management Groups, unless they are given access. + /// + [JsonProperty(PropertyName = "properties.requireAuthorizationForGroupCreation")] + public bool? RequireAuthorizationForGroupCreation { get; set; } + + /// + /// Gets or sets settings that sets the default Management Group under + /// which new subscriptions get added in this tenant. For example, + /// /providers/Microsoft.Management/managementGroups/defaultGroup + /// + [JsonProperty(PropertyName = "properties.defaultManagementGroup")] + public string DefaultManagementGroup { get; set; } + + } +} diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/HierarchySettingsList.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/HierarchySettingsList.cs new file mode 100644 index 0000000000000..4453d462e76c7 --- /dev/null +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/HierarchySettingsList.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagementGroups.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Lists all hierarchy settings. + /// + public partial class HierarchySettingsList + { + /// + /// Initializes a new instance of the HierarchySettingsList class. + /// + public HierarchySettingsList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HierarchySettingsList class. + /// + /// The list of hierarchy settings. + /// The URL to use for getting the next set of + /// results. + public HierarchySettingsList(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of hierarchy settings. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets the URL to use for getting the next set of results. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroup.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroup.cs index f666003b794e2..62b53cbda521f 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroup.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroup.cs @@ -39,7 +39,7 @@ public ManagementGroup() /// For example, /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 /// The type of the resource. For example, - /// /providers/Microsoft.Management/managementGroups + /// Microsoft.Management/managementGroups /// The name of the management group. For example, /// 00000000-0000-0000-0000-000000000000 /// The AAD Tenant ID associated with the @@ -47,20 +47,20 @@ public ManagementGroup() /// 00000000-0000-0000-0000-000000000000 /// The friendly name of the management /// group. - /// The role definitions associated with the - /// management group. /// Details /// The list of children. - public ManagementGroup(string id = default(string), string type = default(string), string name = default(string), string tenantId = default(string), string displayName = default(string), IList roles = default(IList), ManagementGroupDetails details = default(ManagementGroupDetails), IList children = default(IList)) + /// The path from the root to the current + /// group. + public ManagementGroup(string id = default(string), string type = default(string), string name = default(string), string tenantId = default(string), string displayName = default(string), ManagementGroupDetails details = default(ManagementGroupDetails), IList children = default(IList), IList path = default(IList)) { Id = id; Type = type; Name = name; TenantId = tenantId; DisplayName = displayName; - Roles = roles; Details = details; Children = children; + Path = path; CustomInit(); } @@ -78,7 +78,7 @@ public ManagementGroup() /// /// Gets the type of the resource. For example, - /// /providers/Microsoft.Management/managementGroups + /// Microsoft.Management/managementGroups /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } @@ -103,13 +103,6 @@ public ManagementGroup() [JsonProperty(PropertyName = "properties.displayName")] public string DisplayName { get; set; } - /// - /// Gets or sets the role definitions associated with the management - /// group. - /// - [JsonProperty(PropertyName = "properties.roles")] - public IList Roles { get; set; } - /// /// Gets or sets details /// @@ -122,5 +115,11 @@ public ManagementGroup() [JsonProperty(PropertyName = "properties.children")] public IList Children { get; set; } + /// + /// Gets or sets the path from the root to the current group. + /// + [JsonProperty(PropertyName = "properties.path")] + public IList Path { get; set; } + } } diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupChildInfo.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupChildInfo.cs index dd4deefe57b4a..6bd9d1fa8a388 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupChildInfo.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupChildInfo.cs @@ -38,16 +38,13 @@ public ManagementGroupChildInfo() /// The name of the child entity. /// The friendly name of the child /// resource. - /// The roles definitions associated with the - /// management group. /// The list of children. - public ManagementGroupChildInfo(string type = default(string), string id = default(string), string name = default(string), string displayName = default(string), IList roles = default(IList), IList children = default(IList)) + public ManagementGroupChildInfo(string type = default(string), string id = default(string), string name = default(string), string displayName = default(string), IList children = default(IList)) { Type = type; Id = id; Name = name; DisplayName = displayName; - Roles = roles; Children = children; CustomInit(); } @@ -62,9 +59,8 @@ public ManagementGroupChildInfo() /// /// /// The fully qualified resource type which includes provider namespace - /// (e.g. /providers/Microsoft.Management/managementGroups). Possible - /// values include: '/providers/Microsoft.Management/managementGroups', - /// '/subscriptions' + /// (e.g. Microsoft.Management/managementGroups). Possible values + /// include: 'Microsoft.Management/managementGroups', '/subscriptions' /// [JsonProperty(PropertyName = "type")] public string Type { get; set; } @@ -89,13 +85,6 @@ public ManagementGroupChildInfo() [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; set; } - /// - /// Gets or sets the roles definitions associated with the management - /// group. - /// - [JsonProperty(PropertyName = "roles")] - public IList Roles { get; set; } - /// /// Gets or sets the list of children. /// diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupInfo.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupInfo.cs index 42cb7d13f1426..a2811f355f506 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupInfo.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupInfo.cs @@ -36,7 +36,7 @@ public ManagementGroupInfo() /// For example, /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 /// The type of the resource. For example, - /// /providers/Microsoft.Management/managementGroups + /// Microsoft.Management/managementGroups /// The name of the management group. For example, /// 00000000-0000-0000-0000-000000000000 /// The AAD Tenant ID associated with the @@ -68,7 +68,7 @@ public ManagementGroupInfo() /// /// Gets the type of the resource. For example, - /// /providers/Microsoft.Management/managementGroups + /// Microsoft.Management/managementGroups /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupPathElement.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupPathElement.cs new file mode 100644 index 0000000000000..2b4243c281147 --- /dev/null +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupPathElement.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagementGroups.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A path element of a management group ancestors. + /// + public partial class ManagementGroupPathElement + { + /// + /// Initializes a new instance of the ManagementGroupPathElement class. + /// + public ManagementGroupPathElement() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagementGroupPathElement class. + /// + /// The name of the group. + /// The friendly name of the group. + public ManagementGroupPathElement(string name = default(string), string displayName = default(string)) + { + Name = name; + DisplayName = displayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the group. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the friendly name of the group. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + } +} diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupsCreateOrUpdateHeaders.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupsCreateOrUpdateHeaders.cs new file mode 100644 index 0000000000000..75065c9de3ace --- /dev/null +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupsCreateOrUpdateHeaders.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagementGroups.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for CreateOrUpdate operation. + /// + public partial class ManagementGroupsCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the + /// ManagementGroupsCreateOrUpdateHeaders class. + /// + public ManagementGroupsCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagementGroupsCreateOrUpdateHeaders class. + /// + /// URL for determining when an operation has + /// completed. Send a GET request to the URL in Location header. + /// The URI should return a 202 until the operation reaches a terminal + /// state and 200 once it reaches a terminal state. + /// + /// For more info: + /// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#202-accepted-and-location-headers + /// URL for checking the ongoing + /// status of the operation. + /// To get the status of the asynchronous operation, send a GET request + /// to the URL in Azure-AsyncOperation header value. + /// + /// For more info: + /// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#asynchronous-operations + public ManagementGroupsCreateOrUpdateHeaders(string location = default(string), string azureAsyncOperation = default(string)) + { + Location = location; + AzureAsyncOperation = azureAsyncOperation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URL for determining when an operation has completed. + /// Send a GET request to the URL in Location header. + /// The URI should return a 202 until the operation reaches a terminal + /// state and 200 once it reaches a terminal state. + /// + /// For more info: + /// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#202-accepted-and-location-headers + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets URL for checking the ongoing status of the operation. + /// To get the status of the asynchronous operation, send a GET request + /// to the URL in Azure-AsyncOperation header value. + /// + /// For more info: + /// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#asynchronous-operations + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + } +} diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupsDeleteHeaders.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupsDeleteHeaders.cs new file mode 100644 index 0000000000000..537e721941e28 --- /dev/null +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupsDeleteHeaders.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagementGroups.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class ManagementGroupsDeleteHeaders + { + /// + /// Initializes a new instance of the ManagementGroupsDeleteHeaders + /// class. + /// + public ManagementGroupsDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagementGroupsDeleteHeaders + /// class. + /// + /// URL for determining when an operation has + /// completed. Send a GET request to the URL in Location header. + /// The URI should return a 202 until the operation reaches a terminal + /// state and 200 once it reaches a terminal state. + /// + /// For more info: + /// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#202-accepted-and-location-headers + /// URL for checking the ongoing + /// status of the operation. + /// To get the status of the asynchronous operation, send a GET request + /// to the URL in Azure-AsyncOperation header value. + /// + /// For more info: + /// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#asynchronous-operations + public ManagementGroupsDeleteHeaders(string location = default(string), string azureAsyncOperation = default(string)) + { + Location = location; + AzureAsyncOperation = azureAsyncOperation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URL for determining when an operation has completed. + /// Send a GET request to the URL in Location header. + /// The URI should return a 202 until the operation reaches a terminal + /// state and 200 once it reaches a terminal state. + /// + /// For more info: + /// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#202-accepted-and-location-headers + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets URL for checking the ongoing status of the operation. + /// To get the status of the asynchronous operation, send a GET request + /// to the URL in Azure-AsyncOperation header value. + /// + /// For more info: + /// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#asynchronous-operations + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + } +} diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/OperationResults.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/OperationResults.cs index f1d913543fb06..68deccf423466 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/OperationResults.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/OperationResults.cs @@ -36,16 +36,21 @@ public OperationResults() /// For example, /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 /// The type of the resource. For example, - /// /providers/Microsoft.Management/managementGroups + /// Microsoft.Management/managementGroups /// The name of the management group. For example, /// 00000000-0000-0000-0000-000000000000 - /// Provisioning State - public OperationResults(string id = default(string), string type = default(string), string name = default(string), string provisioningState = default(string)) + /// The AAD Tenant ID associated with the + /// management group. For example, + /// 00000000-0000-0000-0000-000000000000 + /// The friendly name of the management + /// group. + public OperationResults(string id = default(string), string type = default(string), string name = default(string), string tenantId = default(string), string displayName = default(string)) { Id = id; Type = type; Name = name; - ProvisioningState = provisioningState; + TenantId = tenantId; + DisplayName = displayName; CustomInit(); } @@ -63,7 +68,7 @@ public OperationResults() /// /// Gets the type of the resource. For example, - /// /providers/Microsoft.Management/managementGroups + /// Microsoft.Management/managementGroups /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } @@ -76,13 +81,17 @@ public OperationResults() public string Name { get; private set; } /// - /// Gets or sets provisioning State + /// Gets or sets the AAD Tenant ID associated with the management + /// group. For example, 00000000-0000-0000-0000-000000000000 + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the friendly name of the management group. /// - /// - /// Possible values include: 'Updating' - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } } } diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/PatchManagementGroupRequest.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/PatchManagementGroupRequest.cs index 7cc762b14285f..8820bac17f01b 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/PatchManagementGroupRequest.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/PatchManagementGroupRequest.cs @@ -33,13 +33,13 @@ public PatchManagementGroupRequest() /// /// The friendly name of the management /// group. - /// (Optional) The fully qualified ID for the - /// parent management group. For example, + /// (Optional) The fully qualified ID for + /// the parent management group. For example, /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - public PatchManagementGroupRequest(string displayName = default(string), string parentId = default(string)) + public PatchManagementGroupRequest(string displayName = default(string), string parentGroupId = default(string)) { DisplayName = displayName; - ParentId = parentId; + ParentGroupId = parentGroupId; CustomInit(); } @@ -59,8 +59,8 @@ public PatchManagementGroupRequest() /// management group. For example, /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 /// - [JsonProperty(PropertyName = "parentId")] - public string ParentId { get; set; } + [JsonProperty(PropertyName = "parentGroupId")] + public string ParentGroupId { get; set; } } } diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/SubscriptionUnderManagementGroup.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/SubscriptionUnderManagementGroup.cs new file mode 100644 index 0000000000000..96aa616ee9338 --- /dev/null +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/SubscriptionUnderManagementGroup.cs @@ -0,0 +1,116 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ManagementGroups.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The details of subscription under management group. + /// + [Rest.Serialization.JsonTransformation] + public partial class SubscriptionUnderManagementGroup : IResource + { + /// + /// Initializes a new instance of the SubscriptionUnderManagementGroup + /// class. + /// + public SubscriptionUnderManagementGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubscriptionUnderManagementGroup + /// class. + /// + /// The fully qualified ID for the subscription. For + /// example, + /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/subscriptions/0000000-0000-0000-0000-000000000001 + /// The type of the resource. For example, + /// Microsoft.Management/managementGroups/subscriptions + /// The stringified id of the subscription. For + /// example, 00000000-0000-0000-0000-000000000000 + /// The AAD Tenant ID associated with the + /// subscription. For example, + /// 00000000-0000-0000-0000-000000000000 + /// The friendly name of the + /// subscription. + /// Parent + /// The state of the subscription. + public SubscriptionUnderManagementGroup(string id = default(string), string type = default(string), string name = default(string), string tenant = default(string), string displayName = default(string), DescendantParentGroupInfo parent = default(DescendantParentGroupInfo), string state = default(string)) + { + Id = id; + Type = type; + Name = name; + Tenant = tenant; + DisplayName = displayName; + Parent = parent; + State = state; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the fully qualified ID for the subscription. For example, + /// /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000/subscriptions/0000000-0000-0000-0000-000000000001 + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the type of the resource. For example, + /// Microsoft.Management/managementGroups/subscriptions + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the stringified id of the subscription. For example, + /// 00000000-0000-0000-0000-000000000000 + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets or sets the AAD Tenant ID associated with the subscription. + /// For example, 00000000-0000-0000-0000-000000000000 + /// + [JsonProperty(PropertyName = "properties.tenant")] + public string Tenant { get; set; } + + /// + /// Gets or sets the friendly name of the subscription. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets parent + /// + [JsonProperty(PropertyName = "properties.parent")] + public DescendantParentGroupInfo Parent { get; set; } + + /// + /// Gets or sets the state of the subscription. + /// + [JsonProperty(PropertyName = "properties.state")] + public string State { get; set; } + + } +} diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/Type.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/Type.cs index f1cad22ea6f62..0f8e0f25a747f 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/Type.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/Type.cs @@ -21,8 +21,8 @@ namespace Microsoft.Azure.Management.ManagementGroups.Models [JsonConverter(typeof(StringEnumConverter))] public enum Type { - [EnumMember(Value = "/providers/Microsoft.Management/managementGroups")] - HyphenMinusprovidersHyphenMinusMicrosoftFullStopManagementHyphenMinusmanagementGroups + [EnumMember(Value = "Microsoft.Management/managementGroups")] + MicrosoftManagementManagementGroups } internal static class TypeEnumExtension { @@ -35,8 +35,8 @@ internal static string ToSerializedValue(this Type value) { switch( value ) { - case Type.HyphenMinusprovidersHyphenMinusMicrosoftFullStopManagementHyphenMinusmanagementGroups: - return "/providers/Microsoft.Management/managementGroups"; + case Type.MicrosoftManagementManagementGroups: + return "Microsoft.Management/managementGroups"; } return null; } @@ -45,8 +45,8 @@ internal static string ToSerializedValue(this Type value) { switch( value ) { - case "/providers/Microsoft.Management/managementGroups": - return Type.HyphenMinusprovidersHyphenMinusMicrosoftFullStopManagementHyphenMinusmanagementGroups; + case "Microsoft.Management/managementGroups": + return Type.MicrosoftManagementManagementGroups; } return null; } diff --git a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/SdkInfo_ManagementGroupsAPI.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/SdkInfo_ManagementGroupsAPI.cs index 9e654323e40aa..729e01727b004 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/SdkInfo_ManagementGroupsAPI.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/SdkInfo_ManagementGroupsAPI.cs @@ -19,13 +19,14 @@ public static IEnumerable> ApiInfo_ManagementGroup { return new Tuple[] { - new Tuple("Management", "CheckNameAvailability", "2018-03-01-preview"), - new Tuple("Management", "Entities", "2018-03-01-preview"), - new Tuple("Management", "ManagementGroupSubscriptions", "2018-03-01-preview"), - new Tuple("Management", "ManagementGroups", "2018-03-01-preview"), - new Tuple("Management", "Operations", "2018-03-01-preview"), - new Tuple("Management", "StartTenantBackfill", "2018-03-01-preview"), - new Tuple("Management", "TenantBackfillStatus", "2018-03-01-preview"), + new Tuple("Management", "CheckNameAvailability", "2020-05-01"), + new Tuple("Management", "Entities", "2020-05-01"), + new Tuple("Management", "HierarchySettings", "2020-05-01"), + new Tuple("Management", "ManagementGroupSubscriptions", "2020-05-01"), + new Tuple("Management", "ManagementGroups", "2020-05-01"), + new Tuple("Management", "Operations", "2020-05-01"), + new Tuple("Management", "StartTenantBackfill", "2020-05-01"), + new Tuple("Management", "TenantBackfillStatus", "2020-05-01"), }.AsEnumerable(); } }