From 9a7271bf0728118bec3d3a63ea6912f9ada3a9c1 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 21 Jun 2021 08:43:07 +0000 Subject: [PATCH] CodeGen from PR 14890 in Azure/azure-rest-api-specs add track 2 information to authorization RP (#14890) --- .../AuthorizationManagementClient.cs | 48 +- .../ClassicAdministratorsOperations.cs | 405 ---- ...assicAdministratorsOperationsExtensions.cs | 91 - .../Generated/DenyAssignmentsOperations.cs | 1930 ----------------- .../DenyAssignmentsOperationsExtensions.cs | 422 ---- .../GlobalAdministratorOperations.cs | 198 -- ...GlobalAdministratorOperationsExtensions.cs | 50 - .../IAuthorizationManagementClient.cs | 39 +- .../IClassicAdministratorsOperations.cs | 70 - .../Generated/IDenyAssignmentsOperations.cs | 277 --- .../IGlobalAdministratorOperations.cs | 43 - .../src/Generated/IPermissionsOperations.cs | 127 -- .../IProviderOperationsMetadataOperations.cs | 97 - .../Generated/IRoleAssignmentsOperations.cs | 86 +- .../Generated/IRoleDefinitionsOperations.cs | 179 -- .../Generated/Models/ClassicAdministrator.cs | 87 - .../src/Generated/Models/DenyAssignment.cs | 149 -- .../Generated/Models/DenyAssignmentFilter.cs | 75 - .../Models/DenyAssignmentPermission.cs | 85 - ...nitionFilter.cs => ErrorAdditionalInfo.cs} | 32 +- .../src/Generated/Models/ErrorDetail.cs | 85 + .../src/Generated/Models/ErrorResponse.cs | 56 + .../Models/ErrorResponseException.cs | 62 + .../src/Generated/Models/Permission.cs | 77 - .../src/Generated/Models/Principal.cs | 75 - .../src/Generated/Models/ProviderOperation.cs | 92 - .../Models/ProviderOperationsMetadata.cs | 93 - .../src/Generated/Models/ResourceType.cs | 69 - .../src/Generated/Models/RoleAssignment.cs | 60 +- .../Models/RoleAssignmentCreateParameters.cs | 28 +- .../src/Generated/Models/RoleDefinition.cs | 113 - .../src/Generated/PermissionsOperations.cs | 806 ------- .../PermissionsOperationsExtensions.cs | 185 -- .../ProviderOperationsMetadataOperations.cs | 588 ----- ...rOperationsMetadataOperationsExtensions.cs | 133 -- .../Generated/RoleAssignmentsOperations.cs | 469 ++-- .../RoleAssignmentsOperationsExtensions.cs | 148 +- .../Generated/RoleDefinitionsOperations.cs | 1185 ---------- .../RoleDefinitionsOperationsExtensions.cs | 268 --- .../SdkInfo_AuthorizationManagementClient.cs | 11 +- 40 files changed, 769 insertions(+), 8324 deletions(-) delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperations.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperationsExtensions.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/DenyAssignmentsOperations.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/DenyAssignmentsOperationsExtensions.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/GlobalAdministratorOperations.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/GlobalAdministratorOperationsExtensions.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IClassicAdministratorsOperations.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IDenyAssignmentsOperations.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IGlobalAdministratorOperations.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IPermissionsOperations.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IProviderOperationsMetadataOperations.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleDefinitionsOperations.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ClassicAdministrator.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/DenyAssignment.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/DenyAssignmentFilter.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/DenyAssignmentPermission.cs rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/{RoleDefinitionFilter.cs => ErrorAdditionalInfo.cs} (53%) create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDetail.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorResponse.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorResponseException.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Permission.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Principal.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ProviderOperation.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ProviderOperationsMetadata.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ResourceType.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleDefinition.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/PermissionsOperations.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/PermissionsOperationsExtensions.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ProviderOperationsMetadataOperations.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ProviderOperationsMetadataOperationsExtensions.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleDefinitionsOperations.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleDefinitionsOperationsExtensions.cs diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AuthorizationManagementClient.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AuthorizationManagementClient.cs index d99de1b5f8186..ec6455141778a 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AuthorizationManagementClient.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AuthorizationManagementClient.cs @@ -21,6 +21,12 @@ namespace Microsoft.Azure.Management.Authorization using System.Net; using System.Net.Http; + /// + /// Role based access control provides you a way to apply granular level + /// policy administration down to individual resources or resource groups. + /// These operations enable you to manage role assignments. A role + /// assignment grants access to Azure Active Directory users. + /// public partial class AuthorizationManagementClient : ServiceClient, IAuthorizationManagementClient, IAzureClient { /// @@ -43,6 +49,11 @@ public partial class AuthorizationManagementClient : ServiceClient public ServiceClientCredentials Credentials { get; private set; } + /// + /// The API version to use for this operation. + /// + public string ApiVersion { get; private set; } + /// /// The ID of the target subscription. /// @@ -66,36 +77,6 @@ public partial class AuthorizationManagementClient : ServiceClient public bool? GenerateClientRequestId { get; set; } - /// - /// Gets the IClassicAdministratorsOperations. - /// - public virtual IClassicAdministratorsOperations ClassicAdministrators { get; private set; } - - /// - /// Gets the IGlobalAdministratorOperations. - /// - public virtual IGlobalAdministratorOperations GlobalAdministrator { get; private set; } - - /// - /// Gets the IProviderOperationsMetadataOperations. - /// - public virtual IProviderOperationsMetadataOperations ProviderOperationsMetadata { get; private set; } - - /// - /// Gets the IPermissionsOperations. - /// - public virtual IPermissionsOperations Permissions { get; private set; } - - /// - /// Gets the IRoleDefinitionsOperations. - /// - public virtual IRoleDefinitionsOperations RoleDefinitions { get; private set; } - - /// - /// Gets the IDenyAssignmentsOperations. - /// - public virtual IDenyAssignmentsOperations DenyAssignments { get; private set; } - /// /// Gets the IRoleAssignmentsOperations. /// @@ -342,14 +323,9 @@ public AuthorizationManagementClient(System.Uri baseUri, ServiceClientCredential /// private void Initialize() { - ClassicAdministrators = new ClassicAdministratorsOperations(this); - GlobalAdministrator = new GlobalAdministratorOperations(this); - ProviderOperationsMetadata = new ProviderOperationsMetadataOperations(this); - Permissions = new PermissionsOperations(this); - RoleDefinitions = new RoleDefinitionsOperations(this); - DenyAssignments = new DenyAssignmentsOperations(this); RoleAssignments = new RoleAssignmentsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2020-04-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperations.cs deleted file mode 100644 index 15ee7fd6f9d9a..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperations.cs +++ /dev/null @@ -1,405 +0,0 @@ -// -// 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.Authorization -{ - 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; - - /// - /// ClassicAdministratorsOperations operations. - /// - internal partial class ClassicAdministratorsOperations : IServiceOperations, IClassicAdministratorsOperations - { - /// - /// Initializes a new instance of the ClassicAdministratorsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ClassicAdministratorsOperations(AuthorizationManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the AuthorizationManagementClient - /// - public AuthorizationManagementClient Client { get; private set; } - - /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-06-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/classicAdministrators").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 service administrator, account administrator, and co-administrators - /// for the subscription. - /// - /// - /// 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>> ListNextWithHttpMessagesAsync(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, "ListNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperationsExtensions.cs deleted file mode 100644 index 96543f2d5cef8..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperationsExtensions.cs +++ /dev/null @@ -1,91 +0,0 @@ -// -// 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.Authorization -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ClassicAdministratorsOperations. - /// - public static partial class ClassicAdministratorsOperationsExtensions - { - /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IClassicAdministratorsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IClassicAdministratorsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IClassicAdministratorsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListNextAsync(this IClassicAdministratorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/DenyAssignmentsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/DenyAssignmentsOperations.cs deleted file mode 100644 index e76eb29ebef97..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/DenyAssignmentsOperations.cs +++ /dev/null @@ -1,1930 +0,0 @@ -// -// 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.Authorization -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; - 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; - - /// - /// DenyAssignmentsOperations operations. - /// - internal partial class DenyAssignmentsOperations : IServiceOperations, IDenyAssignmentsOperations - { - /// - /// Initializes a new instance of the DenyAssignmentsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal DenyAssignmentsOperations(AuthorizationManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the AuthorizationManagementClient - /// - public AuthorizationManagementClient Client { get; private set; } - - /// - /// Gets deny assignments for a resource. - /// - /// - /// The name of the resource group. - /// - /// - /// The namespace of the resource provider. - /// - /// - /// The parent resource identity. - /// - /// - /// The resource type of the resource. - /// - /// - /// The name of the resource to get deny assignments for. - /// - /// - /// OData parameters to apply to the 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>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceProviderNamespace == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); - } - if (parentResourcePath == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parentResourcePath"); - } - if (resourceType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); - } - if (resourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); - } - string apiVersion = "2018-07-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("resourceProviderNamespace", resourceProviderNamespace); - tracingParameters.Add("parentResourcePath", parentResourcePath); - tracingParameters.Add("resourceType", resourceType); - tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListForResource", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{resourceProviderNamespace}", System.Uri.EscapeDataString(resourceProviderNamespace)); - _url = _url.Replace("{parentResourcePath}", parentResourcePath); - _url = _url.Replace("{resourceType}", resourceType); - _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _queryParameters.Add(_odataFilter); - } - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 deny assignments for a resource group. - /// - /// - /// The name of the resource group. - /// - /// - /// OData parameters to apply to the 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>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - string apiVersion = "2018-07-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListForResourceGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _queryParameters.Add(_odataFilter); - } - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 all deny assignments for the subscription. - /// - /// - /// OData parameters to apply to the 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>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2018-07-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("apiVersion", apiVersion); - 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _queryParameters.Add(_odataFilter); - } - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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; - } - - /// - /// Get the specified deny assignment. - /// - /// - /// The scope of the deny assignment. - /// - /// - /// The ID of the deny assignment to get. - /// - /// - /// 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 scope, string denyAssignmentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - if (denyAssignmentId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "denyAssignmentId"); - } - string apiVersion = "2018-07-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("scope", scope); - tracingParameters.Add("denyAssignmentId", denyAssignmentId); - tracingParameters.Add("apiVersion", apiVersion); - 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}").ToString(); - _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{denyAssignmentId}", System.Uri.EscapeDataString(denyAssignmentId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 a deny assignment by ID. - /// - /// - /// The fully qualified deny assignment ID. For example, use the format, - /// /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} - /// for subscription level deny assignments, or - /// /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for - /// tenant level deny assignments. - /// - /// - /// 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> GetByIdWithHttpMessagesAsync(string denyAssignmentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (denyAssignmentId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "denyAssignmentId"); - } - string apiVersion = "2018-07-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("denyAssignmentId", denyAssignmentId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetById", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{denyAssignmentId}").ToString(); - _url = _url.Replace("{denyAssignmentId}", denyAssignmentId); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 deny assignments for a scope. - /// - /// - /// The scope of the deny assignments. - /// - /// - /// OData parameters to apply to the 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>> ListForScopeWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - string apiVersion = "2018-07-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("scope", scope); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListForScope", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/denyAssignments").ToString(); - _url = _url.Replace("{scope}", scope); - List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _queryParameters.Add(_odataFilter); - } - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 deny assignments for a resource. - /// - /// - /// 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>> ListForResourceNextWithHttpMessagesAsync(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, "ListForResourceNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 deny assignments for a resource 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>> ListForResourceGroupNextWithHttpMessagesAsync(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, "ListForResourceGroupNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 all deny assignments for the subscription. - /// - /// - /// 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>> ListNextWithHttpMessagesAsync(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, "ListNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 deny assignments for a scope. - /// - /// - /// 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>> ListForScopeNextWithHttpMessagesAsync(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, "ListForScopeNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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/authorization/Microsoft.Azure.Management.Authorization/src/Generated/DenyAssignmentsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/DenyAssignmentsOperationsExtensions.cs deleted file mode 100644 index ff9c27a805c50..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/DenyAssignmentsOperationsExtensions.cs +++ /dev/null @@ -1,422 +0,0 @@ -// -// 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.Authorization -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for DenyAssignmentsOperations. - /// - public static partial class DenyAssignmentsOperationsExtensions - { - /// - /// Gets deny assignments for a resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The namespace of the resource provider. - /// - /// - /// The parent resource identity. - /// - /// - /// The resource type of the resource. - /// - /// - /// The name of the resource to get deny assignments for. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage ListForResource(this IDenyAssignmentsOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListForResourceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// Gets deny assignments for a resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The namespace of the resource provider. - /// - /// - /// The parent resource identity. - /// - /// - /// The resource type of the resource. - /// - /// - /// The name of the resource to get deny assignments for. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListForResourceAsync(this IDenyAssignmentsOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListForResourceWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets deny assignments for a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage ListForResourceGroup(this IDenyAssignmentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListForResourceGroupAsync(resourceGroupName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// Gets deny assignments for a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListForResourceGroupAsync(this IDenyAssignmentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListForResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets all deny assignments for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IDenyAssignmentsOperations operations, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(odataQuery).GetAwaiter().GetResult(); - } - - /// - /// Gets all deny assignments for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IDenyAssignmentsOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get the specified deny assignment. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope of the deny assignment. - /// - /// - /// The ID of the deny assignment to get. - /// - public static DenyAssignment Get(this IDenyAssignmentsOperations operations, string scope, string denyAssignmentId) - { - return operations.GetAsync(scope, denyAssignmentId).GetAwaiter().GetResult(); - } - - /// - /// Get the specified deny assignment. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope of the deny assignment. - /// - /// - /// The ID of the deny assignment to get. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IDenyAssignmentsOperations operations, string scope, string denyAssignmentId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(scope, denyAssignmentId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a deny assignment by ID. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The fully qualified deny assignment ID. For example, use the format, - /// /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} - /// for subscription level deny assignments, or - /// /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for - /// tenant level deny assignments. - /// - public static DenyAssignment GetById(this IDenyAssignmentsOperations operations, string denyAssignmentId) - { - return operations.GetByIdAsync(denyAssignmentId).GetAwaiter().GetResult(); - } - - /// - /// Gets a deny assignment by ID. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The fully qualified deny assignment ID. For example, use the format, - /// /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} - /// for subscription level deny assignments, or - /// /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for - /// tenant level deny assignments. - /// - /// - /// The cancellation token. - /// - public static async Task GetByIdAsync(this IDenyAssignmentsOperations operations, string denyAssignmentId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetByIdWithHttpMessagesAsync(denyAssignmentId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets deny assignments for a scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope of the deny assignments. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage ListForScope(this IDenyAssignmentsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListForScopeAsync(scope, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// Gets deny assignments for a scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope of the deny assignments. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListForScopeAsync(this IDenyAssignmentsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListForScopeWithHttpMessagesAsync(scope, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets deny assignments for a resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListForResourceNext(this IDenyAssignmentsOperations operations, string nextPageLink) - { - return operations.ListForResourceNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets deny assignments for a resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListForResourceNextAsync(this IDenyAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListForResourceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets deny assignments for a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListForResourceGroupNext(this IDenyAssignmentsOperations operations, string nextPageLink) - { - return operations.ListForResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets deny assignments for a resource 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> ListForResourceGroupNextAsync(this IDenyAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListForResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets all deny assignments for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IDenyAssignmentsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets all deny assignments for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListNextAsync(this IDenyAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets deny assignments for a scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListForScopeNext(this IDenyAssignmentsOperations operations, string nextPageLink) - { - return operations.ListForScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets deny assignments for a scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListForScopeNextAsync(this IDenyAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListForScopeNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/GlobalAdministratorOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/GlobalAdministratorOperations.cs deleted file mode 100644 index 63a9a8723746b..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/GlobalAdministratorOperations.cs +++ /dev/null @@ -1,198 +0,0 @@ -// -// 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.Authorization -{ - 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; - - /// - /// GlobalAdministratorOperations operations. - /// - internal partial class GlobalAdministratorOperations : IServiceOperations, IGlobalAdministratorOperations - { - /// - /// Initializes a new instance of the GlobalAdministratorOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal GlobalAdministratorOperations(AuthorizationManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the AuthorizationManagementClient - /// - public AuthorizationManagementClient Client { get; private set; } - - /// - /// Elevates access for a Global Administrator. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task ElevateAccessWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - string apiVersion = "2015-07-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ElevateAccess", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Authorization/elevateAccess").ToString(); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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("POST"); - _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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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/authorization/Microsoft.Azure.Management.Authorization/src/Generated/GlobalAdministratorOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/GlobalAdministratorOperationsExtensions.cs deleted file mode 100644 index 8dc535c1f0cf2..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/GlobalAdministratorOperationsExtensions.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// 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.Authorization -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for GlobalAdministratorOperations. - /// - public static partial class GlobalAdministratorOperationsExtensions - { - /// - /// Elevates access for a Global Administrator. - /// - /// - /// The operations group for this extension method. - /// - public static void ElevateAccess(this IGlobalAdministratorOperations operations) - { - operations.ElevateAccessAsync().GetAwaiter().GetResult(); - } - - /// - /// Elevates access for a Global Administrator. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task ElevateAccessAsync(this IGlobalAdministratorOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.ElevateAccessWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAuthorizationManagementClient.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAuthorizationManagementClient.cs index b150f02c97209..6d23d6d0aca3c 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAuthorizationManagementClient.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAuthorizationManagementClient.cs @@ -16,6 +16,10 @@ namespace Microsoft.Azure.Management.Authorization using Newtonsoft.Json; /// + /// Role based access control provides you a way to apply granular level + /// policy administration down to individual resources or resource groups. + /// These operations enable you to manage role assignments. A role + /// assignment grants access to Azure Active Directory users. /// public partial interface IAuthorizationManagementClient : System.IDisposable { @@ -39,6 +43,11 @@ public partial interface IAuthorizationManagementClient : System.IDisposable /// ServiceClientCredentials Credentials { get; } + /// + /// The API version to use for this operation. + /// + string ApiVersion { get; } + /// /// The ID of the target subscription. /// @@ -63,36 +72,6 @@ public partial interface IAuthorizationManagementClient : System.IDisposable bool? GenerateClientRequestId { get; set; } - /// - /// Gets the IClassicAdministratorsOperations. - /// - IClassicAdministratorsOperations ClassicAdministrators { get; } - - /// - /// Gets the IGlobalAdministratorOperations. - /// - IGlobalAdministratorOperations GlobalAdministrator { get; } - - /// - /// Gets the IProviderOperationsMetadataOperations. - /// - IProviderOperationsMetadataOperations ProviderOperationsMetadata { get; } - - /// - /// Gets the IPermissionsOperations. - /// - IPermissionsOperations Permissions { get; } - - /// - /// Gets the IRoleDefinitionsOperations. - /// - IRoleDefinitionsOperations RoleDefinitions { get; } - - /// - /// Gets the IDenyAssignmentsOperations. - /// - IDenyAssignmentsOperations DenyAssignments { get; } - /// /// Gets the IRoleAssignmentsOperations. /// diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IClassicAdministratorsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IClassicAdministratorsOperations.cs deleted file mode 100644 index 4b4cc291ec363..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IClassicAdministratorsOperations.cs +++ /dev/null @@ -1,70 +0,0 @@ -// -// 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.Authorization -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ClassicAdministratorsOperations operations. - /// - public partial interface IClassicAdministratorsOperations - { - /// - /// Gets service administrator, account administrator, and - /// co-administrators for the subscription. - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets service administrator, account administrator, and - /// co-administrators for the subscription. - /// - /// - /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IDenyAssignmentsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IDenyAssignmentsOperations.cs deleted file mode 100644 index a1e1ee39aaa23..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IDenyAssignmentsOperations.cs +++ /dev/null @@ -1,277 +0,0 @@ -// -// 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.Authorization -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// DenyAssignmentsOperations operations. - /// - public partial interface IDenyAssignmentsOperations - { - /// - /// Gets deny assignments for a resource. - /// - /// - /// The name of the resource group. - /// - /// - /// The namespace of the resource provider. - /// - /// - /// The parent resource identity. - /// - /// - /// The resource type of the resource. - /// - /// - /// The name of the resource to get deny assignments for. - /// - /// - /// OData parameters to apply to the 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>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets deny assignments for a resource group. - /// - /// - /// The name of the resource group. - /// - /// - /// OData parameters to apply to the 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>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets all deny assignments for the subscription. - /// - /// - /// OData parameters to apply to the 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>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get the specified deny assignment. - /// - /// - /// The scope of the deny assignment. - /// - /// - /// The ID of the deny assignment to get. - /// - /// - /// 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 scope, string denyAssignmentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a deny assignment by ID. - /// - /// - /// The fully qualified deny assignment ID. For example, use the - /// format, - /// /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} - /// for subscription level deny assignments, or - /// /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} - /// for tenant level deny assignments. - /// - /// - /// 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> GetByIdWithHttpMessagesAsync(string denyAssignmentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets deny assignments for a scope. - /// - /// - /// The scope of the deny assignments. - /// - /// - /// OData parameters to apply to the 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>> ListForScopeWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets deny assignments for a resource. - /// - /// - /// 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>> ListForResourceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets deny assignments for a resource 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>> ListForResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets all deny assignments for the subscription. - /// - /// - /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets deny assignments for a scope. - /// - /// - /// 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>> ListForScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IGlobalAdministratorOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IGlobalAdministratorOperations.cs deleted file mode 100644 index 1f49a281bee57..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IGlobalAdministratorOperations.cs +++ /dev/null @@ -1,43 +0,0 @@ -// -// 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.Authorization -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// GlobalAdministratorOperations operations. - /// - public partial interface IGlobalAdministratorOperations - { - /// - /// Elevates access for a Global Administrator. - /// - /// - /// 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 ElevateAccessWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IPermissionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IPermissionsOperations.cs deleted file mode 100644 index 63a5b674386f5..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IPermissionsOperations.cs +++ /dev/null @@ -1,127 +0,0 @@ -// -// 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.Authorization -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PermissionsOperations operations. - /// - public partial interface IPermissionsOperations - { - /// - /// Gets all permissions the caller has for a resource group. - /// - /// - /// The name of the resource group. - /// - /// - /// 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>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets all permissions the caller has for a resource. - /// - /// - /// The name of the resource group. - /// - /// - /// The namespace of the resource provider. - /// - /// - /// The parent resource identity. - /// - /// - /// The resource type of the resource. - /// - /// - /// The name of the resource to get the permissions for. - /// - /// - /// 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>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets all permissions the caller has for a resource 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>> ListForResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets all permissions the caller has for a resource. - /// - /// - /// 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>> ListForResourceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IProviderOperationsMetadataOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IProviderOperationsMetadataOperations.cs deleted file mode 100644 index 32e6e3b98cf8a..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IProviderOperationsMetadataOperations.cs +++ /dev/null @@ -1,97 +0,0 @@ -// -// 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.Authorization -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ProviderOperationsMetadataOperations operations. - /// - public partial interface IProviderOperationsMetadataOperations - { - /// - /// Gets provider operations metadata for the specified resource - /// provider. - /// - /// - /// The namespace of the resource provider. - /// - /// - /// Specifies whether to expand the values. - /// - /// - /// 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 resourceProviderNamespace, string expand = "resourceTypes", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets provider operations metadata for all resource providers. - /// - /// - /// Specifies whether to expand the values. - /// - /// - /// 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 expand = "resourceTypes", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets provider operations metadata for all resource providers. - /// - /// - /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentsOperations.cs index 7d71e8e960dd8..37d32fb8c6d47 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentsOperations.cs @@ -25,10 +25,10 @@ namespace Microsoft.Azure.Management.Authorization public partial interface IRoleAssignmentsOperations { /// - /// Gets role assignments for a resource. + /// List role assignments for a resource. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The namespace of the resource provider. @@ -45,13 +45,16 @@ public partial interface IRoleAssignmentsOperations /// /// OData parameters to apply to the operation. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -60,23 +63,26 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets role assignments for a resource group. + /// List role assignments for a resource group. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// OData parameters to apply to the operation. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -85,9 +91,9 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes a role assignment. + /// Delete a role assignment. /// /// /// The scope of the role assignment to delete. @@ -95,13 +101,16 @@ public partial interface IRoleAssignmentsOperations /// /// The name of the role assignment to delete. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -110,9 +119,9 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> DeleteWithHttpMessagesAsync(string scope, string roleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> DeleteWithHttpMessagesAsync(string scope, string roleAssignmentName, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates a role assignment. + /// Create a role assignment. /// /// /// The scope of the role assignment to create. The scope can be any @@ -136,7 +145,7 @@ public partial interface IRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -155,13 +164,16 @@ public partial interface IRoleAssignmentsOperations /// /// The name of the role assignment to get. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -170,20 +182,23 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string scope, string roleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string scope, string roleAssignmentName, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes a role assignment. + /// Delete a role assignment. /// /// /// The ID of the role assignment to delete. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -192,7 +207,7 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> DeleteByIdWithHttpMessagesAsync(string roleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> DeleteByIdWithHttpMessagesAsync(string roleId, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates a role assignment by ID. /// @@ -208,7 +223,7 @@ public partial interface IRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -224,13 +239,16 @@ public partial interface IRoleAssignmentsOperations /// /// The ID of the role assignment to get. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -239,20 +257,23 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> GetByIdWithHttpMessagesAsync(string roleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByIdWithHttpMessagesAsync(string roleId, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all role assignments for the subscription. /// /// /// OData parameters to apply to the operation. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -261,7 +282,7 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets role assignments for a scope. /// @@ -271,13 +292,16 @@ public partial interface IRoleAssignmentsOperations /// /// OData parameters to apply to the operation. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -286,9 +310,9 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListForScopeWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListForScopeWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets role assignments for a resource. + /// List role assignments for a resource. /// /// /// The NextLink from the previous successful call to List operation. @@ -299,7 +323,7 @@ public partial interface IRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -310,7 +334,7 @@ public partial interface IRoleAssignmentsOperations /// Task>> ListForResourceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets role assignments for a resource group. + /// List role assignments for a resource group. /// /// /// The NextLink from the previous successful call to List operation. @@ -321,7 +345,7 @@ public partial interface IRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -343,7 +367,7 @@ public partial interface IRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -365,7 +389,7 @@ public partial interface IRoleAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleDefinitionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleDefinitionsOperations.cs deleted file mode 100644 index 8a6b9b5731452..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleDefinitionsOperations.cs +++ /dev/null @@ -1,179 +0,0 @@ -// -// 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.Authorization -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// RoleDefinitionsOperations operations. - /// - public partial interface IRoleDefinitionsOperations - { - /// - /// Deletes a role definition. - /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition to delete. - /// - /// - /// 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> DeleteWithHttpMessagesAsync(string scope, string roleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get role definition by name (GUID). - /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition. - /// - /// - /// 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 scope, string roleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates a role definition. - /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition. - /// - /// - /// The values for the role definition. - /// - /// - /// 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 scope, string roleDefinitionId, RoleDefinition roleDefinition, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get all role definitions that are applicable at scope and above. - /// - /// - /// The scope of the role definition. - /// - /// - /// OData parameters to apply to the 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>> ListWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a role definition by ID. - /// - /// - /// The fully qualified role definition ID. Use the format, - /// /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} - /// for subscription level role definitions, or - /// /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} - /// for tenant level role definitions. - /// - /// - /// 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> GetByIdWithHttpMessagesAsync(string roleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get all role definitions that are applicable at scope and above. - /// - /// - /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ClassicAdministrator.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ClassicAdministrator.cs deleted file mode 100644 index b8d9b301b3f02..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ClassicAdministrator.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -// 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.Authorization.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Classic Administrators - /// - [Rest.Serialization.JsonTransformation] - public partial class ClassicAdministrator - { - /// - /// Initializes a new instance of the ClassicAdministrator class. - /// - public ClassicAdministrator() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ClassicAdministrator class. - /// - /// The ID of the administrator. - /// The name of the administrator. - /// The type of the administrator. - /// The email address of the - /// administrator. - /// The role of the administrator. - public ClassicAdministrator(string id = default(string), string name = default(string), string type = default(string), string emailAddress = default(string), string role = default(string)) - { - Id = id; - Name = name; - Type = type; - EmailAddress = emailAddress; - Role = role; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the ID of the administrator. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the name of the administrator. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the type of the administrator. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the email address of the administrator. - /// - [JsonProperty(PropertyName = "properties.emailAddress")] - public string EmailAddress { get; set; } - - /// - /// Gets or sets the role of the administrator. - /// - [JsonProperty(PropertyName = "properties.role")] - public string Role { get; set; } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/DenyAssignment.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/DenyAssignment.cs deleted file mode 100644 index 8ffb4af3444b1..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/DenyAssignment.cs +++ /dev/null @@ -1,149 +0,0 @@ -// -// 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.Authorization.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Deny Assignment - /// - [Rest.Serialization.JsonTransformation] - public partial class DenyAssignment - { - /// - /// Initializes a new instance of the DenyAssignment class. - /// - public DenyAssignment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DenyAssignment class. - /// - /// The deny assignment ID. - /// The deny assignment name. - /// The deny assignment type. - /// The display name of the deny - /// assignment. - /// The description of the deny - /// assignment. - /// An array of permissions that are denied - /// by the deny assignment. - /// The deny assignment scope. - /// Determines if the deny - /// assignment applies to child scopes. Default value is false. - /// Array of principals to which the deny - /// assignment applies. - /// Array of principals to which the - /// deny assignment does not apply. - /// Specifies whether this deny - /// assignment was created by Azure and cannot be edited or - /// deleted. - public DenyAssignment(string id = default(string), string name = default(string), string type = default(string), string denyAssignmentName = default(string), string description = default(string), IList permissions = default(IList), string scope = default(string), bool? doNotApplyToChildScopes = default(bool?), IList principals = default(IList), IList excludePrincipals = default(IList), bool? isSystemProtected = default(bool?)) - { - Id = id; - Name = name; - Type = type; - DenyAssignmentName = denyAssignmentName; - Description = description; - Permissions = permissions; - Scope = scope; - DoNotApplyToChildScopes = doNotApplyToChildScopes; - Principals = principals; - ExcludePrincipals = excludePrincipals; - IsSystemProtected = isSystemProtected; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the deny assignment ID. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets the deny assignment name. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets the deny assignment type. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets or sets the display name of the deny assignment. - /// - [JsonProperty(PropertyName = "properties.denyAssignmentName")] - public string DenyAssignmentName { get; set; } - - /// - /// Gets or sets the description of the deny assignment. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// Gets or sets an array of permissions that are denied by the deny - /// assignment. - /// - [JsonProperty(PropertyName = "properties.permissions")] - public IList Permissions { get; set; } - - /// - /// Gets or sets the deny assignment scope. - /// - [JsonProperty(PropertyName = "properties.scope")] - public string Scope { get; set; } - - /// - /// Gets or sets determines if the deny assignment applies to child - /// scopes. Default value is false. - /// - [JsonProperty(PropertyName = "properties.doNotApplyToChildScopes")] - public bool? DoNotApplyToChildScopes { get; set; } - - /// - /// Gets or sets array of principals to which the deny assignment - /// applies. - /// - [JsonProperty(PropertyName = "properties.principals")] - public IList Principals { get; set; } - - /// - /// Gets or sets array of principals to which the deny assignment does - /// not apply. - /// - [JsonProperty(PropertyName = "properties.excludePrincipals")] - public IList ExcludePrincipals { get; set; } - - /// - /// Gets or sets specifies whether this deny assignment was created by - /// Azure and cannot be edited or deleted. - /// - [JsonProperty(PropertyName = "properties.isSystemProtected")] - public bool? IsSystemProtected { get; set; } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/DenyAssignmentFilter.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/DenyAssignmentFilter.cs deleted file mode 100644 index 22660277fc27d..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/DenyAssignmentFilter.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -// 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.Authorization.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Deny Assignments filter - /// - public partial class DenyAssignmentFilter - { - /// - /// Initializes a new instance of the DenyAssignmentFilter class. - /// - public DenyAssignmentFilter() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DenyAssignmentFilter class. - /// - /// Return deny assignment with - /// specified name. - /// Return all deny assignments where the - /// specified principal is listed in the principals list of deny - /// assignments. - /// Return all deny assignments - /// where the specified principal is listed either in the principals - /// list or exclude principals list of deny assignments. - public DenyAssignmentFilter(string denyAssignmentName = default(string), string principalId = default(string), string gdprExportPrincipalId = default(string)) - { - DenyAssignmentName = denyAssignmentName; - PrincipalId = principalId; - GdprExportPrincipalId = gdprExportPrincipalId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets return deny assignment with specified name. - /// - [JsonProperty(PropertyName = "denyAssignmentName")] - public string DenyAssignmentName { get; set; } - - /// - /// Gets or sets return all deny assignments where the specified - /// principal is listed in the principals list of deny assignments. - /// - [JsonProperty(PropertyName = "principalId")] - public string PrincipalId { get; set; } - - /// - /// Gets or sets return all deny assignments where the specified - /// principal is listed either in the principals list or exclude - /// principals list of deny assignments. - /// - [JsonProperty(PropertyName = "gdprExportPrincipalId")] - public string GdprExportPrincipalId { get; set; } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/DenyAssignmentPermission.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/DenyAssignmentPermission.cs deleted file mode 100644 index 3690b9b956fc2..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/DenyAssignmentPermission.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -// 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.Authorization.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Deny assignment permissions. - /// - public partial class DenyAssignmentPermission - { - /// - /// Initializes a new instance of the DenyAssignmentPermission class. - /// - public DenyAssignmentPermission() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DenyAssignmentPermission class. - /// - /// Actions to which the deny assignment does not - /// grant access. - /// Actions to exclude from that the deny - /// assignment does not grant access. - /// Data actions to which the deny assignment - /// does not grant access. - /// Data actions to exclude from that the - /// deny assignment does not grant access. - public DenyAssignmentPermission(IList actions = default(IList), IList notActions = default(IList), IList dataActions = default(IList), IList notDataActions = default(IList)) - { - Actions = actions; - NotActions = notActions; - DataActions = dataActions; - NotDataActions = notDataActions; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets actions to which the deny assignment does not grant - /// access. - /// - [JsonProperty(PropertyName = "actions")] - public IList Actions { get; set; } - - /// - /// Gets or sets actions to exclude from that the deny assignment does - /// not grant access. - /// - [JsonProperty(PropertyName = "notActions")] - public IList NotActions { get; set; } - - /// - /// Gets or sets data actions to which the deny assignment does not - /// grant access. - /// - [JsonProperty(PropertyName = "dataActions")] - public IList DataActions { get; set; } - - /// - /// Gets or sets data actions to exclude from that the deny assignment - /// does not grant access. - /// - [JsonProperty(PropertyName = "notDataActions")] - public IList NotDataActions { get; set; } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleDefinitionFilter.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorAdditionalInfo.cs similarity index 53% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleDefinitionFilter.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorAdditionalInfo.cs index daabb45b9de1b..08e4d8460cfd2 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleDefinitionFilter.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorAdditionalInfo.cs @@ -14,29 +14,27 @@ namespace Microsoft.Azure.Management.Authorization.Models using System.Linq; /// - /// Role Definitions filter + /// The resource management error additional info. /// - public partial class RoleDefinitionFilter + public partial class ErrorAdditionalInfo { /// - /// Initializes a new instance of the RoleDefinitionFilter class. + /// Initializes a new instance of the ErrorAdditionalInfo class. /// - public RoleDefinitionFilter() + public ErrorAdditionalInfo() { CustomInit(); } /// - /// Initializes a new instance of the RoleDefinitionFilter class. + /// Initializes a new instance of the ErrorAdditionalInfo class. /// - /// Returns role definition with the specific - /// name. - /// Returns role definition with the specific - /// type. - public RoleDefinitionFilter(string roleName = default(string), string type = default(string)) + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) { - RoleName = roleName; Type = type; + Info = info; CustomInit(); } @@ -46,16 +44,16 @@ public RoleDefinitionFilter() partial void CustomInit(); /// - /// Gets or sets returns role definition with the specific name. + /// Gets the additional info type. /// - [JsonProperty(PropertyName = "roleName")] - public string RoleName { get; set; } + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } /// - /// Gets or sets returns role definition with the specific type. + /// Gets the additional info. /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } } } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDetail.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 0000000000000..40e1b30c1c36d --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDetail.cs @@ -0,0 +1,85 @@ +// +// 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.Authorization.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The error detail. + /// + public partial class ErrorDetail + { + /// + /// Initializes a new instance of the ErrorDetail class. + /// + public ErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetail class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorResponse.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 0000000000000..85201d33aa1e4 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,56 @@ +// +// 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.Authorization.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error response + /// + /// + /// Common error response for all Azure Resource Manager APIs to return + /// error details for failed operations. (This also follows the OData error + /// response format.). + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The error object. + public ErrorResponse(ErrorDetail error = default(ErrorDetail)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error object. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorResponseException.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 0000000000000..061d84c9b4445 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorResponseException.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.Authorization.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Permission.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Permission.cs deleted file mode 100644 index c9025e26f9c0c..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Permission.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -// 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.Authorization.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Role definition permissions. - /// - public partial class Permission - { - /// - /// Initializes a new instance of the Permission class. - /// - public Permission() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Permission class. - /// - /// Allowed actions. - /// Denied actions. - /// Allowed Data actions. - /// Denied Data actions. - public Permission(IList actions = default(IList), IList notActions = default(IList), IList dataActions = default(IList), IList notDataActions = default(IList)) - { - Actions = actions; - NotActions = notActions; - DataActions = dataActions; - NotDataActions = notDataActions; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets allowed actions. - /// - [JsonProperty(PropertyName = "actions")] - public IList Actions { get; set; } - - /// - /// Gets or sets denied actions. - /// - [JsonProperty(PropertyName = "notActions")] - public IList NotActions { get; set; } - - /// - /// Gets or sets allowed Data actions. - /// - [JsonProperty(PropertyName = "dataActions")] - public IList DataActions { get; set; } - - /// - /// Gets or sets denied Data actions. - /// - [JsonProperty(PropertyName = "notDataActions")] - public IList NotDataActions { get; set; } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Principal.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Principal.cs deleted file mode 100644 index 8eb0229796e04..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Principal.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -// 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.Authorization.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Deny assignment principal. - /// - public partial class Principal - { - /// - /// Initializes a new instance of the Principal class. - /// - public Principal() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Principal class. - /// - /// Object ID of the Azure AD principal (user, group, - /// or service principal) to which the deny assignment applies. An - /// empty guid '00000000-0000-0000-0000-000000000000' as principal id - /// and principal type as 'Everyone' represents all users, groups and - /// service principals. - /// Type of object represented by principal id - /// (user, group, or service principal). An empty guid - /// '00000000-0000-0000-0000-000000000000' as principal id and - /// principal type as 'Everyone' represents all users, groups and - /// service principals. - public Principal(string id = default(string), string type = default(string)) - { - Id = id; - Type = type; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets object ID of the Azure AD principal (user, group, or service - /// principal) to which the deny assignment applies. An empty guid - /// '00000000-0000-0000-0000-000000000000' as principal id and - /// principal type as 'Everyone' represents all users, groups and - /// service principals. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets type of object represented by principal id (user, group, or - /// service principal). An empty guid - /// '00000000-0000-0000-0000-000000000000' as principal id and - /// principal type as 'Everyone' represents all users, groups and - /// service principals. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ProviderOperation.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ProviderOperation.cs deleted file mode 100644 index 69f80c52c4e17..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ProviderOperation.cs +++ /dev/null @@ -1,92 +0,0 @@ -// -// 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.Authorization.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Operation - /// - public partial class ProviderOperation - { - /// - /// Initializes a new instance of the ProviderOperation class. - /// - public ProviderOperation() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ProviderOperation class. - /// - /// The operation name. - /// The operation display name. - /// The operation description. - /// The operation origin. - /// The operation properties. - /// The dataAction flag to specify the - /// operation type. - public ProviderOperation(string name = default(string), string displayName = default(string), string description = default(string), string origin = default(string), object properties = default(object), bool? isDataAction = default(bool?)) - { - Name = name; - DisplayName = displayName; - Description = description; - Origin = origin; - Properties = properties; - IsDataAction = isDataAction; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the operation name. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the operation display name. - /// - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; set; } - - /// - /// Gets or sets the operation description. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// Gets or sets the operation origin. - /// - [JsonProperty(PropertyName = "origin")] - public string Origin { get; set; } - - /// - /// Gets or sets the operation properties. - /// - [JsonProperty(PropertyName = "properties")] - public object Properties { get; set; } - - /// - /// Gets or sets the dataAction flag to specify the operation type. - /// - [JsonProperty(PropertyName = "isDataAction")] - public bool? IsDataAction { get; set; } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ProviderOperationsMetadata.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ProviderOperationsMetadata.cs deleted file mode 100644 index 47cf2dff941ba..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ProviderOperationsMetadata.cs +++ /dev/null @@ -1,93 +0,0 @@ -// -// 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.Authorization.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Provider Operations metadata - /// - public partial class ProviderOperationsMetadata - { - /// - /// Initializes a new instance of the ProviderOperationsMetadata class. - /// - public ProviderOperationsMetadata() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ProviderOperationsMetadata class. - /// - /// The provider id. - /// The provider name. - /// The provider type. - /// The provider display name. - /// The provider resource types - /// The provider operations. - public ProviderOperationsMetadata(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), IList resourceTypes = default(IList), IList operations = default(IList)) - { - Id = id; - Name = name; - Type = type; - DisplayName = displayName; - ResourceTypes = resourceTypes; - Operations = operations; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the provider id. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the provider name. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the provider type. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the provider display name. - /// - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; set; } - - /// - /// Gets or sets the provider resource types - /// - [JsonProperty(PropertyName = "resourceTypes")] - public IList ResourceTypes { get; set; } - - /// - /// Gets or sets the provider operations. - /// - [JsonProperty(PropertyName = "operations")] - public IList Operations { get; set; } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ResourceType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ResourceType.cs deleted file mode 100644 index a57f0cae6cdd6..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ResourceType.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -// 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.Authorization.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Resource Type - /// - public partial class ResourceType - { - /// - /// Initializes a new instance of the ResourceType class. - /// - public ResourceType() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ResourceType class. - /// - /// The resource type name. - /// The resource type display name. - /// The resource type operations. - public ResourceType(string name = default(string), string displayName = default(string), IList operations = default(IList)) - { - Name = name; - DisplayName = displayName; - Operations = operations; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the resource type name. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the resource type display name. - /// - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; set; } - - /// - /// Gets or sets the resource type operations. - /// - [JsonProperty(PropertyName = "operations")] - public IList Operations { get; set; } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignment.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignment.cs index 7825ab6a6b491..e069fb7f7eda1 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignment.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignment.cs @@ -46,10 +46,21 @@ public RoleAssignment() /// The Delegation flag for the role /// assignment /// Description of role assignment - /// The conditions on the role + /// The conditions on the role assignment. This + /// limits the resources it can be assigned to. e.g.: + /// @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + /// StringEqualsIgnoreCase 'foo_storage_container' + /// Version of the condition. Currently + /// accepted value is '2.0' + /// Time it was created + /// Time it was updated + /// Id of the user who created the /// assignment - /// Version of the condition - public RoleAssignment(string id = default(string), string name = default(string), string type = default(string), string scope = default(string), string roleDefinitionId = default(string), string principalId = default(string), string principalType = default(string), bool? canDelegate = default(bool?), string description = default(string), string condition = default(string), string conditionVersion = default(string)) + /// Id of the user who updated the + /// assignment + /// Id of the + /// delegated managed identity resource + public RoleAssignment(string id = default(string), string name = default(string), string type = default(string), string scope = default(string), string roleDefinitionId = default(string), string principalId = default(string), string principalType = default(string), bool? canDelegate = default(bool?), string description = default(string), string condition = default(string), string conditionVersion = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? updatedOn = default(System.DateTime?), string createdBy = default(string), string updatedBy = default(string), string delegatedManagedIdentityResourceId = default(string)) { Id = id; Name = name; @@ -62,6 +73,11 @@ public RoleAssignment() Description = description; Condition = condition; ConditionVersion = conditionVersion; + CreatedOn = createdOn; + UpdatedOn = updatedOn; + CreatedBy = createdBy; + UpdatedBy = updatedBy; + DelegatedManagedIdentityResourceId = delegatedManagedIdentityResourceId; CustomInit(); } @@ -128,16 +144,50 @@ public RoleAssignment() public string Description { get; set; } /// - /// Gets or sets the conditions on the role assignment + /// Gets or sets the conditions on the role assignment. This limits the + /// resources it can be assigned to. e.g.: + /// @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + /// StringEqualsIgnoreCase 'foo_storage_container' /// [JsonProperty(PropertyName = "properties.condition")] public string Condition { get; set; } /// - /// Gets or sets version of the condition + /// Gets or sets version of the condition. Currently accepted value is + /// '2.0' /// [JsonProperty(PropertyName = "properties.conditionVersion")] public string ConditionVersion { get; set; } + /// + /// Gets or sets time it was created + /// + [JsonProperty(PropertyName = "properties.createdOn")] + public System.DateTime? CreatedOn { get; set; } + + /// + /// Gets or sets time it was updated + /// + [JsonProperty(PropertyName = "properties.updatedOn")] + public System.DateTime? UpdatedOn { get; set; } + + /// + /// Gets or sets id of the user who created the assignment + /// + [JsonProperty(PropertyName = "properties.createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets id of the user who updated the assignment + /// + [JsonProperty(PropertyName = "properties.updatedBy")] + public string UpdatedBy { get; set; } + + /// + /// Gets or sets id of the delegated managed identity resource + /// + [JsonProperty(PropertyName = "properties.delegatedManagedIdentityResourceId")] + public string DelegatedManagedIdentityResourceId { get; set; } + } } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentCreateParameters.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentCreateParameters.cs index 7c7d5192b95f9..76e69633d9fb7 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentCreateParameters.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentCreateParameters.cs @@ -47,10 +47,15 @@ public RoleAssignmentCreateParameters() /// The delegation flag used for creating a /// role assignment /// Description of role assignment - /// The conditions on the role - /// assignment - /// Version of the condition - public RoleAssignmentCreateParameters(string roleDefinitionId, string principalId, string principalType = default(string), bool? canDelegate = default(bool?), string description = default(string), string condition = default(string), string conditionVersion = default(string)) + /// The conditions on the role assignment. This + /// limits the resources it can be assigned to. e.g.: + /// @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + /// StringEqualsIgnoreCase 'foo_storage_container' + /// Version of the condition. Currently + /// accepted value is '2.0' + /// Id of the + /// delegated managed identity resource + public RoleAssignmentCreateParameters(string roleDefinitionId, string principalId, string principalType = default(string), bool? canDelegate = default(bool?), string description = default(string), string condition = default(string), string conditionVersion = default(string), string delegatedManagedIdentityResourceId = default(string)) { RoleDefinitionId = roleDefinitionId; PrincipalId = principalId; @@ -59,6 +64,7 @@ public RoleAssignmentCreateParameters() Description = description; Condition = condition; ConditionVersion = conditionVersion; + DelegatedManagedIdentityResourceId = delegatedManagedIdentityResourceId; CustomInit(); } @@ -104,17 +110,27 @@ public RoleAssignmentCreateParameters() public string Description { get; set; } /// - /// Gets or sets the conditions on the role assignment + /// Gets or sets the conditions on the role assignment. This limits the + /// resources it can be assigned to. e.g.: + /// @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + /// StringEqualsIgnoreCase 'foo_storage_container' /// [JsonProperty(PropertyName = "properties.condition")] public string Condition { get; set; } /// - /// Gets or sets version of the condition + /// Gets or sets version of the condition. Currently accepted value is + /// '2.0' /// [JsonProperty(PropertyName = "properties.conditionVersion")] public string ConditionVersion { get; set; } + /// + /// Gets or sets id of the delegated managed identity resource + /// + [JsonProperty(PropertyName = "properties.delegatedManagedIdentityResourceId")] + public string DelegatedManagedIdentityResourceId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleDefinition.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleDefinition.cs deleted file mode 100644 index 8ecb291682b25..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleDefinition.cs +++ /dev/null @@ -1,113 +0,0 @@ -// -// 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.Authorization.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Role definition. - /// - [Rest.Serialization.JsonTransformation] - public partial class RoleDefinition - { - /// - /// Initializes a new instance of the RoleDefinition class. - /// - public RoleDefinition() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RoleDefinition class. - /// - /// The role definition ID. - /// The role definition name. - /// The role definition type. - /// The role name. - /// The role definition description. - /// The role type. - /// Role definition permissions. - /// Role definition assignable - /// scopes. - public RoleDefinition(string id = default(string), string name = default(string), string type = default(string), string roleName = default(string), string description = default(string), string roleType = default(string), IList permissions = default(IList), IList assignableScopes = default(IList)) - { - Id = id; - Name = name; - Type = type; - RoleName = roleName; - Description = description; - RoleType = roleType; - Permissions = permissions; - AssignableScopes = assignableScopes; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the role definition ID. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets the role definition name. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets the role definition type. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets or sets the role name. - /// - [JsonProperty(PropertyName = "properties.roleName")] - public string RoleName { get; set; } - - /// - /// Gets or sets the role definition description. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// Gets or sets the role type. - /// - [JsonProperty(PropertyName = "properties.type")] - public string RoleType { get; set; } - - /// - /// Gets or sets role definition permissions. - /// - [JsonProperty(PropertyName = "properties.permissions")] - public IList Permissions { get; set; } - - /// - /// Gets or sets role definition assignable scopes. - /// - [JsonProperty(PropertyName = "properties.assignableScopes")] - public IList AssignableScopes { get; set; } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/PermissionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/PermissionsOperations.cs deleted file mode 100644 index db64937690fd0..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/PermissionsOperations.cs +++ /dev/null @@ -1,806 +0,0 @@ -// -// 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.Authorization -{ - 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; - - /// - /// PermissionsOperations operations. - /// - internal partial class PermissionsOperations : IServiceOperations, IPermissionsOperations - { - /// - /// Initializes a new instance of the PermissionsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PermissionsOperations(AuthorizationManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the AuthorizationManagementClient - /// - public AuthorizationManagementClient Client { get; private set; } - - /// - /// Gets all permissions the caller has for a resource group. - /// - /// - /// The name of the resource group. - /// - /// - /// 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>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2018-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListForResourceGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 all permissions the caller has for a resource. - /// - /// - /// The name of the resource group. - /// - /// - /// The namespace of the resource provider. - /// - /// - /// The parent resource identity. - /// - /// - /// The resource type of the resource. - /// - /// - /// The name of the resource to get the permissions for. - /// - /// - /// 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>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceProviderNamespace == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); - } - if (parentResourcePath == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parentResourcePath"); - } - if (resourceType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); - } - if (resourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2018-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("resourceProviderNamespace", resourceProviderNamespace); - tracingParameters.Add("parentResourcePath", parentResourcePath); - tracingParameters.Add("resourceType", resourceType); - tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListForResource", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{resourceProviderNamespace}", System.Uri.EscapeDataString(resourceProviderNamespace)); - _url = _url.Replace("{parentResourcePath}", parentResourcePath); - _url = _url.Replace("{resourceType}", resourceType); - _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 all permissions the caller has for a resource 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>> ListForResourceGroupNextWithHttpMessagesAsync(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, "ListForResourceGroupNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 all permissions the caller has for a resource. - /// - /// - /// 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>> ListForResourceNextWithHttpMessagesAsync(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, "ListForResourceNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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/authorization/Microsoft.Azure.Management.Authorization/src/Generated/PermissionsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/PermissionsOperationsExtensions.cs deleted file mode 100644 index 4cd494b29a89b..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/PermissionsOperationsExtensions.cs +++ /dev/null @@ -1,185 +0,0 @@ -// -// 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.Authorization -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PermissionsOperations. - /// - public static partial class PermissionsOperationsExtensions - { - /// - /// Gets all permissions the caller has for a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - public static IPage ListForResourceGroup(this IPermissionsOperations operations, string resourceGroupName) - { - return operations.ListForResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Gets all permissions the caller has for a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The cancellation token. - /// - public static async Task> ListForResourceGroupAsync(this IPermissionsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListForResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets all permissions the caller has for a resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The namespace of the resource provider. - /// - /// - /// The parent resource identity. - /// - /// - /// The resource type of the resource. - /// - /// - /// The name of the resource to get the permissions for. - /// - public static IPage ListForResource(this IPermissionsOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName) - { - return operations.ListForResourceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName).GetAwaiter().GetResult(); - } - - /// - /// Gets all permissions the caller has for a resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The namespace of the resource provider. - /// - /// - /// The parent resource identity. - /// - /// - /// The resource type of the resource. - /// - /// - /// The name of the resource to get the permissions for. - /// - /// - /// The cancellation token. - /// - public static async Task> ListForResourceAsync(this IPermissionsOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListForResourceWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets all permissions the caller has for a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListForResourceGroupNext(this IPermissionsOperations operations, string nextPageLink) - { - return operations.ListForResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets all permissions the caller has for a resource 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> ListForResourceGroupNextAsync(this IPermissionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListForResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets all permissions the caller has for a resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListForResourceNext(this IPermissionsOperations operations, string nextPageLink) - { - return operations.ListForResourceNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets all permissions the caller has for a resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListForResourceNextAsync(this IPermissionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListForResourceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ProviderOperationsMetadataOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ProviderOperationsMetadataOperations.cs deleted file mode 100644 index 0a585ce285634..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ProviderOperationsMetadataOperations.cs +++ /dev/null @@ -1,588 +0,0 @@ -// -// 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.Authorization -{ - 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; - - /// - /// ProviderOperationsMetadataOperations operations. - /// - internal partial class ProviderOperationsMetadataOperations : IServiceOperations, IProviderOperationsMetadataOperations - { - /// - /// Initializes a new instance of the ProviderOperationsMetadataOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ProviderOperationsMetadataOperations(AuthorizationManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the AuthorizationManagementClient - /// - public AuthorizationManagementClient Client { get; private set; } - - /// - /// Gets provider operations metadata for the specified resource provider. - /// - /// - /// The namespace of the resource provider. - /// - /// - /// Specifies whether to expand the values. - /// - /// - /// 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 resourceProviderNamespace, string expand = "resourceTypes", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceProviderNamespace == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); - } - string apiVersion = "2018-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceProviderNamespace", resourceProviderNamespace); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("expand", expand); - 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.Authorization/providerOperations/{resourceProviderNamespace}").ToString(); - _url = _url.Replace("{resourceProviderNamespace}", System.Uri.EscapeDataString(resourceProviderNamespace)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (expand != null) - { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); - } - 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 provider operations metadata for all resource providers. - /// - /// - /// Specifies whether to expand the values. - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(string expand = "resourceTypes", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - string apiVersion = "2018-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("expand", expand); - 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.Authorization/providerOperations").ToString(); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (expand != null) - { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); - } - 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 provider operations metadata for all resource providers. - /// - /// - /// 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>> ListNextWithHttpMessagesAsync(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, "ListNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ProviderOperationsMetadataOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ProviderOperationsMetadataOperationsExtensions.cs deleted file mode 100644 index 1e2c531343669..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ProviderOperationsMetadataOperationsExtensions.cs +++ /dev/null @@ -1,133 +0,0 @@ -// -// 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.Authorization -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ProviderOperationsMetadataOperations. - /// - public static partial class ProviderOperationsMetadataOperationsExtensions - { - /// - /// Gets provider operations metadata for the specified resource provider. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The namespace of the resource provider. - /// - /// - /// Specifies whether to expand the values. - /// - public static ProviderOperationsMetadata Get(this IProviderOperationsMetadataOperations operations, string resourceProviderNamespace, string expand = "resourceTypes") - { - return operations.GetAsync(resourceProviderNamespace, expand).GetAwaiter().GetResult(); - } - - /// - /// Gets provider operations metadata for the specified resource provider. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The namespace of the resource provider. - /// - /// - /// Specifies whether to expand the values. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IProviderOperationsMetadataOperations operations, string resourceProviderNamespace, string expand = "resourceTypes", CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceProviderNamespace, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets provider operations metadata for all resource providers. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Specifies whether to expand the values. - /// - public static IPage List(this IProviderOperationsMetadataOperations operations, string expand = "resourceTypes") - { - return operations.ListAsync(expand).GetAwaiter().GetResult(); - } - - /// - /// Gets provider operations metadata for all resource providers. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Specifies whether to expand the values. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IProviderOperationsMetadataOperations operations, string expand = "resourceTypes", CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets provider operations metadata for all resource providers. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IProviderOperationsMetadataOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets provider operations metadata for all resource providers. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListNextAsync(this IProviderOperationsMetadataOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperations.cs index a2400ef800cf9..06e5d414b3645 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperations.cs @@ -52,10 +52,10 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) public AuthorizationManagementClient Client { get; private set; } /// - /// Gets role assignments for a resource. + /// List role assignments for a resource. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The namespace of the resource provider. @@ -72,13 +72,16 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// OData parameters to apply to the operation. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -93,12 +96,23 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } if (resourceProviderNamespace == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); @@ -115,11 +129,28 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-04-01-preview"; + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -133,7 +164,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) tracingParameters.Add("parentResourcePath", parentResourcePath); tracingParameters.Add("resourceType", resourceType); tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("tenantId", tenantId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListForResource", tracingParameters); } @@ -155,9 +186,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (tenantId != null) + { + _queryParameters.Add(string.Format("tenantId={0}", System.Uri.EscapeDataString(tenantId))); } if (_queryParameters.Count > 0) { @@ -219,14 +254,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -236,10 +270,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -285,21 +315,24 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// Gets role assignments for a resource group. + /// List role assignments for a resource group. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// OData parameters to apply to the operation. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -314,17 +347,45 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-04-01-preview"; + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -334,7 +395,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("tenantId", tenantId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListForResourceGroup", tracingParameters); } @@ -352,9 +413,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (tenantId != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("tenantId={0}", System.Uri.EscapeDataString(tenantId))); } if (_queryParameters.Count > 0) { @@ -416,14 +481,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -433,10 +497,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -482,7 +542,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// Deletes a role assignment. + /// Delete a role assignment. /// /// /// The scope of the role assignment to delete. @@ -490,13 +550,16 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// The name of the role assignment to delete. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -511,7 +574,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> DeleteWithHttpMessagesAsync(string scope, string roleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> DeleteWithHttpMessagesAsync(string scope, string roleAssignmentName, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { @@ -521,7 +584,17 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentName"); } - string apiVersion = "2020-04-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -531,7 +604,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("scope", scope); tracingParameters.Add("roleAssignmentName", roleAssignmentName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("tenantId", tenantId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -541,9 +614,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _url = _url.Replace("{scope}", scope); _url = _url.Replace("{roleAssignmentName}", System.Uri.EscapeDataString(roleAssignmentName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (tenantId != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("tenantId={0}", System.Uri.EscapeDataString(tenantId))); } if (_queryParameters.Count > 0) { @@ -603,16 +680,15 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -622,10 +698,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -671,7 +743,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// Creates a role assignment. + /// Create a role assignment. /// /// /// The scope of the role assignment to create. The scope can be any REST @@ -694,7 +766,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -727,7 +799,17 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { parameters.Validate(); } - string apiVersion = "2020-04-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -738,7 +820,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) tracingParameters.Add("scope", scope); tracingParameters.Add("roleAssignmentName", roleAssignmentName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); } @@ -748,9 +829,9 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _url = _url.Replace("{scope}", scope); _url = _url.Replace("{roleAssignmentName}", System.Uri.EscapeDataString(roleAssignmentName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -818,14 +899,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 201) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -835,10 +915,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -892,13 +968,16 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// The name of the role assignment to get. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -913,7 +992,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string scope, string roleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string scope, string roleAssignmentName, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { @@ -923,7 +1002,17 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentName"); } - string apiVersion = "2020-04-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -933,7 +1022,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("scope", scope); tracingParameters.Add("roleAssignmentName", roleAssignmentName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("tenantId", tenantId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -943,9 +1032,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _url = _url.Replace("{scope}", scope); _url = _url.Replace("{roleAssignmentName}", System.Uri.EscapeDataString(roleAssignmentName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (tenantId != null) + { + _queryParameters.Add(string.Format("tenantId={0}", System.Uri.EscapeDataString(tenantId))); } if (_queryParameters.Count > 0) { @@ -1007,14 +1100,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1024,10 +1116,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1073,18 +1161,21 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// Deletes a role assignment. + /// Delete a role assignment. /// /// /// The ID of the role assignment to delete. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1099,13 +1190,23 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> DeleteByIdWithHttpMessagesAsync(string roleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> DeleteByIdWithHttpMessagesAsync(string roleId, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (roleId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "roleId"); } - string apiVersion = "2020-04-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1114,7 +1215,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("roleId", roleId); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("tenantId", tenantId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteById", tracingParameters); } @@ -1123,9 +1224,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{roleId}").ToString(); _url = _url.Replace("{roleId}", roleId); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (tenantId != null) + { + _queryParameters.Add(string.Format("tenantId={0}", System.Uri.EscapeDataString(tenantId))); } if (_queryParameters.Count > 0) { @@ -1185,16 +1290,15 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1204,10 +1308,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1267,7 +1367,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1296,7 +1396,17 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { parameters.Validate(); } - string apiVersion = "2020-04-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1306,7 +1416,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("roleId", roleId); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateById", tracingParameters); } @@ -1315,9 +1424,9 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{roleId}").ToString(); _url = _url.Replace("{roleId}", roleId); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1385,14 +1494,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 201) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1402,10 +1510,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1456,13 +1560,16 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// The ID of the role assignment to get. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1477,13 +1584,23 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByIdWithHttpMessagesAsync(string roleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByIdWithHttpMessagesAsync(string roleId, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (roleId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "roleId"); } - string apiVersion = "2020-04-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1492,7 +1609,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("roleId", roleId); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("tenantId", tenantId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetById", tracingParameters); } @@ -1501,9 +1618,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{roleId}").ToString(); _url = _url.Replace("{roleId}", roleId); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (tenantId != null) + { + _queryParameters.Add(string.Format("tenantId={0}", System.Uri.EscapeDataString(tenantId))); } if (_queryParameters.Count > 0) { @@ -1565,14 +1686,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1582,10 +1702,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1636,13 +1752,16 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// OData parameters to apply to the operation. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1657,13 +1776,30 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2020-04-01-preview"; + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1672,7 +1808,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("tenantId", tenantId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -1689,9 +1825,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (tenantId != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("tenantId={0}", System.Uri.EscapeDataString(tenantId))); } if (_queryParameters.Count > 0) { @@ -1753,14 +1893,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1770,10 +1909,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1827,13 +1962,16 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// OData parameters to apply to the operation. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1848,13 +1986,23 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListForScopeWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListForScopeWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { throw new ValidationException(ValidationRules.CannotBeNull, "scope"); } - string apiVersion = "2020-04-01-preview"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1864,7 +2012,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("scope", scope); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("tenantId", tenantId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListForScope", tracingParameters); } @@ -1881,9 +2029,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (tenantId != null) + { + _queryParameters.Add(string.Format("tenantId={0}", System.Uri.EscapeDataString(tenantId))); } if (_queryParameters.Count > 0) { @@ -1945,14 +2097,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1962,10 +2113,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -2011,7 +2158,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// Gets role assignments for a resource. + /// List role assignments for a resource. /// /// /// The NextLink from the previous successful call to List operation. @@ -2022,7 +2169,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2118,14 +2265,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2135,10 +2281,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -2184,7 +2326,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// Gets role assignments for a resource group. + /// List role assignments for a resource group. /// /// /// The NextLink from the previous successful call to List operation. @@ -2195,7 +2337,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2291,14 +2433,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2308,10 +2449,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -2368,7 +2505,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2464,14 +2601,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2481,10 +2617,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -2541,7 +2673,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2637,14 +2769,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2654,10 +2785,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperationsExtensions.cs index 9d72403474345..dd853de31b754 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperationsExtensions.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperationsExtensions.cs @@ -23,13 +23,13 @@ namespace Microsoft.Azure.Management.Authorization public static partial class RoleAssignmentsOperationsExtensions { /// - /// Gets role assignments for a resource. + /// List role assignments for a resource. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The namespace of the resource provider. @@ -46,19 +46,22 @@ public static partial class RoleAssignmentsOperationsExtensions /// /// OData parameters to apply to the operation. /// - public static IPage ListForResource(this IRoleAssignmentsOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery)) + /// + /// Tenant ID for cross-tenant request + /// + public static IPage ListForResource(this IRoleAssignmentsOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string)) { - return operations.ListForResourceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery).GetAwaiter().GetResult(); + return operations.ListForResourceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery, tenantId).GetAwaiter().GetResult(); } /// - /// Gets role assignments for a resource. + /// List role assignments for a resource. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The namespace of the resource provider. @@ -75,59 +78,68 @@ public static partial class RoleAssignmentsOperationsExtensions /// /// OData parameters to apply to the operation. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The cancellation token. /// - public static async Task> ListForResourceAsync(this IRoleAssignmentsOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListForResourceAsync(this IRoleAssignmentsOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListForResourceWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListForResourceWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets role assignments for a resource group. + /// List role assignments for a resource group. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// OData parameters to apply to the operation. /// - public static IPage ListForResourceGroup(this IRoleAssignmentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery)) + /// + /// Tenant ID for cross-tenant request + /// + public static IPage ListForResourceGroup(this IRoleAssignmentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string)) { - return operations.ListForResourceGroupAsync(resourceGroupName, odataQuery).GetAwaiter().GetResult(); + return operations.ListForResourceGroupAsync(resourceGroupName, odataQuery, tenantId).GetAwaiter().GetResult(); } /// - /// Gets role assignments for a resource group. + /// List role assignments for a resource group. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// OData parameters to apply to the operation. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The cancellation token. /// - public static async Task> ListForResourceGroupAsync(this IRoleAssignmentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListForResourceGroupAsync(this IRoleAssignmentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListForResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListForResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes a role assignment. + /// Delete a role assignment. /// /// /// The operations group for this extension method. @@ -138,13 +150,16 @@ public static partial class RoleAssignmentsOperationsExtensions /// /// The name of the role assignment to delete. /// - public static RoleAssignment Delete(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName) + /// + /// Tenant ID for cross-tenant request + /// + public static RoleAssignment Delete(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, string tenantId = default(string)) { - return operations.DeleteAsync(scope, roleAssignmentName).GetAwaiter().GetResult(); + return operations.DeleteAsync(scope, roleAssignmentName, tenantId).GetAwaiter().GetResult(); } /// - /// Deletes a role assignment. + /// Delete a role assignment. /// /// /// The operations group for this extension method. @@ -155,19 +170,22 @@ public static RoleAssignment Delete(this IRoleAssignmentsOperations operations, /// /// The name of the role assignment to delete. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, string tenantId = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.DeleteWithHttpMessagesAsync(scope, roleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.DeleteWithHttpMessagesAsync(scope, roleAssignmentName, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Creates a role assignment. + /// Create a role assignment. /// /// /// The operations group for this extension method. @@ -193,7 +211,7 @@ public static RoleAssignment Create(this IRoleAssignmentsOperations operations, } /// - /// Creates a role assignment. + /// Create a role assignment. /// /// /// The operations group for this extension method. @@ -236,9 +254,12 @@ public static RoleAssignment Create(this IRoleAssignmentsOperations operations, /// /// The name of the role assignment to get. /// - public static RoleAssignment Get(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName) + /// + /// Tenant ID for cross-tenant request + /// + public static RoleAssignment Get(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, string tenantId = default(string)) { - return operations.GetAsync(scope, roleAssignmentName).GetAwaiter().GetResult(); + return operations.GetAsync(scope, roleAssignmentName, tenantId).GetAwaiter().GetResult(); } /// @@ -253,19 +274,22 @@ public static RoleAssignment Get(this IRoleAssignmentsOperations operations, str /// /// The name of the role assignment to get. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The cancellation token. /// - public static async Task GetAsync(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, string tenantId = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(scope, roleAssignmentName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(scope, roleAssignmentName, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Deletes a role assignment. + /// Delete a role assignment. /// /// /// The operations group for this extension method. @@ -273,13 +297,16 @@ public static RoleAssignment Get(this IRoleAssignmentsOperations operations, str /// /// The ID of the role assignment to delete. /// - public static RoleAssignment DeleteById(this IRoleAssignmentsOperations operations, string roleId) + /// + /// Tenant ID for cross-tenant request + /// + public static RoleAssignment DeleteById(this IRoleAssignmentsOperations operations, string roleId, string tenantId = default(string)) { - return operations.DeleteByIdAsync(roleId).GetAwaiter().GetResult(); + return operations.DeleteByIdAsync(roleId, tenantId).GetAwaiter().GetResult(); } /// - /// Deletes a role assignment. + /// Delete a role assignment. /// /// /// The operations group for this extension method. @@ -287,12 +314,15 @@ public static RoleAssignment DeleteById(this IRoleAssignmentsOperations operatio /// /// The ID of the role assignment to delete. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The cancellation token. /// - public static async Task DeleteByIdAsync(this IRoleAssignmentsOperations operations, string roleId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteByIdAsync(this IRoleAssignmentsOperations operations, string roleId, string tenantId = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.DeleteByIdWithHttpMessagesAsync(roleId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.DeleteByIdWithHttpMessagesAsync(roleId, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -347,9 +377,12 @@ public static RoleAssignment CreateById(this IRoleAssignmentsOperations operatio /// /// The ID of the role assignment to get. /// - public static RoleAssignment GetById(this IRoleAssignmentsOperations operations, string roleId) + /// + /// Tenant ID for cross-tenant request + /// + public static RoleAssignment GetById(this IRoleAssignmentsOperations operations, string roleId, string tenantId = default(string)) { - return operations.GetByIdAsync(roleId).GetAwaiter().GetResult(); + return operations.GetByIdAsync(roleId, tenantId).GetAwaiter().GetResult(); } /// @@ -361,12 +394,15 @@ public static RoleAssignment GetById(this IRoleAssignmentsOperations operations, /// /// The ID of the role assignment to get. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The cancellation token. /// - public static async Task GetByIdAsync(this IRoleAssignmentsOperations operations, string roleId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetByIdAsync(this IRoleAssignmentsOperations operations, string roleId, string tenantId = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetByIdWithHttpMessagesAsync(roleId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetByIdWithHttpMessagesAsync(roleId, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -381,9 +417,12 @@ public static RoleAssignment GetById(this IRoleAssignmentsOperations operations, /// /// OData parameters to apply to the operation. /// - public static IPage List(this IRoleAssignmentsOperations operations, ODataQuery odataQuery = default(ODataQuery)) + /// + /// Tenant ID for cross-tenant request + /// + public static IPage List(this IRoleAssignmentsOperations operations, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string)) { - return operations.ListAsync(odataQuery).GetAwaiter().GetResult(); + return operations.ListAsync(odataQuery, tenantId).GetAwaiter().GetResult(); } /// @@ -395,12 +434,15 @@ public static RoleAssignment GetById(this IRoleAssignmentsOperations operations, /// /// OData parameters to apply to the operation. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The cancellation token. /// - public static async Task> ListAsync(this IRoleAssignmentsOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IRoleAssignmentsOperations operations, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -418,9 +460,12 @@ public static RoleAssignment GetById(this IRoleAssignmentsOperations operations, /// /// OData parameters to apply to the operation. /// - public static IPage ListForScope(this IRoleAssignmentsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery)) + /// + /// Tenant ID for cross-tenant request + /// + public static IPage ListForScope(this IRoleAssignmentsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string)) { - return operations.ListForScopeAsync(scope, odataQuery).GetAwaiter().GetResult(); + return operations.ListForScopeAsync(scope, odataQuery, tenantId).GetAwaiter().GetResult(); } /// @@ -435,19 +480,22 @@ public static RoleAssignment GetById(this IRoleAssignmentsOperations operations, /// /// OData parameters to apply to the operation. /// + /// + /// Tenant ID for cross-tenant request + /// /// /// The cancellation token. /// - public static async Task> ListForScopeAsync(this IRoleAssignmentsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListForScopeAsync(this IRoleAssignmentsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListForScopeWithHttpMessagesAsync(scope, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListForScopeWithHttpMessagesAsync(scope, odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets role assignments for a resource. + /// List role assignments for a resource. /// /// /// The operations group for this extension method. @@ -461,7 +509,7 @@ public static IPage ListForResourceNext(this IRoleAssignmentsOpe } /// - /// Gets role assignments for a resource. + /// List role assignments for a resource. /// /// /// The operations group for this extension method. @@ -481,7 +529,7 @@ public static IPage ListForResourceNext(this IRoleAssignmentsOpe } /// - /// Gets role assignments for a resource group. + /// List role assignments for a resource group. /// /// /// The operations group for this extension method. @@ -495,7 +543,7 @@ public static IPage ListForResourceGroupNext(this IRoleAssignmen } /// - /// Gets role assignments for a resource group. + /// List role assignments for a resource group. /// /// /// The operations group for this extension method. diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleDefinitionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleDefinitionsOperations.cs deleted file mode 100644 index e7e837f4f7e6e..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleDefinitionsOperations.cs +++ /dev/null @@ -1,1185 +0,0 @@ -// -// 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.Authorization -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; - 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; - - /// - /// RoleDefinitionsOperations operations. - /// - internal partial class RoleDefinitionsOperations : IServiceOperations, IRoleDefinitionsOperations - { - /// - /// Initializes a new instance of the RoleDefinitionsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal RoleDefinitionsOperations(AuthorizationManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the AuthorizationManagementClient - /// - public AuthorizationManagementClient Client { get; private set; } - - /// - /// Deletes a role definition. - /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition to delete. - /// - /// - /// 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> DeleteWithHttpMessagesAsync(string scope, string roleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - if (roleDefinitionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "roleDefinitionId"); - } - string apiVersion = "2018-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("scope", scope); - tracingParameters.Add("roleDefinitionId", roleDefinitionId); - tracingParameters.Add("apiVersion", apiVersion); - 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}").ToString(); - _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{roleDefinitionId}", System.Uri.EscapeDataString(roleDefinitionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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; - } - - /// - /// Get role definition by name (GUID). - /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition. - /// - /// - /// 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 scope, string roleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - if (roleDefinitionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "roleDefinitionId"); - } - string apiVersion = "2018-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("scope", scope); - tracingParameters.Add("roleDefinitionId", roleDefinitionId); - tracingParameters.Add("apiVersion", apiVersion); - 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}").ToString(); - _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{roleDefinitionId}", System.Uri.EscapeDataString(roleDefinitionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 a role definition. - /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition. - /// - /// - /// The values for the role definition. - /// - /// - /// 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 scope, string roleDefinitionId, RoleDefinition roleDefinition, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - if (roleDefinitionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "roleDefinitionId"); - } - if (roleDefinition == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "roleDefinition"); - } - string apiVersion = "2018-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("scope", scope); - tracingParameters.Add("roleDefinitionId", roleDefinitionId); - tracingParameters.Add("roleDefinition", roleDefinition); - tracingParameters.Add("apiVersion", apiVersion); - 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}").ToString(); - _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{roleDefinitionId}", System.Uri.EscapeDataString(roleDefinitionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(roleDefinition != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(roleDefinition, 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 != 201) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 == 201) - { - _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; - } - - /// - /// Get all role definitions that are applicable at scope and above. - /// - /// - /// The scope of the role definition. - /// - /// - /// OData parameters to apply to the 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>> ListWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - string apiVersion = "2018-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("scope", scope); - tracingParameters.Add("apiVersion", apiVersion); - 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleDefinitions").ToString(); - _url = _url.Replace("{scope}", scope); - List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _queryParameters.Add(_odataFilter); - } - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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 a role definition by ID. - /// - /// - /// The fully qualified role definition ID. Use the format, - /// /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} - /// for subscription level role definitions, or - /// /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for - /// tenant level role definitions. - /// - /// - /// 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> GetByIdWithHttpMessagesAsync(string roleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (roleId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "roleId"); - } - string apiVersion = "2018-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("roleId", roleId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetById", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{roleId}").ToString(); - _url = _url.Replace("{roleId}", roleId); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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; - } - - /// - /// Get all role definitions that are applicable at scope and above. - /// - /// - /// 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>> ListNextWithHttpMessagesAsync(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, "ListNext", 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - 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/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleDefinitionsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleDefinitionsOperationsExtensions.cs deleted file mode 100644 index bdd04376a40a9..0000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleDefinitionsOperationsExtensions.cs +++ /dev/null @@ -1,268 +0,0 @@ -// -// 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.Authorization -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for RoleDefinitionsOperations. - /// - public static partial class RoleDefinitionsOperationsExtensions - { - /// - /// Deletes a role definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition to delete. - /// - public static RoleDefinition Delete(this IRoleDefinitionsOperations operations, string scope, string roleDefinitionId) - { - return operations.DeleteAsync(scope, roleDefinitionId).GetAwaiter().GetResult(); - } - - /// - /// Deletes a role definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition to delete. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IRoleDefinitionsOperations operations, string scope, string roleDefinitionId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.DeleteWithHttpMessagesAsync(scope, roleDefinitionId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get role definition by name (GUID). - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition. - /// - public static RoleDefinition Get(this IRoleDefinitionsOperations operations, string scope, string roleDefinitionId) - { - return operations.GetAsync(scope, roleDefinitionId).GetAwaiter().GetResult(); - } - - /// - /// Get role definition by name (GUID). - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IRoleDefinitionsOperations operations, string scope, string roleDefinitionId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(scope, roleDefinitionId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates a role definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition. - /// - /// - /// The values for the role definition. - /// - public static RoleDefinition CreateOrUpdate(this IRoleDefinitionsOperations operations, string scope, string roleDefinitionId, RoleDefinition roleDefinition) - { - return operations.CreateOrUpdateAsync(scope, roleDefinitionId, roleDefinition).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates a role definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition. - /// - /// - /// The values for the role definition. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IRoleDefinitionsOperations operations, string scope, string roleDefinitionId, RoleDefinition roleDefinition, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, roleDefinitionId, roleDefinition, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get all role definitions that are applicable at scope and above. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope of the role definition. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IPage List(this IRoleDefinitionsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListAsync(scope, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// Get all role definitions that are applicable at scope and above. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope of the role definition. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IRoleDefinitionsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(scope, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a role definition by ID. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The fully qualified role definition ID. Use the format, - /// /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} - /// for subscription level role definitions, or - /// /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for - /// tenant level role definitions. - /// - public static RoleDefinition GetById(this IRoleDefinitionsOperations operations, string roleId) - { - return operations.GetByIdAsync(roleId).GetAwaiter().GetResult(); - } - - /// - /// Gets a role definition by ID. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The fully qualified role definition ID. Use the format, - /// /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} - /// for subscription level role definitions, or - /// /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for - /// tenant level role definitions. - /// - /// - /// The cancellation token. - /// - public static async Task GetByIdAsync(this IRoleDefinitionsOperations operations, string roleId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetByIdWithHttpMessagesAsync(roleId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get all role definitions that are applicable at scope and above. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IRoleDefinitionsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Get all role definitions that are applicable at scope and above. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListNextAsync(this IRoleDefinitionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/SdkInfo_AuthorizationManagementClient.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/SdkInfo_AuthorizationManagementClient.cs index 3e08e4b08e2f3..bfe72965a444b 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/SdkInfo_AuthorizationManagementClient.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/SdkInfo_AuthorizationManagementClient.cs @@ -19,15 +19,8 @@ public static IEnumerable> ApiInfo_AuthorizationMa { return new Tuple[] { - new Tuple("Authorization", "ClassicAdministrators", "2015-06-01"), - new Tuple("Authorization", "DenyAssignments", "2018-07-01-preview"), - new Tuple("Authorization", "Permissions", "2018-01-01-preview"), - new Tuple("Authorization", "ProviderOperationsMetadata", "2018-01-01-preview"), - new Tuple("Authorization", "RoleAssignments", "2018-09-01-preview"), - new Tuple("Authorization", "RoleDefinitions", "2018-01-01-preview"), - new Tuple("AuthorizationManagementClient", "DenyAssignments", "2018-07-01-preview"), - new Tuple("AuthorizationManagementClient", "RoleAssignments", "2018-09-01-preview"), - new Tuple("AuthorizationManagementClient", "RoleDefinitions", "2018-01-01-preview"), + new Tuple("Authorization", "RoleAssignments", "2020-04-01-preview"), + new Tuple("AuthorizationManagementClient", "RoleAssignments", "2020-04-01-preview"), }.AsEnumerable(); } }