From a92bead8095fd151d7fe7e07bbcf8526b1019f9b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 29 Jul 2021 03:49:23 +0000 Subject: [PATCH] CodeGen from PR 14560 in Azure/azure-rest-api-specs Merge 585055674324f39b8cfabeb9bec58c5130705227 into 444d527ca9ba163e65ad4ce9fc888a6f69940a4c --- .../AuthorizationManagementClient.cs | 54 +- .../ClassicAdministratorsOperations.cs | 402 ---- ...assicAdministratorsOperationsExtensions.cs | 91 - .../Generated/DenyAssignmentsOperations.cs | 1923 ----------------- .../DenyAssignmentsOperationsExtensions.cs | 422 ---- .../GlobalAdministratorOperations.cs | 193 -- ...GlobalAdministratorOperationsExtensions.cs | 50 - .../IAuthorizationManagementClient.cs | 44 +- .../IClassicAdministratorsOperations.cs | 70 - .../Generated/IDenyAssignmentsOperations.cs | 277 --- .../IGlobalAdministratorOperations.cs | 43 - .../src/Generated/IPermissionsOperations.cs | 127 -- .../IProviderOperationsMetadataOperations.cs | 97 - .../IRoleAssignmentMetricsOperations.cs | 46 - .../Generated/IRoleAssignmentsOperations.cs | 220 +- .../Generated/IRoleDefinitionsOperations.cs | 179 -- .../Generated/Models/ClassicAdministrator.cs | 87 - .../src/Generated/Models/DenyAssignment.cs | 149 -- .../Generated/Models/DenyAssignmentFilter.cs | 75 - .../Models/DenyAssignmentPermission.cs | 85 - .../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 | 55 +- .../Models/RoleAssignmentCreateParameters.cs | 67 +- .../Generated/Models/RoleAssignmentFilter.cs | 11 +- .../Models/RoleAssignmentMetricsResult.cs | 80 - .../src/Generated/Models/RoleDefinition.cs | 113 - .../Generated/Models/RoleDefinitionFilter.cs | 61 - .../Generated/Models/ValidationResponse.cs | 59 - .../Models/ValidationResponseErrorInfo.cs | 63 - .../src/Generated/PermissionsOperations.cs | 822 ------- .../PermissionsOperationsExtensions.cs | 185 -- .../ProviderOperationsMetadataOperations.cs | 573 ----- ...rOperationsMetadataOperationsExtensions.cs | 133 -- .../RoleAssignmentMetricsOperations.cs | 232 -- ...leAssignmentMetricsOperationsExtensions.cs | 53 - .../Generated/RoleAssignmentsOperations.cs | 1043 +++------ .../RoleAssignmentsOperationsExtensions.cs | 450 ++-- .../Generated/RoleDefinitionsOperations.cs | 1155 ---------- .../RoleDefinitionsOperationsExtensions.cs | 268 --- .../SdkInfo_AuthorizationManagementClient.cs | 24 +- 44 files changed, 637 insertions(+), 9850 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/IRoleAssignmentMetricsOperations.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 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/RoleAssignmentMetricsResult.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/Models/RoleDefinitionFilter.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ValidationResponse.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ValidationResponseErrorInfo.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/RoleAssignmentMetricsOperations.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentMetricsOperationsExtensions.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 b01a18622e16..ec6455141778 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,41 +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 IRoleAssignmentMetricsOperations. - /// - public virtual IRoleAssignmentMetricsOperations RoleAssignmentMetrics { get; private set; } - /// /// Gets the IRoleAssignmentsOperations. /// @@ -347,15 +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); - RoleAssignmentMetrics = new RoleAssignmentMetricsOperations(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 dda58ecb8687..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperations.cs +++ /dev/null @@ -1,402 +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"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/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 96543f2d5cef..000000000000 --- 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 2cc481b0414b..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/DenyAssignmentsOperations.cs +++ /dev/null @@ -1,1923 +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 name is case insensitive. - /// - /// - /// 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 (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - 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"); - } - 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}", 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets deny assignments for a resource group. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// 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 (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - 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); - } - } - 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets 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"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/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 87f9ce71d5d7..000000000000 --- 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 name is case insensitive. - /// - /// - /// 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 name is case insensitive. - /// - /// - /// 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. The name is case insensitive. - /// - /// - /// 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. The name is case insensitive. - /// - /// - /// 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 ab3d899cb96f..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/GlobalAdministratorOperations.cs +++ /dev/null @@ -1,193 +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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/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 8dc535c1f0cf..000000000000 --- 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 8c63d3dac7c2..6d23d6d0aca3 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,41 +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 IRoleAssignmentMetricsOperations. - /// - IRoleAssignmentMetricsOperations RoleAssignmentMetrics { 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 11e82ae50a1f..000000000000 --- 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 98f6f5cbf6f4..000000000000 --- 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 name is case insensitive. - /// - /// - /// 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. The name is case insensitive. - /// - /// - /// 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 bb7f32cc95d3..000000000000 --- 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 aecc8912990f..000000000000 --- 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 name is case insensitive. - /// - /// - /// 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 name is case insensitive. - /// - /// - /// 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 30e22c3f7d81..000000000000 --- 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/IRoleAssignmentMetricsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentMetricsOperations.cs deleted file mode 100644 index 2ea3b894e4a6..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentMetricsOperations.cs +++ /dev/null @@ -1,46 +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; - - /// - /// RoleAssignmentMetricsOperations operations. - /// - public partial interface IRoleAssignmentMetricsOperations - { - /// - /// Get role assignment usage metrics for a 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> GetMetricsForSubscriptionWithHttpMessagesAsync(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 4e479bf0825e..37d32fb8c6d4 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentsOperations.cs @@ -25,35 +25,22 @@ namespace Microsoft.Azure.Management.Authorization public partial interface IRoleAssignmentsOperations { /// - /// List all role assignments that apply to a subscription. + /// List role assignments for a resource. /// - /// - /// OData parameters to apply to the operation. + /// + /// The name of the resource group. The name is case insensitive. /// - /// - /// Tenant ID for cross-tenant request + /// + /// The namespace of the resource provider. /// - /// - /// The headers that will be added to request. + /// + /// The parent resource identity. /// - /// - /// The cancellation token. + /// + /// The resource type of the resource. /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListForSubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List all role assignments that apply to a resource group. - /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The name of the resource to get role assignments for. /// /// /// OData parameters to apply to the operation. @@ -76,23 +63,13 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), 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)); /// - /// List all role assignments that apply to a resource. + /// List role assignments for a resource group. /// /// /// The name of the resource group. The name is case insensitive. /// - /// - /// The namespace of the resource provider. - /// - /// - /// The resource type name. For example the type name of a web app is - /// 'sites' (from Microsoft.Web/sites). - /// - /// - /// The resource name. - /// /// /// OData parameters to apply to the operation. /// @@ -114,20 +91,15 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), 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)); /// - /// Get a role assignment by scope and name. + /// Delete a role assignment. /// /// - /// The scope of the operation or resource. Valid scopes are: - /// subscription (format: '/subscriptions/{subscriptionId}'), resource - /// group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - /// or resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + /// The scope of the role assignment to delete. /// /// - /// The name of the role assignment. It can be any valid GUID. + /// The name of the role assignment to delete. /// /// /// Tenant ID for cross-tenant request @@ -147,20 +119,22 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string scope, string roleAssignmentName, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> DeleteWithHttpMessagesAsync(string scope, string roleAssignmentName, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Create or update a role assignment by scope and name. + /// Create a role assignment. /// /// - /// The scope of the operation or resource. Valid scopes are: - /// subscription (format: '/subscriptions/{subscriptionId}'), resource - /// group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - /// or resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + /// The scope of the role assignment to create. The scope can be any + /// REST resource instance. For example, use + /// '/subscriptions/{subscription-id}/' for a subscription, + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' + /// for a resource group, and + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + /// for a resource. /// /// - /// The name of the role assignment. It can be any valid GUID. + /// The name of the role assignment to create. It can be any valid + /// GUID. /// /// /// Parameters for the role assignment. @@ -182,18 +156,13 @@ public partial interface IRoleAssignmentsOperations /// Task> CreateWithHttpMessagesAsync(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete a role assignment by scope and name. + /// Get the specified role assignment. /// /// - /// The scope of the operation or resource. Valid scopes are: - /// subscription (format: '/subscriptions/{subscriptionId}'), resource - /// group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - /// or resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + /// The scope of the role assignment. /// /// - /// The name of the role assignment. It can be any valid GUID. + /// The name of the role assignment to get. /// /// /// Tenant ID for cross-tenant request @@ -213,54 +182,12 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> DeleteWithHttpMessagesAsync(string scope, string roleAssignmentName, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Validate a role assignment create or update operation by scope and - /// name. - /// - /// - /// The scope of the operation or resource. Valid scopes are: - /// subscription (format: '/subscriptions/{subscriptionId}'), resource - /// group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - /// or resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - /// - /// - /// The name of the role assignment. It can be any valid GUID. - /// - /// - /// Parameters for the role assignment. - /// - /// - /// 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> ValidateWithHttpMessagesAsync(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string scope, string roleAssignmentName, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// List all role assignments that apply to a scope. + /// Delete a role assignment. /// - /// - /// The scope of the operation or resource. Valid scopes are: - /// subscription (format: '/subscriptions/{subscriptionId}'), resource - /// group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - /// or resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - /// - /// - /// OData parameters to apply to the operation. + /// + /// The ID of the role assignment to delete. /// /// /// Tenant ID for cross-tenant request @@ -280,19 +207,15 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListForScopeWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> DeleteByIdWithHttpMessagesAsync(string roleId, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get a role assignment by ID. + /// Creates a role assignment by ID. /// - /// - /// The fully qualified ID of the role assignment including scope, - /// resource name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// The ID of the role assignment to create. /// - /// - /// Tenant ID for cross-tenant request + /// + /// Parameters for the role assignment. /// /// /// The headers that will be added to request. @@ -309,19 +232,15 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> GetByIdWithHttpMessagesAsync(string roleAssignmentId, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateByIdWithHttpMessagesAsync(string roleId, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Create or update a role assignment by ID. + /// Gets a role assignment by ID. /// - /// - /// The fully qualified ID of the role assignment including scope, - /// resource name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// The ID of the role assignment to get. /// - /// - /// Parameters for the role assignment. + /// + /// Tenant ID for cross-tenant request /// /// /// The headers that will be added to request. @@ -338,16 +257,12 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> CreateByIdWithHttpMessagesAsync(string roleAssignmentId, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByIdWithHttpMessagesAsync(string roleId, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete a role assignment by ID. + /// Gets all role assignments for the subscription. /// - /// - /// The fully qualified ID of the role assignment including scope, - /// resource name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// OData parameters to apply to the operation. /// /// /// Tenant ID for cross-tenant request @@ -367,19 +282,18 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> DeleteByIdWithHttpMessagesAsync(string roleAssignmentId, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Validate a role assignment create or update operation by ID. + /// Gets role assignments for a scope. /// - /// - /// The fully qualified ID of the role assignment including scope, - /// resource name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// The scope of the role assignments. /// - /// - /// Parameters for the role assignment. + /// + /// OData parameters to apply to the operation. + /// + /// + /// Tenant ID for cross-tenant request /// /// /// The headers that will be added to request. @@ -396,9 +310,9 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> ValidateByIdWithHttpMessagesAsync(string roleAssignmentId, RoleAssignmentCreateParameters parameters, 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)); /// - /// List all role assignments that apply to a subscription. + /// List role assignments for a resource. /// /// /// The NextLink from the previous successful call to List operation. @@ -418,9 +332,9 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListForSubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListForResourceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// List all role assignments that apply to a resource group. + /// List role assignments for a resource group. /// /// /// The NextLink from the previous successful call to List operation. @@ -442,7 +356,7 @@ public partial interface IRoleAssignmentsOperations /// Task>> ListForResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// List all role assignments that apply to a resource. + /// Gets all role assignments for the subscription. /// /// /// The NextLink from the previous successful call to List operation. @@ -462,9 +376,9 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListForResourceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// List all role assignments that apply to a scope. + /// Gets role assignments for a scope. /// /// /// The NextLink from the previous successful call to List operation. 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 f80bcbddb181..000000000000 --- 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 b8d9b301b3f0..000000000000 --- 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 8ffb4af3444b..000000000000 --- 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 22660277fc27..000000000000 --- 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 3690b9b956fc..000000000000 --- 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/Permission.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Permission.cs deleted file mode 100644 index c9025e26f9c0..000000000000 --- 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 8eb0229796e0..000000000000 --- 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 69f80c52c4e1..000000000000 --- 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 47cf2dff941b..000000000000 --- 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 a57f0cae6cdd..000000000000 --- 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 057818fd2851..e069fb7f7eda 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 @@ -11,7 +11,6 @@ namespace Microsoft.Azure.Management.Authorization.Models { using Microsoft.Rest; - using Microsoft.Rest.Azure; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Linq; @@ -20,7 +19,7 @@ namespace Microsoft.Azure.Management.Authorization.Models /// Role Assignments /// [Rest.Serialization.JsonTransformation] - public partial class RoleAssignment : IResource + public partial class RoleAssignment { /// /// Initializes a new instance of the RoleAssignment class. @@ -33,17 +32,19 @@ public RoleAssignment() /// /// Initializes a new instance of the RoleAssignment class. /// - /// The role definition ID. - /// The principal ID. /// The role assignment ID. /// The role assignment name. /// The role assignment type. /// The role assignment scope. + /// The role definition ID. + /// The principal ID. /// The principal type of the assigned /// principal ID. Possible values include: 'User', 'Group', /// 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', /// 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', /// 'Everyone' + /// The Delegation flag for the role + /// assignment /// Description of role assignment /// The conditions on the role assignment. This /// limits the resources it can be assigned to. e.g.: @@ -59,7 +60,7 @@ public RoleAssignment() /// assignment /// Id of the /// delegated managed identity resource - public RoleAssignment(string roleDefinitionId, string principalId, string id = default(string), string name = default(string), string type = default(string), string scope = default(string), string principalType = default(string), 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)) + 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; @@ -68,6 +69,7 @@ public RoleAssignment() RoleDefinitionId = roleDefinitionId; PrincipalId = principalId; PrincipalType = principalType; + CanDelegate = canDelegate; Description = description; Condition = condition; ConditionVersion = conditionVersion; @@ -103,10 +105,10 @@ public RoleAssignment() public string Type { get; private set; } /// - /// Gets the role assignment scope. + /// Gets or sets the role assignment scope. /// [JsonProperty(PropertyName = "properties.scope")] - public string Scope { get; private set; } + public string Scope { get; set; } /// /// Gets or sets the role definition ID. @@ -129,6 +131,12 @@ public RoleAssignment() [JsonProperty(PropertyName = "properties.principalType")] public string PrincipalType { get; set; } + /// + /// Gets or sets the Delegation flag for the role assignment + /// + [JsonProperty(PropertyName = "properties.canDelegate")] + public bool? CanDelegate { get; set; } + /// /// Gets or sets description of role assignment /// @@ -152,28 +160,28 @@ public RoleAssignment() public string ConditionVersion { get; set; } /// - /// Gets time it was created + /// Gets or sets time it was created /// [JsonProperty(PropertyName = "properties.createdOn")] - public System.DateTime? CreatedOn { get; private set; } + public System.DateTime? CreatedOn { get; set; } /// - /// Gets time it was updated + /// Gets or sets time it was updated /// [JsonProperty(PropertyName = "properties.updatedOn")] - public System.DateTime? UpdatedOn { get; private set; } + public System.DateTime? UpdatedOn { get; set; } /// - /// Gets id of the user who created the assignment + /// Gets or sets id of the user who created the assignment /// [JsonProperty(PropertyName = "properties.createdBy")] - public string CreatedBy { get; private set; } + public string CreatedBy { get; set; } /// - /// Gets id of the user who updated the assignment + /// Gets or sets id of the user who updated the assignment /// [JsonProperty(PropertyName = "properties.updatedBy")] - public string UpdatedBy { get; private set; } + public string UpdatedBy { get; set; } /// /// Gets or sets id of the delegated managed identity resource @@ -181,22 +189,5 @@ public RoleAssignment() [JsonProperty(PropertyName = "properties.delegatedManagedIdentityResourceId")] public string DelegatedManagedIdentityResourceId { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (RoleDefinitionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "RoleDefinitionId"); - } - if (PrincipalId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PrincipalId"); - } - } } } 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 61d6d8f5cb3e..76e69633d9fb 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 @@ -34,14 +34,18 @@ public RoleAssignmentCreateParameters() /// Initializes a new instance of the RoleAssignmentCreateParameters /// class. /// - /// The role definition ID. - /// The principal ID. - /// The role assignment scope. + /// The role definition ID used in the + /// role assignment. + /// The principal ID assigned to the role. + /// This maps to the ID inside the Active Directory. It can point to a + /// user, service principal, or security group. /// The principal type of the assigned /// principal ID. Possible values include: 'User', 'Group', /// 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', /// 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', /// 'Everyone' + /// The delegation flag used for creating a + /// role assignment /// Description of role assignment /// The conditions on the role assignment. This /// limits the resources it can be assigned to. e.g.: @@ -49,27 +53,17 @@ public RoleAssignmentCreateParameters() /// 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 - /// Id of the user who updated the - /// assignment /// Id of the /// delegated managed identity resource - public RoleAssignmentCreateParameters(string roleDefinitionId, string principalId, string scope = default(string), string principalType = default(string), 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)) + 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)) { - Scope = scope; RoleDefinitionId = roleDefinitionId; PrincipalId = principalId; PrincipalType = principalType; + CanDelegate = canDelegate; Description = description; Condition = condition; ConditionVersion = conditionVersion; - CreatedOn = createdOn; - UpdatedOn = updatedOn; - CreatedBy = createdBy; - UpdatedBy = updatedBy; DelegatedManagedIdentityResourceId = delegatedManagedIdentityResourceId; CustomInit(); } @@ -80,19 +74,15 @@ public RoleAssignmentCreateParameters() partial void CustomInit(); /// - /// Gets the role assignment scope. - /// - [JsonProperty(PropertyName = "properties.scope")] - public string Scope { get; private set; } - - /// - /// Gets or sets the role definition ID. + /// Gets or sets the role definition ID used in the role assignment. /// [JsonProperty(PropertyName = "properties.roleDefinitionId")] public string RoleDefinitionId { get; set; } /// - /// Gets or sets the principal ID. + /// Gets or sets the principal ID assigned to the role. This maps to + /// the ID inside the Active Directory. It can point to a user, service + /// principal, or security group. /// [JsonProperty(PropertyName = "properties.principalId")] public string PrincipalId { get; set; } @@ -106,6 +96,13 @@ public RoleAssignmentCreateParameters() [JsonProperty(PropertyName = "properties.principalType")] public string PrincipalType { get; set; } + /// + /// Gets or sets the delegation flag used for creating a role + /// assignment + /// + [JsonProperty(PropertyName = "properties.canDelegate")] + public bool? CanDelegate { get; set; } + /// /// Gets or sets description of role assignment /// @@ -128,30 +125,6 @@ public RoleAssignmentCreateParameters() [JsonProperty(PropertyName = "properties.conditionVersion")] public string ConditionVersion { get; set; } - /// - /// Gets time it was created - /// - [JsonProperty(PropertyName = "properties.createdOn")] - public System.DateTime? CreatedOn { get; private set; } - - /// - /// Gets time it was updated - /// - [JsonProperty(PropertyName = "properties.updatedOn")] - public System.DateTime? UpdatedOn { get; private set; } - - /// - /// Gets id of the user who created the assignment - /// - [JsonProperty(PropertyName = "properties.createdBy")] - public string CreatedBy { get; private set; } - - /// - /// Gets id of the user who updated the assignment - /// - [JsonProperty(PropertyName = "properties.updatedBy")] - public string UpdatedBy { get; private set; } - /// /// Gets or sets id of the delegated managed identity resource /// diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentFilter.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentFilter.cs index 2fabe7f357c8..cc588def72cd 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentFilter.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentFilter.cs @@ -31,9 +31,12 @@ public RoleAssignmentFilter() /// /// Returns role assignment of the specific /// principal. - public RoleAssignmentFilter(string principalId = default(string)) + /// The Delegation flag for the role + /// assignment + public RoleAssignmentFilter(string principalId = default(string), bool? canDelegate = default(bool?)) { PrincipalId = principalId; + CanDelegate = canDelegate; CustomInit(); } @@ -48,5 +51,11 @@ public RoleAssignmentFilter() [JsonProperty(PropertyName = "principalId")] public string PrincipalId { get; set; } + /// + /// Gets or sets the Delegation flag for the role assignment + /// + [JsonProperty(PropertyName = "canDelegate")] + public bool? CanDelegate { get; set; } + } } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentMetricsResult.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentMetricsResult.cs deleted file mode 100644 index 4a2a8ca80a03..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentMetricsResult.cs +++ /dev/null @@ -1,80 +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; - - /// - /// Role Assignment Metrics - /// - public partial class RoleAssignmentMetricsResult - { - /// - /// Initializes a new instance of the RoleAssignmentMetricsResult - /// class. - /// - public RoleAssignmentMetricsResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RoleAssignmentMetricsResult - /// class. - /// - /// The subscription ID. - /// The role assignment - /// limit. - /// The number of current - /// role assignments. - /// The number of remaining - /// role assignments available. - public RoleAssignmentMetricsResult(string subscriptionId = default(string), long? roleAssignmentsLimit = default(long?), long? roleAssignmentsCurrentCount = default(long?), long? roleAssignmentsRemainingCount = default(long?)) - { - SubscriptionId = subscriptionId; - RoleAssignmentsLimit = roleAssignmentsLimit; - RoleAssignmentsCurrentCount = roleAssignmentsCurrentCount; - RoleAssignmentsRemainingCount = roleAssignmentsRemainingCount; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the subscription ID. - /// - [JsonProperty(PropertyName = "subscriptionId")] - public string SubscriptionId { get; private set; } - - /// - /// Gets the role assignment limit. - /// - [JsonProperty(PropertyName = "roleAssignmentsLimit")] - public long? RoleAssignmentsLimit { get; private set; } - - /// - /// Gets the number of current role assignments. - /// - [JsonProperty(PropertyName = "roleAssignmentsCurrentCount")] - public long? RoleAssignmentsCurrentCount { get; private set; } - - /// - /// Gets the number of remaining role assignments available. - /// - [JsonProperty(PropertyName = "roleAssignmentsRemainingCount")] - public long? RoleAssignmentsRemainingCount { get; private set; } - - } -} 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 8ecb291682b2..000000000000 --- 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/Models/RoleDefinitionFilter.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleDefinitionFilter.cs deleted file mode 100644 index daabb45b9de1..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleDefinitionFilter.cs +++ /dev/null @@ -1,61 +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; - - /// - /// Role Definitions filter - /// - public partial class RoleDefinitionFilter - { - /// - /// Initializes a new instance of the RoleDefinitionFilter class. - /// - public RoleDefinitionFilter() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RoleDefinitionFilter 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)) - { - RoleName = roleName; - Type = type; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets returns role definition with the specific name. - /// - [JsonProperty(PropertyName = "roleName")] - public string RoleName { get; set; } - - /// - /// Gets or sets returns role definition with the specific type. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ValidationResponse.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ValidationResponse.cs deleted file mode 100644 index 427a18f45d11..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ValidationResponse.cs +++ /dev/null @@ -1,59 +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; - - /// - /// Validation response - /// - public partial class ValidationResponse - { - /// - /// Initializes a new instance of the ValidationResponse class. - /// - public ValidationResponse() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ValidationResponse class. - /// - /// Whether or not validation succeeded - /// Failed validation result details - public ValidationResponse(bool? isValid = default(bool?), ValidationResponseErrorInfo errorInfo = default(ValidationResponseErrorInfo)) - { - IsValid = isValid; - ErrorInfo = errorInfo; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets whether or not validation succeeded - /// - [JsonProperty(PropertyName = "isValid")] - public bool? IsValid { get; private set; } - - /// - /// Gets or sets failed validation result details - /// - [JsonProperty(PropertyName = "errorInfo")] - public ValidationResponseErrorInfo ErrorInfo { get; set; } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ValidationResponseErrorInfo.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ValidationResponseErrorInfo.cs deleted file mode 100644 index 46c7133225fe..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ValidationResponseErrorInfo.cs +++ /dev/null @@ -1,63 +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; - - /// - /// Failed validation result details - /// - public partial class ValidationResponseErrorInfo - { - /// - /// Initializes a new instance of the ValidationResponseErrorInfo - /// class. - /// - public ValidationResponseErrorInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ValidationResponseErrorInfo - /// class. - /// - /// Error code indicating why validation - /// failed - /// Message indicating why validation - /// failed - public ValidationResponseErrorInfo(string code = default(string), string message = default(string)) - { - Code = code; - Message = message; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets error code indicating why validation failed - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; private set; } - - /// - /// Gets message indicating why validation failed - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; private 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 939bb9c65fb3..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/PermissionsOperations.cs +++ /dev/null @@ -1,822 +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. The name is case insensitive. - /// - /// - /// 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 (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.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets all permissions the caller has for a resource. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// 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 (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"); - } - 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"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - 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}", 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/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 7019fcda9171..000000000000 --- 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. The name is case insensitive. - /// - 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 name is case insensitive. - /// - /// - /// 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 name is case insensitive. - /// - /// - /// 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 name is case insensitive. - /// - /// - /// 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 c34779e5996f..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ProviderOperationsMetadataOperations.cs +++ /dev/null @@ -1,573 +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}", 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/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 1e2c53134366..000000000000 --- 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/RoleAssignmentMetricsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentMetricsOperations.cs deleted file mode 100644 index e9bf5465ba0b..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentMetricsOperations.cs +++ /dev/null @@ -1,232 +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; - - /// - /// RoleAssignmentMetricsOperations operations. - /// - internal partial class RoleAssignmentMetricsOperations : IServiceOperations, IRoleAssignmentMetricsOperations - { - /// - /// Initializes a new instance of the RoleAssignmentMetricsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal RoleAssignmentMetricsOperations(AuthorizationManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the AuthorizationManagementClient - /// - public AuthorizationManagementClient Client { get; private set; } - - /// - /// Get role assignment usage metrics for a 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> GetMetricsForSubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - string apiVersion = "2019-08-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("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetMetricsForSubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignmentsUsageMetrics").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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentMetricsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentMetricsOperationsExtensions.cs deleted file mode 100644 index a42f098ea013..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentMetricsOperationsExtensions.cs +++ /dev/null @@ -1,53 +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 RoleAssignmentMetricsOperations. - /// - public static partial class RoleAssignmentMetricsOperationsExtensions - { - /// - /// Get role assignment usage metrics for a subscription - /// - /// - /// The operations group for this extension method. - /// - public static RoleAssignmentMetricsResult GetMetricsForSubscription(this IRoleAssignmentMetricsOperations operations) - { - return operations.GetMetricsForSubscriptionAsync().GetAwaiter().GetResult(); - } - - /// - /// Get role assignment usage metrics for a subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task GetMetricsForSubscriptionAsync(this IRoleAssignmentMetricsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetMetricsForSubscriptionWithHttpMessagesAsync(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 bd39b807d647..06e5d414b364 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperations.cs @@ -52,8 +52,23 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) public AuthorizationManagementClient Client { get; private set; } /// - /// List all role assignments that apply to a subscription. + /// List role assignments for a resource. /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of the resource provider. + /// + /// + /// The parent resource identity. + /// + /// + /// The resource type of the resource. + /// + /// + /// The name of the resource to get role assignments for. + /// /// /// OData parameters to apply to the operation. /// @@ -81,209 +96,50 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListForSubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), 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 (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - string apiVersion = "2020-08-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("tenantId", tenantId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListForSubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments").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 (tenantId != null) - { - _queryParameters.Add(string.Format("tenantId={0}", System.Uri.EscapeDataString(tenantId))); - } - 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) + if (resourceGroupName == null) { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (Client.AcceptLanguage != null) + if (resourceGroupName != null) { - if (_httpRequest.Headers.Contains("accept-language")) + if (resourceGroupName.Length > 90) { - _httpRequest.Headers.Remove("accept-language"); + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) + if (resourceGroupName.Length < 1) { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) + if (resourceProviderNamespace == null) { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); } - // Send Request - if (_shouldTrace) + if (parentResourcePath == null) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + throw new ValidationException(ValidationRules.CannotBeNull, "parentResourcePath"); } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) + if (resourceType == null) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) + if (resourceName == null) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) + if (Client.ApiVersion == null) { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - // Deserialize Response - if ((int)_statusCode == 200) + if (Client.ApiVersion != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) + if (Client.ApiVersion.Length < 1) { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// List all role assignments that apply to a 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 - /// - /// - /// 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), string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -295,22 +151,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } - 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); - } - } - string apiVersion = "2020-08-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -320,16 +160,23 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceProviderNamespace", resourceProviderNamespace); + tracingParameters.Add("parentResourcePath", parentResourcePath); + tracingParameters.Add("resourceType", resourceType); + tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("tenantId", tenantId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListForResourceGroup", tracingParameters); + 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/Microsoft.Authorization/roleAssignments").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments").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 (odataQuery != null) { @@ -339,9 +186,9 @@ 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) { @@ -468,21 +315,11 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// List all role assignments that apply to a resource. + /// List role assignments for a resource group. /// /// /// The name of the resource group. The name is case insensitive. /// - /// - /// The namespace of the resource provider. - /// - /// - /// The resource type name. For example the type name of a web app is 'sites' - /// (from Microsoft.Web/sites). - /// - /// - /// The resource name. - /// /// /// OData parameters to apply to the operation. /// @@ -510,19 +347,8 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), 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 (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -538,19 +364,28 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } - if (resourceProviderNamespace == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (resourceType == null) + if (Client.ApiVersion != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } } - if (resourceName == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } } - string apiVersion = "2020-08-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -560,22 +395,15 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("resourceProviderNamespace", resourceProviderNamespace); - 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); + 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/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{resourceProviderNamespace}", resourceProviderNamespace); - _url = _url.Replace("{resourceType}", resourceType); - _url = _url.Replace("{resourceName}", resourceName); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (odataQuery != null) { @@ -585,9 +413,9 @@ 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) { @@ -714,17 +542,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// Get a role assignment by scope and name. + /// Delete a role assignment. /// /// - /// The scope of the operation or resource. Valid scopes are: subscription - /// (format: '/subscriptions/{subscriptionId}'), resource group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or - /// resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + /// The scope of the role assignment to delete. /// /// - /// The name of the role assignment. It can be any valid GUID. + /// The name of the role assignment to delete. /// /// /// Tenant ID for cross-tenant request @@ -750,7 +574,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string scope, string roleAssignmentName, string tenantId = default(string), 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) { @@ -760,7 +584,17 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentName"); } - string apiVersion = "2020-08-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; @@ -770,20 +604,19 @@ 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); + 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/roleAssignments/{roleAssignmentName}").ToString(); _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{roleAssignmentName}", roleAssignmentName); + _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) { @@ -796,7 +629,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -847,7 +680,7 @@ 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -910,17 +743,19 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// Create or update a role assignment by scope and name. + /// Create a role assignment. /// /// - /// The scope of the operation or resource. Valid scopes are: subscription - /// (format: '/subscriptions/{subscriptionId}'), resource group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or - /// resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + /// The scope of the role assignment to create. The scope can be any REST + /// resource instance. For example, use '/subscriptions/{subscription-id}/' for + /// a subscription, + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + /// a resource group, and + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + /// for a resource. /// /// - /// The name of the role assignment. It can be any valid GUID. + /// The name of the role assignment to create. It can be any valid GUID. /// /// /// Parameters for the role assignment. @@ -963,224 +798,18 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) if (parameters != null) { parameters.Validate(); - } - string apiVersion = "2020-08-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("roleAssignmentName", roleAssignmentName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}").ToString(); - _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{roleAssignmentName}", roleAssignmentName); - 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(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // 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; - } - - /// - /// Delete a role assignment by scope and name. - /// - /// - /// The scope of the operation or resource. Valid scopes are: subscription - /// (format: '/subscriptions/{subscriptionId}'), resource group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or - /// resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - /// - /// - /// The name of the role assignment. It can be any valid GUID. - /// - /// - /// 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 - /// - /// - /// 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 roleAssignmentName, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) + } + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (roleAssignmentName == null) + if (Client.ApiVersion != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentName"); + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } } - string apiVersion = "2020-08-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1190,24 +819,19 @@ 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("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}").ToString(); _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{roleAssignmentName}", roleAssignmentName); + _url = _url.Replace("{roleAssignmentName}", System.Uri.EscapeDataString(roleAssignmentName)); List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (tenantId != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("tenantId={0}", System.Uri.EscapeDataString(tenantId))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1216,7 +840,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1247,6 +871,12 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) { @@ -1267,7 +897,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 201) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1305,7 +935,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } // Deserialize Response - if ((int)_statusCode == 200) + if ((int)_statusCode == 201) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try @@ -1330,20 +960,16 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// Validate a role assignment create or update operation by scope and name. + /// Get the specified role assignment. /// /// - /// The scope of the operation or resource. Valid scopes are: subscription - /// (format: '/subscriptions/{subscriptionId}'), resource group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or - /// resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + /// The scope of the role assignment. /// /// - /// The name of the role assignment. It can be any valid GUID. + /// The name of the role assignment to get. /// - /// - /// Parameters for the role assignment. + /// + /// Tenant ID for cross-tenant request /// /// /// Headers that will be added to request. @@ -1366,7 +992,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ValidateWithHttpMessagesAsync(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, 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) { @@ -1376,15 +1002,17 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentName"); } - if (parameters == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (parameters != null) + if (Client.ApiVersion != null) { - parameters.Validate(); + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } } - string apiVersion = "2020-08-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1394,20 +1022,23 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("scope", scope); tracingParameters.Add("roleAssignmentName", roleAssignmentName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("tenantId", tenantId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Validate", tracingParameters); + 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/roleAssignments/{roleAssignmentName}/validate").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}").ToString(); _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{roleAssignmentName}", roleAssignmentName); + _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) { @@ -1416,7 +1047,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1447,12 +1078,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) { @@ -1503,7 +1128,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1516,7 +1141,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1536,17 +1161,10 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// List all role assignments that apply to a scope. + /// Delete a role assignment. /// - /// - /// The scope of the operation or resource. Valid scopes are: subscription - /// (format: '/subscriptions/{subscriptionId}'), resource group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or - /// resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - /// - /// - /// OData parameters to apply to the operation. + /// + /// The ID of the role assignment to delete. /// /// /// Tenant ID for cross-tenant request @@ -1572,13 +1190,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), string tenantId = default(string), 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 (scope == null) + if (roleId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + throw new ValidationException(ValidationRules.CannotBeNull, "roleId"); + } + 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); + } } - string apiVersion = "2020-08-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1586,29 +1214,19 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("scope", scope); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("roleId", roleId); tracingParameters.Add("tenantId", tenantId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListForScope", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteById", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleAssignments").ToString(); - _url = _url.Replace("{scope}", scope); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{roleId}").ToString(); + _url = _url.Replace("{roleId}", roleId); List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _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) { @@ -1621,7 +1239,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1672,7 +1290,7 @@ 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1702,7 +1320,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1715,7 +1333,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1735,17 +1353,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// Get a role assignment by ID. + /// Creates a role assignment by ID. /// - /// - /// The fully qualified ID of the role assignment including scope, resource - /// name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// The ID of the role assignment to create. /// - /// - /// Tenant ID for cross-tenant request + /// + /// Parameters for the role assignment. /// /// /// Headers that will be added to request. @@ -1768,13 +1382,31 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByIdWithHttpMessagesAsync(string roleAssignmentId, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateByIdWithHttpMessagesAsync(string roleId, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (roleAssignmentId == null) + if (roleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentId"); + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } } - string apiVersion = "2020-08-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1782,24 +1414,19 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("roleAssignmentId", roleAssignmentId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("tenantId", tenantId); + tracingParameters.Add("roleId", roleId); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetById", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateById", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{roleAssignmentId}").ToString(); - _url = _url.Replace("{roleAssignmentId}", roleAssignmentId); + 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 (tenantId != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("tenantId={0}", System.Uri.EscapeDataString(tenantId))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1808,7 +1435,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1839,6 +1466,12 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) { @@ -1859,7 +1492,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 201) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1897,7 +1530,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } // Deserialize Response - if ((int)_statusCode == 200) + if ((int)_statusCode == 201) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try @@ -1922,17 +1555,13 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// Create or update a role assignment by ID. + /// Gets a role assignment by ID. /// - /// - /// The fully qualified ID of the role assignment including scope, resource - /// name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// The ID of the role assignment to get. /// - /// - /// Parameters for the role assignment. + /// + /// Tenant ID for cross-tenant request /// /// /// Headers that will be added to request. @@ -1955,21 +1584,23 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateByIdWithHttpMessagesAsync(string roleAssignmentId, RoleAssignmentCreateParameters parameters, 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 (roleAssignmentId == null) + if (roleId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentId"); + throw new ValidationException(ValidationRules.CannotBeNull, "roleId"); } - if (parameters == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (parameters != null) + if (Client.ApiVersion != null) { - parameters.Validate(); + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } } - string apiVersion = "2020-08-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1977,20 +1608,23 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("roleAssignmentId", roleAssignmentId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); + tracingParameters.Add("roleId", roleId); + tracingParameters.Add("tenantId", tenantId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateById", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetById", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{roleAssignmentId}").ToString(); - _url = _url.Replace("{roleAssignmentId}", roleAssignmentId); + 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(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) { @@ -1999,7 +1633,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2030,12 +1664,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) { @@ -2056,7 +1684,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2111,24 +1739,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } - // 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); @@ -2137,14 +1747,10 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// Delete a role assignment by ID. + /// Gets all role assignments for the subscription. /// - /// - /// The fully qualified ID of the role assignment including scope, resource - /// name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// OData parameters to apply to the operation. /// /// /// Tenant ID for cross-tenant request @@ -2170,13 +1776,30 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> DeleteByIdWithHttpMessagesAsync(string roleAssignmentId, string tenantId = default(string), 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 (roleAssignmentId == null) + 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"); + } + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentId"); + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } } - string apiVersion = "2020-08-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2184,20 +1807,27 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("roleAssignmentId", roleAssignmentId); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("tenantId", tenantId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteById", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{roleAssignmentId}").ToString(); - _url = _url.Replace("{roleAssignmentId}", roleAssignmentId); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (odataQuery != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (tenantId != null) { @@ -2210,7 +1840,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2261,7 +1891,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2291,7 +1921,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2304,7 +1934,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2324,17 +1954,16 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// Validate a role assignment create or update operation by ID. + /// Gets role assignments for a scope. /// - /// - /// The fully qualified ID of the role assignment including scope, resource - /// name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// The scope of the role assignments. /// - /// - /// Parameters for the role assignment. + /// + /// OData parameters to apply to the operation. + /// + /// + /// Tenant ID for cross-tenant request /// /// /// Headers that will be added to request. @@ -2357,21 +1986,23 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ValidateByIdWithHttpMessagesAsync(string roleAssignmentId, RoleAssignmentCreateParameters parameters, 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 (roleAssignmentId == null) + if (scope == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentId"); + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); } - if (parameters == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (parameters != null) + if (Client.ApiVersion != null) { - parameters.Validate(); + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } } - string apiVersion = "2020-08-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2379,20 +2010,32 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("roleAssignmentId", roleAssignmentId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); + tracingParameters.Add("odataQuery", odataQuery); + tracingParameters.Add("scope", scope); + tracingParameters.Add("tenantId", tenantId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ValidateById", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListForScope", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{roleAssignmentId}/validate").ToString(); - _url = _url.Replace("{roleAssignmentId}", roleAssignmentId); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleAssignments").ToString(); + _url = _url.Replace("{scope}", scope); List _queryParameters = new List(); - if (apiVersion != null) + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + 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) { @@ -2401,7 +2044,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2432,12 +2075,6 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) { @@ -2488,7 +2125,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2501,7 +2138,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2521,7 +2158,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// List all role assignments that apply to a subscription. + /// List role assignments for a resource. /// /// /// The NextLink from the previous successful call to List operation. @@ -2547,7 +2184,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListForSubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListForResourceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2562,7 +2199,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListForSubscriptionNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListForResourceNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2689,7 +2326,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// List all role assignments that apply to a resource group. + /// List role assignments for a resource group. /// /// /// The NextLink from the previous successful call to List operation. @@ -2857,7 +2494,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// List all role assignments that apply to a resource. + /// Gets all role assignments for the subscription. /// /// /// The NextLink from the previous successful call to List operation. @@ -2883,7 +2520,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListForResourceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2898,7 +2535,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListForResourceNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -3025,7 +2662,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) } /// - /// List all role assignments that apply to a scope. + /// Gets role assignments for a scope. /// /// /// The NextLink from the previous successful call to List operation. 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 65d8d7935dbc..dd853de31b75 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperationsExtensions.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperationsExtensions.cs @@ -23,27 +23,25 @@ namespace Microsoft.Azure.Management.Authorization public static partial class RoleAssignmentsOperationsExtensions { /// - /// List all role assignments that apply to a subscription. + /// List role assignments for a resource. /// /// /// The operations group for this extension method. /// - /// - /// OData parameters to apply to the operation. + /// + /// The name of the resource group. The name is case insensitive. /// - /// - /// Tenant ID for cross-tenant request + /// + /// The namespace of the resource provider. /// - public static IPage ListForSubscription(this IRoleAssignmentsOperations operations, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string)) - { - return operations.ListForSubscriptionAsync(odataQuery, tenantId).GetAwaiter().GetResult(); - } - - /// - /// List all role assignments that apply to a subscription. - /// - /// - /// The operations group for this extension method. + /// + /// The parent resource identity. + /// + /// + /// The resource type of the resource. + /// + /// + /// The name of the resource to get role assignments for. /// /// /// OData parameters to apply to the operation. @@ -51,19 +49,13 @@ public static partial class RoleAssignmentsOperationsExtensions /// /// Tenant ID for cross-tenant request /// - /// - /// The cancellation token. - /// - public static async Task> ListForSubscriptionAsync(this IRoleAssignmentsOperations operations, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), CancellationToken cancellationToken = default(CancellationToken)) + 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)) { - using (var _result = await operations.ListForSubscriptionWithHttpMessagesAsync(odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return operations.ListForResourceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery, tenantId).GetAwaiter().GetResult(); } /// - /// List all role assignments that apply to a resource group. + /// List role assignments for a resource. /// /// /// The operations group for this extension method. @@ -71,25 +63,17 @@ public static partial class RoleAssignmentsOperationsExtensions /// /// The name of the resource group. The name is case insensitive. /// - /// - /// OData parameters to apply to the operation. + /// + /// The namespace of the resource provider. /// - /// - /// Tenant ID for cross-tenant request + /// + /// The parent resource identity. /// - public static IPage ListForResourceGroup(this IRoleAssignmentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string)) - { - return operations.ListForResourceGroupAsync(resourceGroupName, odataQuery, tenantId).GetAwaiter().GetResult(); - } - - /// - /// List all role assignments that apply to a resource group. - /// - /// - /// The operations group for this extension method. + /// + /// The resource type of the resource. /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The name of the resource to get role assignments for. /// /// /// OData parameters to apply to the operation. @@ -100,16 +84,16 @@ public static partial class RoleAssignmentsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListForResourceGroupAsync(this IRoleAssignmentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), 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.ListForResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListForResourceWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// List all role assignments that apply to a resource. + /// List role assignments for a resource group. /// /// /// The operations group for this extension method. @@ -117,29 +101,19 @@ public static partial class RoleAssignmentsOperationsExtensions /// /// The name of the resource group. The name is case insensitive. /// - /// - /// The namespace of the resource provider. - /// - /// - /// The resource type name. For example the type name of a web app is 'sites' - /// (from Microsoft.Web/sites). - /// - /// - /// The resource name. - /// /// /// OData parameters to apply to the operation. /// /// /// Tenant ID for cross-tenant request /// - public static IPage ListForResource(this IRoleAssignmentsOperations operations, string resourceGroupName, string resourceProviderNamespace, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string)) + public static IPage ListForResourceGroup(this IRoleAssignmentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string)) { - return operations.ListForResourceAsync(resourceGroupName, resourceProviderNamespace, resourceType, resourceName, odataQuery, tenantId).GetAwaiter().GetResult(); + return operations.ListForResourceGroupAsync(resourceGroupName, odataQuery, tenantId).GetAwaiter().GetResult(); } /// - /// List all role assignments that apply to a resource. + /// List role assignments for a resource group. /// /// /// The operations group for this extension method. @@ -147,16 +121,6 @@ public static partial class RoleAssignmentsOperationsExtensions /// /// The name of the resource group. The name is case insensitive. /// - /// - /// The namespace of the resource provider. - /// - /// - /// The resource type name. For example the type name of a web app is 'sites' - /// (from Microsoft.Web/sites). - /// - /// - /// The resource name. - /// /// /// OData parameters to apply to the operation. /// @@ -166,53 +130,45 @@ public static partial class RoleAssignmentsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListForResourceAsync(this IRoleAssignmentsOperations operations, string resourceGroupName, string resourceProviderNamespace, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), 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.ListForResourceWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, resourceType, resourceName, odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListForResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Get a role assignment by scope and name. + /// Delete a role assignment. /// /// /// The operations group for this extension method. /// /// - /// The scope of the operation or resource. Valid scopes are: subscription - /// (format: '/subscriptions/{subscriptionId}'), resource group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or - /// resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + /// The scope of the role assignment to delete. /// /// - /// The name of the role assignment. It can be any valid GUID. + /// The name of the role assignment to delete. /// /// /// Tenant ID for cross-tenant request /// - public static RoleAssignment Get(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, string tenantId = default(string)) + public static RoleAssignment Delete(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, string tenantId = default(string)) { - return operations.GetAsync(scope, roleAssignmentName, tenantId).GetAwaiter().GetResult(); + return operations.DeleteAsync(scope, roleAssignmentName, tenantId).GetAwaiter().GetResult(); } /// - /// Get a role assignment by scope and name. + /// Delete a role assignment. /// /// /// The operations group for this extension method. /// /// - /// The scope of the operation or resource. Valid scopes are: subscription - /// (format: '/subscriptions/{subscriptionId}'), resource group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or - /// resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + /// The scope of the role assignment to delete. /// /// - /// The name of the role assignment. It can be any valid GUID. + /// The name of the role assignment to delete. /// /// /// Tenant ID for cross-tenant request @@ -220,29 +176,31 @@ public static partial class RoleAssignmentsOperationsExtensions /// /// The cancellation token. /// - public static async Task GetAsync(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, string tenantId = default(string), 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.GetWithHttpMessagesAsync(scope, roleAssignmentName, tenantId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.DeleteWithHttpMessagesAsync(scope, roleAssignmentName, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Create or update a role assignment by scope and name. + /// Create a role assignment. /// /// /// The operations group for this extension method. /// /// - /// The scope of the operation or resource. Valid scopes are: subscription - /// (format: '/subscriptions/{subscriptionId}'), resource group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or - /// resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + /// The scope of the role assignment to create. The scope can be any REST + /// resource instance. For example, use '/subscriptions/{subscription-id}/' for + /// a subscription, + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + /// a resource group, and + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + /// for a resource. /// /// - /// The name of the role assignment. It can be any valid GUID. + /// The name of the role assignment to create. It can be any valid GUID. /// /// /// Parameters for the role assignment. @@ -253,20 +211,22 @@ public static RoleAssignment Create(this IRoleAssignmentsOperations operations, } /// - /// Create or update a role assignment by scope and name. + /// Create a role assignment. /// /// /// The operations group for this extension method. /// /// - /// The scope of the operation or resource. Valid scopes are: subscription - /// (format: '/subscriptions/{subscriptionId}'), resource group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or - /// resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + /// The scope of the role assignment to create. The scope can be any REST + /// resource instance. For example, use '/subscriptions/{subscription-id}/' for + /// a subscription, + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + /// a resource group, and + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + /// for a resource. /// /// - /// The name of the role assignment. It can be any valid GUID. + /// The name of the role assignment to create. It can be any valid GUID. /// /// /// Parameters for the role assignment. @@ -283,44 +243,36 @@ public static RoleAssignment Create(this IRoleAssignmentsOperations operations, } /// - /// Delete a role assignment by scope and name. + /// Get the specified role assignment. /// /// /// The operations group for this extension method. /// /// - /// The scope of the operation or resource. Valid scopes are: subscription - /// (format: '/subscriptions/{subscriptionId}'), resource group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or - /// resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + /// The scope of the role assignment. /// /// - /// The name of the role assignment. It can be any valid GUID. + /// The name of the role assignment to get. /// /// /// Tenant ID for cross-tenant request /// - public static RoleAssignment Delete(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, string tenantId = default(string)) + public static RoleAssignment Get(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, string tenantId = default(string)) { - return operations.DeleteAsync(scope, roleAssignmentName, tenantId).GetAwaiter().GetResult(); + return operations.GetAsync(scope, roleAssignmentName, tenantId).GetAwaiter().GetResult(); } /// - /// Delete a role assignment by scope and name. + /// Get the specified role assignment. /// /// /// The operations group for this extension method. /// /// - /// The scope of the operation or resource. Valid scopes are: subscription - /// (format: '/subscriptions/{subscriptionId}'), resource group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or - /// resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + /// The scope of the role assignment. /// /// - /// The name of the role assignment. It can be any valid GUID. + /// The name of the role assignment to get. /// /// /// Tenant ID for cross-tenant request @@ -328,107 +280,39 @@ public static RoleAssignment Create(this IRoleAssignmentsOperations operations, /// /// The cancellation token. /// - 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, tenantId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Validate a role assignment create or update operation by scope and name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope of the operation or resource. Valid scopes are: subscription - /// (format: '/subscriptions/{subscriptionId}'), resource group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or - /// resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - /// - /// - /// The name of the role assignment. It can be any valid GUID. - /// - /// - /// Parameters for the role assignment. - /// - public static ValidationResponse Validate(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters) - { - return operations.ValidateAsync(scope, roleAssignmentName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Validate a role assignment create or update operation by scope and name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scope of the operation or resource. Valid scopes are: subscription - /// (format: '/subscriptions/{subscriptionId}'), resource group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or - /// resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - /// - /// - /// The name of the role assignment. It can be any valid GUID. - /// - /// - /// Parameters for the role assignment. - /// - /// - /// The cancellation token. - /// - public static async Task ValidateAsync(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, 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.ValidateWithHttpMessagesAsync(scope, roleAssignmentName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(scope, roleAssignmentName, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// List all role assignments that apply to a scope. + /// Delete a role assignment. /// /// /// The operations group for this extension method. /// - /// - /// The scope of the operation or resource. Valid scopes are: subscription - /// (format: '/subscriptions/{subscriptionId}'), resource group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or - /// resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - /// - /// - /// OData parameters to apply to the operation. + /// + /// The ID of the role assignment to delete. /// /// /// Tenant ID for cross-tenant request /// - public static IPage ListForScope(this IRoleAssignmentsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string)) + public static RoleAssignment DeleteById(this IRoleAssignmentsOperations operations, string roleId, string tenantId = default(string)) { - return operations.ListForScopeAsync(scope, odataQuery, tenantId).GetAwaiter().GetResult(); + return operations.DeleteByIdAsync(roleId, tenantId).GetAwaiter().GetResult(); } /// - /// List all role assignments that apply to a scope. + /// Delete a role assignment. /// /// /// The operations group for this extension method. /// - /// - /// The scope of the operation or resource. Valid scopes are: subscription - /// (format: '/subscriptions/{subscriptionId}'), resource group (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or - /// resource (format: - /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - /// - /// - /// OData parameters to apply to the operation. + /// + /// The ID of the role assignment to delete. /// /// /// Tenant ID for cross-tenant request @@ -436,143 +320,119 @@ public static ValidationResponse Validate(this IRoleAssignmentsOperations operat /// /// The cancellation token. /// - public static async Task> ListForScopeAsync(this IRoleAssignmentsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), 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.ListForScopeWithHttpMessagesAsync(scope, odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.DeleteByIdWithHttpMessagesAsync(roleId, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Get a role assignment by ID. + /// Creates a role assignment by ID. /// /// /// The operations group for this extension method. /// - /// - /// The fully qualified ID of the role assignment including scope, resource - /// name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// The ID of the role assignment to create. /// - /// - /// Tenant ID for cross-tenant request + /// + /// Parameters for the role assignment. /// - public static RoleAssignment GetById(this IRoleAssignmentsOperations operations, string roleAssignmentId, string tenantId = default(string)) + public static RoleAssignment CreateById(this IRoleAssignmentsOperations operations, string roleId, RoleAssignmentCreateParameters parameters) { - return operations.GetByIdAsync(roleAssignmentId, tenantId).GetAwaiter().GetResult(); + return operations.CreateByIdAsync(roleId, parameters).GetAwaiter().GetResult(); } /// - /// Get a role assignment by ID. + /// Creates a role assignment by ID. /// /// /// The operations group for this extension method. /// - /// - /// The fully qualified ID of the role assignment including scope, resource - /// name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// The ID of the role assignment to create. /// - /// - /// Tenant ID for cross-tenant request + /// + /// Parameters for the role assignment. /// /// /// The cancellation token. /// - public static async Task GetByIdAsync(this IRoleAssignmentsOperations operations, string roleAssignmentId, string tenantId = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateByIdAsync(this IRoleAssignmentsOperations operations, string roleId, RoleAssignmentCreateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetByIdWithHttpMessagesAsync(roleAssignmentId, tenantId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateByIdWithHttpMessagesAsync(roleId, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Create or update a role assignment by ID. + /// Gets a role assignment by ID. /// /// /// The operations group for this extension method. /// - /// - /// The fully qualified ID of the role assignment including scope, resource - /// name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// The ID of the role assignment to get. /// - /// - /// Parameters for the role assignment. + /// + /// Tenant ID for cross-tenant request /// - public static RoleAssignment CreateById(this IRoleAssignmentsOperations operations, string roleAssignmentId, RoleAssignmentCreateParameters parameters) + public static RoleAssignment GetById(this IRoleAssignmentsOperations operations, string roleId, string tenantId = default(string)) { - return operations.CreateByIdAsync(roleAssignmentId, parameters).GetAwaiter().GetResult(); + return operations.GetByIdAsync(roleId, tenantId).GetAwaiter().GetResult(); } /// - /// Create or update a role assignment by ID. + /// Gets a role assignment by ID. /// /// /// The operations group for this extension method. /// - /// - /// The fully qualified ID of the role assignment including scope, resource - /// name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// The ID of the role assignment to get. /// - /// - /// Parameters for the role assignment. + /// + /// Tenant ID for cross-tenant request /// /// /// The cancellation token. /// - public static async Task CreateByIdAsync(this IRoleAssignmentsOperations operations, string roleAssignmentId, RoleAssignmentCreateParameters parameters, 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.CreateByIdWithHttpMessagesAsync(roleAssignmentId, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetByIdWithHttpMessagesAsync(roleId, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Delete a role assignment by ID. + /// Gets all role assignments for the subscription. /// /// /// The operations group for this extension method. /// - /// - /// The fully qualified ID of the role assignment including scope, resource - /// name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// OData parameters to apply to the operation. /// /// /// Tenant ID for cross-tenant request /// - public static RoleAssignment DeleteById(this IRoleAssignmentsOperations operations, string roleAssignmentId, string tenantId = default(string)) + public static IPage List(this IRoleAssignmentsOperations operations, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string)) { - return operations.DeleteByIdAsync(roleAssignmentId, tenantId).GetAwaiter().GetResult(); + return operations.ListAsync(odataQuery, tenantId).GetAwaiter().GetResult(); } /// - /// Delete a role assignment by ID. + /// Gets all role assignments for the subscription. /// /// /// The operations group for this extension method. /// - /// - /// The fully qualified ID of the role assignment including scope, resource - /// name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// OData parameters to apply to the operation. /// /// /// Tenant ID for cross-tenant request @@ -580,64 +440,62 @@ public static RoleAssignment CreateById(this IRoleAssignmentsOperations operatio /// /// The cancellation token. /// - public static async Task DeleteByIdAsync(this IRoleAssignmentsOperations operations, string roleAssignmentId, string tenantId = default(string), 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.DeleteByIdWithHttpMessagesAsync(roleAssignmentId, tenantId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Validate a role assignment create or update operation by ID. + /// Gets role assignments for a scope. /// /// /// The operations group for this extension method. /// - /// - /// The fully qualified ID of the role assignment including scope, resource - /// name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// The scope of the role assignments. /// - /// - /// Parameters for the role assignment. + /// + /// OData parameters to apply to the operation. + /// + /// + /// Tenant ID for cross-tenant request /// - public static ValidationResponse ValidateById(this IRoleAssignmentsOperations operations, string roleAssignmentId, RoleAssignmentCreateParameters parameters) + public static IPage ListForScope(this IRoleAssignmentsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string)) { - return operations.ValidateByIdAsync(roleAssignmentId, parameters).GetAwaiter().GetResult(); + return operations.ListForScopeAsync(scope, odataQuery, tenantId).GetAwaiter().GetResult(); } /// - /// Validate a role assignment create or update operation by ID. + /// Gets role assignments for a scope. /// /// /// The operations group for this extension method. /// - /// - /// The fully qualified ID of the role assignment including scope, resource - /// name, and resource type. Format: - /// /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - /// Example: - /// /subscriptions/<SUB_ID>/resourcegroups/<RESOURCE_GROUP>/providers/Microsoft.Authorization/roleAssignments/<ROLE_ASSIGNMENT_NAME> + /// + /// The scope of the role assignments. /// - /// - /// Parameters for the role assignment. + /// + /// OData parameters to apply to the operation. + /// + /// + /// Tenant ID for cross-tenant request /// /// /// The cancellation token. /// - public static async Task ValidateByIdAsync(this IRoleAssignmentsOperations operations, string roleAssignmentId, RoleAssignmentCreateParameters parameters, 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.ValidateByIdWithHttpMessagesAsync(roleAssignmentId, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListForScopeWithHttpMessagesAsync(scope, odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// List all role assignments that apply to a subscription. + /// List role assignments for a resource. /// /// /// The operations group for this extension method. @@ -645,13 +503,13 @@ public static ValidationResponse ValidateById(this IRoleAssignmentsOperations op /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListForSubscriptionNext(this IRoleAssignmentsOperations operations, string nextPageLink) + public static IPage ListForResourceNext(this IRoleAssignmentsOperations operations, string nextPageLink) { - return operations.ListForSubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListForResourceNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// List all role assignments that apply to a subscription. + /// List role assignments for a resource. /// /// /// The operations group for this extension method. @@ -662,16 +520,16 @@ public static IPage ListForSubscriptionNext(this IRoleAssignment /// /// The cancellation token. /// - public static async Task> ListForSubscriptionNextAsync(this IRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListForResourceNextAsync(this IRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListForSubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListForResourceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// List all role assignments that apply to a resource group. + /// List role assignments for a resource group. /// /// /// The operations group for this extension method. @@ -685,7 +543,7 @@ public static IPage ListForResourceGroupNext(this IRoleAssignmen } /// - /// List all role assignments that apply to a resource group. + /// List role assignments for a resource group. /// /// /// The operations group for this extension method. @@ -705,7 +563,7 @@ public static IPage ListForResourceGroupNext(this IRoleAssignmen } /// - /// List all role assignments that apply to a resource. + /// Gets all role assignments for the subscription. /// /// /// The operations group for this extension method. @@ -713,13 +571,13 @@ public static IPage ListForResourceGroupNext(this IRoleAssignmen /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListForResourceNext(this IRoleAssignmentsOperations operations, string nextPageLink) + public static IPage ListNext(this IRoleAssignmentsOperations operations, string nextPageLink) { - return operations.ListForResourceNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// List all role assignments that apply to a resource. + /// Gets all role assignments for the subscription. /// /// /// The operations group for this extension method. @@ -730,16 +588,16 @@ public static IPage ListForResourceNext(this IRoleAssignmentsOpe /// /// The cancellation token. /// - public static async Task> ListForResourceNextAsync(this IRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListNextAsync(this IRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListForResourceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// List all role assignments that apply to a scope. + /// Gets role assignments for a scope. /// /// /// The operations group for this extension method. @@ -753,7 +611,7 @@ public static IPage ListForScopeNext(this IRoleAssignmentsOperat } /// - /// List all role assignments that apply to a scope. + /// Gets role assignments for a scope. /// /// /// 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 2b7b41d5a6e9..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleDefinitionsOperations.cs +++ /dev/null @@ -1,1155 +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 && (int)_statusCode != 204) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Creates or updates 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/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 bdd04376a40a..000000000000 --- 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 cd3124bae587..bfe72965a444 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,30 +19,10 @@ 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", "GlobalAdministrator", "2015-07-01"), - new Tuple("Authorization", "Permissions", "2018-01-01-preview"), - new Tuple("Authorization", "ProviderOperationsMetadata", "2018-01-01-preview"), - new Tuple("Authorization", "RoleAssignmentMetrics", "2019-08-01-preview"), - new Tuple("Authorization", "RoleAssignments", "2020-08-01-preview"), - new Tuple("Authorization", "RoleDefinitions", "2018-01-01-preview"), - new Tuple("AuthorizationManagementClient", "DenyAssignments", "2018-07-01-preview"), - new Tuple("AuthorizationManagementClient", "RoleAssignments", "2020-08-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(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/authorization/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --tag=package-2020-08-01-preview --csharp-sdks-folder=C:\\GitHub\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "61e7148e9592c5efc95e5c16a5bb4f2dc26d6de0"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -