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 a3fc386d0abf..d800f5255782 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/EntitiesOperations.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/EntitiesOperations.cs @@ -53,12 +53,14 @@ 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. + /// 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 @@ -77,15 +79,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 @@ -105,7 +115,8 @@ internal EntitiesOperations(ManagementGroupsAPIClient client) /// (i.e. "$filter=name eq 'groupName'") /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// Headers that will be added to request. @@ -179,7 +190,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 +198,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,12 +335,14 @@ 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. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// Headers that will be added to request. 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 bfab0048ca71..db9a26c9d364 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/EntitiesOperationsExtensions.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/EntitiesOperationsExtensions.cs @@ -24,15 +24,17 @@ 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. + /// 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 @@ -51,15 +53,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 @@ -79,7 +89,8 @@ public static partial class EntitiesOperationsExtensions /// (i.e. "$filter=name eq 'groupName'") /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing 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") { @@ -89,15 +100,17 @@ 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. + /// 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 @@ -116,15 +129,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 @@ -144,7 +165,8 @@ public static partial class EntitiesOperationsExtensions /// (i.e. "$filter=name eq 'groupName'") /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// The cancellation token. @@ -160,6 +182,7 @@ public static partial class EntitiesOperationsExtensions /// /// List all entities (Management Groups, Subscriptions, etc.) for the /// authenticated user. + /// /// /// /// The operations group for this extension method. @@ -168,7 +191,8 @@ public static partial class EntitiesOperationsExtensions /// The NextLink from the previous successful call to List operation. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// public static IPage ListNext(this IEntitiesOperations operations, string nextPageLink, string cacheControl = "no-cache") { @@ -178,6 +202,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. @@ -186,7 +211,8 @@ public static IPage ListNext(this IEntitiesOperations operations, st /// The NextLink from the previous successful call to List operation. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// The cancellation token. 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 000000000000..87e4392eb9cd --- /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 000000000000..42af29051f8d --- /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 a01108b94661..7fd99fd62139 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IEntitiesOperations.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IEntitiesOperations.cs @@ -26,13 +26,14 @@ 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. + /// 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 @@ -53,16 +54,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 @@ -83,7 +91,8 @@ public partial interface IEntitiesOperations /// particular group (i.e. "$filter=name eq 'groupName'") /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate + /// the header with 'no-cache' value to bypass existing caches. /// /// /// The headers that will be added to request. @@ -104,12 +113,14 @@ public partial interface IEntitiesOperations /// /// List all entities (Management Groups, Subscriptions, etc.) for the /// authenticated user. + /// /// /// /// The NextLink from the previous successful call to List operation. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate + /// the header with 'no-cache' value to bypass existing caches. /// /// /// The headers that will be added to request. 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 000000000000..e0e0d8aec67d --- /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 2384b59ffef8..c5e62d32cab8 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. @@ -33,7 +34,8 @@ public partial interface IManagementGroupSubscriptionsOperations /// Subscription ID. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate + /// the header with 'no-cache' value to bypass existing caches. /// /// /// The headers that will be added to request. @@ -44,12 +46,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. @@ -58,7 +64,8 @@ public partial interface IManagementGroupSubscriptionsOperations /// Subscription ID. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate + /// the header with 'no-cache' value to bypass existing caches. /// /// /// The headers that will be added to request. @@ -73,5 +80,91 @@ 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 whether the request should utilize any caches. Populate + /// the header with 'no-cache' value to bypass existing 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. + /// + /// + /// 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. + /// + /// + /// 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, string skiptoken = default(string), 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 774bcab175bf..405cfa35bd60 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,20 @@ public partial interface IManagementGroupsAPIClient : System.IDisposable string ApiVersion { get; } /// - /// Gets or sets the preferred language for the response. + /// 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 +83,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 597faf9130ad..d2da55a2934b 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IManagementGroupsOperations.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/IManagementGroupsOperations.cs @@ -25,16 +25,18 @@ public partial interface IManagementGroupsOperations { /// /// List management groups for the authenticated user. + /// /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate + /// the header with 'no-cache' value to bypass existing 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. + /// 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. @@ -54,14 +56,17 @@ public partial interface IManagementGroupsOperations Task>> ListWithHttpMessagesAsync(string cacheControl = "no-cache", string skiptoken = default(string), 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. $expand=ancestors includes the ancestor Ids of the current + /// group. Possible values include: 'children', 'path', 'ancestors' /// /// /// The $recurse=true query string parameter allows clients to request @@ -73,7 +78,8 @@ public partial interface IManagementGroupsOperations /// (i.e. '$filter=children.childType ne Subscription') /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate + /// the header with 'no-cache' value to bypass existing caches. /// /// /// The headers that will be added to request. @@ -92,10 +98,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. @@ -104,7 +111,8 @@ public partial interface IManagementGroupsOperations /// Management group creation parameters. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate + /// the header with 'no-cache' value to bypass existing caches. /// /// /// The headers that will be added to request. @@ -121,9 +129,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. @@ -132,7 +141,8 @@ public partial interface IManagementGroupsOperations /// Management group patch parameters. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate + /// the header with 'no-cache' value to bypass existing caches. /// /// /// The headers that will be added to request. @@ -151,14 +161,17 @@ 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. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate + /// the header with 'no-cache' value to bypass existing caches. /// /// /// The headers that will be added to request. @@ -175,12 +188,47 @@ 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)); /// - /// 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. + /// + /// + /// 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 elements to return when retrieving results. Passing this + /// in will override $skipToken. + /// + /// + /// 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, string skiptoken = default(string), int? top = default(int?), 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. + /// /// /// /// Management Group ID. @@ -189,7 +237,8 @@ public partial interface IManagementGroupsOperations /// Management group creation parameters. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate + /// the header with 'no-cache' value to bypass existing caches. /// /// /// The headers that will be added to request. @@ -206,16 +255,19 @@ 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. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate + /// the header with 'no-cache' value to bypass existing caches. /// /// /// The headers that will be added to request. @@ -232,15 +284,17 @@ 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. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate + /// the header with 'no-cache' value to bypass existing caches. /// /// /// The headers that will be added to request. @@ -258,5 +312,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 9007f4c65c61..3eafa80ded29 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. @@ -60,7 +61,8 @@ internal ManagementGroupSubscriptionsOperations(ManagementGroupsAPIClient client /// Subscription ID. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// Headers that will be added to request. @@ -71,6 +73,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 +85,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 +188,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 +218,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 +252,7 @@ internal ManagementGroupSubscriptionsOperations(ManagementGroupsAPIClient client /// /// De-associates subscription from the management group. + /// /// /// /// Management Group ID. @@ -237,7 +261,8 @@ internal ManagementGroupSubscriptionsOperations(ManagementGroupsAPIClient client /// Subscription ID. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// Headers that will be added to request. @@ -360,7 +385,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 +429,567 @@ internal ManagementGroupSubscriptionsOperations(ManagementGroupsAPIClient client return _result; } + /// + /// Retrieves details about given subscription which is associated with the + /// management group. + /// + /// + /// + /// Management Group ID. + /// + /// + /// Subscription ID. + /// + /// + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing 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. + /// + /// + /// 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. + /// + /// + /// 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, string skiptoken = default(string), 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("skiptoken", skiptoken); + 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 (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(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 a3fc6e27a62b..ba2841129489 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. @@ -34,15 +35,17 @@ public static partial class ManagementGroupSubscriptionsOperationsExtensions /// Subscription ID. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing 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. @@ -54,18 +57,23 @@ public static void Create(this IManagementGroupSubscriptionsOperations operation /// Subscription ID. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// 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. @@ -77,7 +85,8 @@ public static void Create(this IManagementGroupSubscriptionsOperations operation /// Subscription ID. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// public static void Delete(this IManagementGroupSubscriptionsOperations operations, string groupId, string subscriptionId, string cacheControl = "no-cache") { @@ -86,6 +95,7 @@ public static void Delete(this IManagementGroupSubscriptionsOperations operation /// /// De-associates subscription from the management group. + /// /// /// /// The operations group for this extension method. @@ -97,7 +107,8 @@ public static void Delete(this IManagementGroupSubscriptionsOperations operation /// Subscription ID. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// The cancellation token. @@ -107,5 +118,147 @@ 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 whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing 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 whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing 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. + /// + /// + /// 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 GetSubscriptionsUnderManagementGroup(this IManagementGroupSubscriptionsOperations operations, string groupId, string skiptoken = default(string)) + { + return operations.GetSubscriptionsUnderManagementGroupAsync(groupId, skiptoken).GetAwaiter().GetResult(); + } + + /// + /// Retrieves details about all subscriptions which are associated with the + /// management group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + /// + /// 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> GetSubscriptionsUnderManagementGroupAsync(this IManagementGroupSubscriptionsOperations operations, string groupId, string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetSubscriptionsUnderManagementGroupWithHttpMessagesAsync(groupId, skiptoken, 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 92035b29c06d..7805913e7167 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,20 @@ public partial class ManagementGroupsAPIClient : ServiceClient - /// Gets or sets the preferred language for the response. + /// 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 +86,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 +101,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 +209,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 +344,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 = "2021-04-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 8929c0f83e52..e347f989cb05 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsOperations.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsOperations.cs @@ -52,15 +52,18 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) /// /// List management groups for the authenticated user. + /// /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing 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. + /// 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. @@ -243,14 +246,17 @@ 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. $expand=ancestors includes + /// the ancestor Ids of the current group. Possible values include: 'children', + /// 'path', 'ancestors' /// /// /// The $recurse=true query string parameter allows clients to request @@ -262,7 +268,8 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) /// '$filter=children.childType ne Subscription') /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// Headers that will be added to request. @@ -321,7 +328,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 +467,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. @@ -471,7 +480,8 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) /// Management group creation parameters. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// The headers that will be added to request. @@ -479,15 +489,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. @@ -496,7 +507,8 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) /// Management group patch parameters. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// Headers that will be added to request. @@ -690,14 +702,16 @@ 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. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// The headers that will be added to request. @@ -705,17 +719,218 @@ 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. + /// + /// + /// 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 elements to return when retrieving results. Passing this in will + /// override $skipToken. + /// + /// + /// 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, string skiptoken = default(string), int? top = default(int?), 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("skiptoken", skiptoken); + tracingParameters.Add("top", top); + 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 (skiptoken != null) + { + _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(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. @@ -724,7 +939,8 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) /// Management group creation parameters. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// Headers that will be added to request. @@ -747,7 +963,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 +1101,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 +1132,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 +1144,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,14 +1165,16 @@ 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. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// Headers that will be added to request. @@ -966,7 +1197,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 +1324,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 +1337,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 +1349,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,12 +1371,14 @@ internal ManagementGroupsOperations(ManagementGroupsAPIClient client) /// /// List management groups for the authenticated user. + /// /// /// /// The NextLink from the previous successful call to List operation. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// Headers that will be added to request. @@ -1305,5 +1551,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 89c2e9917d99..56b483e9ef07 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsOperationsExtensions.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/ManagementGroupsOperationsExtensions.cs @@ -23,18 +23,21 @@ public static partial class ManagementGroupsOperationsExtensions { /// /// List management groups for the authenticated user. + /// /// /// /// The operations group for this extension method. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing 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. + /// 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)) { @@ -43,18 +46,21 @@ public static partial class ManagementGroupsOperationsExtensions /// /// List management groups for the authenticated user. + /// /// /// /// The operations group for this extension method. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing 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. + /// 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. @@ -69,6 +75,7 @@ public static partial class ManagementGroupsOperationsExtensions /// /// Get the details of the management group. + /// /// /// /// The operations group for this extension method. @@ -78,8 +85,10 @@ 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. $expand=ancestors includes + /// the ancestor Ids of the current group. Possible values include: 'children', + /// 'path', 'ancestors' /// /// /// The $recurse=true query string parameter allows clients to request @@ -91,7 +100,8 @@ public static partial class ManagementGroupsOperationsExtensions /// '$filter=children.childType ne Subscription') /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// public static ManagementGroup Get(this IManagementGroupsOperations operations, string groupId, string expand = default(string), bool? recurse = default(bool?), string filter = default(string), string cacheControl = "no-cache") { @@ -100,6 +110,7 @@ public static partial class ManagementGroupsOperationsExtensions /// /// Get the details of the management group. + /// /// /// /// The operations group for this extension method. @@ -109,8 +120,10 @@ 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. $expand=ancestors includes + /// the ancestor Ids of the current group. Possible values include: 'children', + /// 'path', 'ancestors' /// /// /// The $recurse=true query string parameter allows clients to request @@ -122,7 +135,8 @@ public static partial class ManagementGroupsOperationsExtensions /// '$filter=children.childType ne Subscription') /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// The cancellation token. @@ -136,9 +150,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. @@ -150,7 +166,8 @@ public static partial class ManagementGroupsOperationsExtensions /// Management group creation parameters. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// public static object CreateOrUpdate(this IManagementGroupsOperations operations, string groupId, CreateManagementGroupRequest createManagementGroupRequest, string cacheControl = "no-cache") { @@ -158,9 +175,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. @@ -172,7 +191,8 @@ public static object CreateOrUpdate(this IManagementGroupsOperations operations, /// Management group creation parameters. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// The cancellation token. @@ -187,6 +207,7 @@ public static object CreateOrUpdate(this IManagementGroupsOperations operations, /// /// Update a management group. + /// /// /// /// The operations group for this extension method. @@ -198,7 +219,8 @@ public static object CreateOrUpdate(this IManagementGroupsOperations operations, /// Management group patch parameters. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// public static ManagementGroup Update(this IManagementGroupsOperations operations, string groupId, PatchManagementGroupRequest patchGroupRequest, string cacheControl = "no-cache") { @@ -207,6 +229,7 @@ public static ManagementGroup Update(this IManagementGroupsOperations operations /// /// Update a management group. + /// /// /// /// The operations group for this extension method. @@ -218,7 +241,8 @@ public static ManagementGroup Update(this IManagementGroupsOperations operations /// Management group patch parameters. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// The cancellation token. @@ -232,8 +256,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. @@ -242,16 +267,18 @@ public static ManagementGroup Update(this IManagementGroupsOperations operations /// Management Group ID. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing 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. @@ -260,12 +287,13 @@ public static OperationResults Delete(this IManagementGroupsOperations operation /// Management Group ID. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// 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 +302,69 @@ 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. + /// + /// + /// 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 elements to return when retrieving results. Passing this in will + /// override $skipToken. + /// + public static IPage GetDescendants(this IManagementGroupsOperations operations, string groupId, string skiptoken = default(string), int? top = default(int?)) + { + return operations.GetDescendantsAsync(groupId, skiptoken, top).GetAwaiter().GetResult(); + } + + /// + /// List all entities that descend from a management group. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// Management Group ID. + /// + /// + /// 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 elements to return when retrieving results. Passing this in will + /// override $skipToken. + /// + /// + /// The cancellation token. + /// + public static async Task> GetDescendantsAsync(this IManagementGroupsOperations operations, string groupId, string skiptoken = default(string), int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDescendantsWithHttpMessagesAsync(groupId, skiptoken, top, 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. @@ -288,7 +376,8 @@ public static OperationResults Delete(this IManagementGroupsOperations operation /// Management group creation parameters. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// public static object BeginCreateOrUpdate(this IManagementGroupsOperations operations, string groupId, CreateManagementGroupRequest createManagementGroupRequest, string cacheControl = "no-cache") { @@ -296,9 +385,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. @@ -310,7 +401,8 @@ public static object BeginCreateOrUpdate(this IManagementGroupsOperations operat /// Management group creation parameters. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// The cancellation token. @@ -324,8 +416,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. @@ -334,16 +427,18 @@ public static object BeginCreateOrUpdate(this IManagementGroupsOperations operat /// Management Group ID. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing 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. @@ -352,12 +447,13 @@ public static OperationResults BeginDelete(this IManagementGroupsOperations oper /// Management Group ID. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// 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 +463,7 @@ public static OperationResults BeginDelete(this IManagementGroupsOperations oper /// /// List management groups for the authenticated user. + /// /// /// /// The operations group for this extension method. @@ -375,7 +472,8 @@ public static OperationResults BeginDelete(this IManagementGroupsOperations oper /// The NextLink from the previous successful call to List operation. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// public static IPage ListNext(this IManagementGroupsOperations operations, string nextPageLink, string cacheControl = "no-cache") { @@ -384,6 +482,7 @@ public static IPage ListNext(this IManagementGroupsOperatio /// /// List management groups for the authenticated user. + /// /// /// /// The operations group for this extension method. @@ -392,7 +491,8 @@ public static IPage ListNext(this IManagementGroupsOperatio /// The NextLink from the previous successful call to List operation. /// /// - /// Indicates that the request shouldn't utilize any caches. + /// Indicates whether the request should utilize any caches. Populate the + /// header with 'no-cache' value to bypass existing caches. /// /// /// The cancellation token. @@ -405,5 +505,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 000000000000..193272ebfb6c --- /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 dcb26f6cd829..dbd68cd3e4ce 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 955db046aea0..fbaa6e58176c 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 dfe81304c3f5..ac4942b13a04 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 000000000000..4eadc039c93c --- /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 000000000000..9daf4ccd201b --- /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 000000000000..7988d461e814 --- /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 d04b7d799078..1366fb8e6eb4 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 56543eb2f256..592a760a81da 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 000000000000..0ac33a9cf7e4 --- /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 000000000000..1e2132d057b0 --- /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 000000000000..4453d462e76c --- /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 f666003b794e..887931a0d79f 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,18 +47,15 @@ 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)) + 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)) { Id = id; Type = type; Name = name; TenantId = tenantId; DisplayName = displayName; - Roles = roles; Details = details; Children = children; CustomInit(); @@ -78,7 +75,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 +100,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 /// 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 dd4deefe57b4..6bd9d1fa8a38 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/ManagementGroupDetails.cs b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupDetails.cs index 5c92ff59b371..30276fb88e5f 100644 --- a/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupDetails.cs +++ b/sdk/managementgroups/Microsoft.Azure.Management.ManagementGroups/src/Generated/Models/ManagementGroupDetails.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.Management.ManagementGroups.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -35,12 +37,22 @@ public ManagementGroupDetails() /// The identity of the principal or process /// that updated the object. /// Parent - public ManagementGroupDetails(double? version = default(double?), System.DateTime? updatedTime = default(System.DateTime?), string updatedBy = default(string), ParentGroupInfo parent = default(ParentGroupInfo)) + /// The path from the root to the current + /// group. + /// The ancestors of the + /// management group. + /// The ancestors of the + /// management group displayed in reversed order, from immediate parent + /// to the root. + public ManagementGroupDetails(double? version = default(double?), System.DateTime? updatedTime = default(System.DateTime?), string updatedBy = default(string), ParentGroupInfo parent = default(ParentGroupInfo), IList path = default(IList), IList managementGroupAncestors = default(IList), IList managementGroupAncestorsChain = default(IList)) { Version = version; UpdatedTime = updatedTime; UpdatedBy = updatedBy; Parent = parent; + Path = path; + ManagementGroupAncestors = managementGroupAncestors; + ManagementGroupAncestorsChain = managementGroupAncestorsChain; CustomInit(); } @@ -74,5 +86,24 @@ public ManagementGroupDetails() [JsonProperty(PropertyName = "parent")] public ParentGroupInfo Parent { get; set; } + /// + /// Gets or sets the path from the root to the current group. + /// + [JsonProperty(PropertyName = "path")] + public IList Path { get; set; } + + /// + /// Gets or sets the ancestors of the management group. + /// + [JsonProperty(PropertyName = "managementGroupAncestors")] + public IList ManagementGroupAncestors { get; set; } + + /// + /// Gets or sets the ancestors of the management group displayed in + /// reversed order, from immediate parent to the root. + /// + [JsonProperty(PropertyName = "managementGroupAncestorsChain")] + public IList ManagementGroupAncestorsChain { get; set; } + } } 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 42cb7d13f142..a2811f355f50 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 000000000000..2b4243c28114 --- /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 000000000000..75065c9de3ac --- /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 000000000000..537e721941e2 --- /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 f1d913543fb0..68deccf42346 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 7cc762b14285..8820bac17f01 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 000000000000..96aa616ee933 --- /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 f1cad22ea6f6..0f8e0f25a747 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 9e654323e40a..50c6dd77c044 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", "2021-04-01"), + new Tuple("Management", "Entities", "2021-04-01"), + new Tuple("Management", "HierarchySettings", "2021-04-01"), + new Tuple("Management", "ManagementGroupSubscriptions", "2021-04-01"), + new Tuple("Management", "ManagementGroups", "2021-04-01"), + new Tuple("Management", "Operations", "2021-04-01"), + new Tuple("Management", "StartTenantBackfill", "2021-04-01"), + new Tuple("Management", "TenantBackfillStatus", "2021-04-01"), }.AsEnumerable(); } }