From 515a1ae22c4ffbee49276ff6fd7e00a78de3dc55 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 4 Dec 2020 03:13:12 +0000 Subject: [PATCH] CodeGen from PR 11506 in Azure/azure-rest-api-specs [Hub Generated] Review request for Microsoft.Authorization to add version preview/2020-04-01-preview (#11506) --- .../Generated/IRoleAssignmentsOperations.cs | 16 +- .../src/Generated/Models/Error.cs | 53 +++++ .../src/Generated/Models/ErrorError.cs | 60 +++++ .../src/Generated/Models/RoleAssignment.cs | 60 ++++- .../Models/RoleAssignmentCreateParameters.cs | 17 +- .../Generated/RoleAssignmentsOperations.cs | 212 +++++++++++++++--- .../RoleAssignmentsOperationsExtensions.cs | 32 +-- .../SdkInfo_AuthorizationManagementClient.cs | 5 +- 8 files changed, 394 insertions(+), 61 deletions(-) create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Error.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorError.cs 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 7d71e8e960dd..426ff5b3cbc5 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentsOperations.cs @@ -85,7 +85,7 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a role assignment. /// @@ -145,7 +145,7 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> CreateWithHttpMessagesAsync(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateWithHttpMessagesAsync(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the specified role assignment. /// @@ -170,7 +170,7 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string scope, string roleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string scope, string roleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a role assignment. /// @@ -261,7 +261,7 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets role assignments for a scope. /// @@ -286,7 +286,7 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListForScopeWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListForScopeWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets role assignments for a resource. /// @@ -330,7 +330,7 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListForResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListForResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all role assignments for the subscription. /// @@ -352,7 +352,7 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets role assignments for a scope. /// @@ -374,6 +374,6 @@ public partial interface IRoleAssignmentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListForScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListForScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Error.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Error.cs new file mode 100644 index 000000000000..0f7521369f32 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Error.cs @@ -0,0 +1,53 @@ +// +// 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; + + /// + /// Object to be thrown in case of an unsuccessful response + /// + public partial class Error + { + /// + /// Initializes a new instance of the Error class. + /// + public Error() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Error class. + /// + /// Object to be thrown in case of an + /// unsuccessful response + public Error(ErrorError errorProperty = default(ErrorError)) + { + ErrorProperty = errorProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets object to be thrown in case of an unsuccessful + /// response + /// + [JsonProperty(PropertyName = "error")] + public ErrorError ErrorProperty { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorError.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorError.cs new file mode 100644 index 000000000000..e99c9ed9e049 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorError.cs @@ -0,0 +1,60 @@ +// +// 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; + + /// + /// Object to be thrown in case of an unsuccessful response + /// + public partial class ErrorError + { + /// + /// Initializes a new instance of the ErrorError class. + /// + public ErrorError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorError class. + /// + /// Brief error code + /// Longer message explaining the details of the + /// error + public ErrorError(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 or sets brief error code + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets longer message explaining the details of the error + /// + [JsonProperty(PropertyName = "message")] + public string Message { 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 7825ab6a6b49..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 @@ -46,10 +46,21 @@ public RoleAssignment() /// The Delegation flag for the role /// assignment /// Description of role assignment - /// The conditions on the role + /// The conditions on the role assignment. This + /// limits the resources it can be assigned to. e.g.: + /// @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + /// StringEqualsIgnoreCase 'foo_storage_container' + /// Version of the condition. Currently + /// accepted value is '2.0' + /// Time it was created + /// Time it was updated + /// Id of the user who created the /// assignment - /// Version of the condition - public RoleAssignment(string id = default(string), string name = default(string), string type = default(string), string scope = default(string), string roleDefinitionId = default(string), string principalId = default(string), string principalType = default(string), bool? canDelegate = default(bool?), string description = default(string), string condition = default(string), string conditionVersion = default(string)) + /// Id of the user who updated the + /// assignment + /// Id of the + /// delegated managed identity resource + public RoleAssignment(string id = default(string), string name = default(string), string type = default(string), string scope = default(string), string roleDefinitionId = default(string), string principalId = default(string), string principalType = default(string), bool? canDelegate = default(bool?), string description = default(string), string condition = default(string), string conditionVersion = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? updatedOn = default(System.DateTime?), string createdBy = default(string), string updatedBy = default(string), string delegatedManagedIdentityResourceId = default(string)) { Id = id; Name = name; @@ -62,6 +73,11 @@ public RoleAssignment() Description = description; Condition = condition; ConditionVersion = conditionVersion; + CreatedOn = createdOn; + UpdatedOn = updatedOn; + CreatedBy = createdBy; + UpdatedBy = updatedBy; + DelegatedManagedIdentityResourceId = delegatedManagedIdentityResourceId; CustomInit(); } @@ -128,16 +144,50 @@ public RoleAssignment() public string Description { get; set; } /// - /// Gets or sets the conditions on the role assignment + /// Gets or sets the conditions on the role assignment. This limits the + /// resources it can be assigned to. e.g.: + /// @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + /// StringEqualsIgnoreCase 'foo_storage_container' /// [JsonProperty(PropertyName = "properties.condition")] public string Condition { get; set; } /// - /// Gets or sets version of the condition + /// Gets or sets version of the condition. Currently accepted value is + /// '2.0' /// [JsonProperty(PropertyName = "properties.conditionVersion")] public string ConditionVersion { get; set; } + /// + /// Gets or sets time it was created + /// + [JsonProperty(PropertyName = "properties.createdOn")] + public System.DateTime? CreatedOn { get; set; } + + /// + /// Gets or sets time it was updated + /// + [JsonProperty(PropertyName = "properties.updatedOn")] + public System.DateTime? UpdatedOn { get; set; } + + /// + /// Gets or sets id of the user who created the assignment + /// + [JsonProperty(PropertyName = "properties.createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets id of the user who updated the assignment + /// + [JsonProperty(PropertyName = "properties.updatedBy")] + public string UpdatedBy { get; set; } + + /// + /// Gets or sets id of the delegated managed identity resource + /// + [JsonProperty(PropertyName = "properties.delegatedManagedIdentityResourceId")] + public string DelegatedManagedIdentityResourceId { get; set; } + } } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentCreateParameters.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentCreateParameters.cs index 7c7d5192b95f..c447f74288ca 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentCreateParameters.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentCreateParameters.cs @@ -47,9 +47,12 @@ public RoleAssignmentCreateParameters() /// The delegation flag used for creating a /// role assignment /// Description of role assignment - /// The conditions on the role - /// assignment - /// Version of the condition + /// The conditions on the role assignment. This + /// limits the resources it can be assigned to. e.g.: + /// @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + /// StringEqualsIgnoreCase 'foo_storage_container' + /// Version of the condition. Currently + /// accepted value is '2.0' 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)) { RoleDefinitionId = roleDefinitionId; @@ -104,13 +107,17 @@ public RoleAssignmentCreateParameters() public string Description { get; set; } /// - /// Gets or sets the conditions on the role assignment + /// Gets or sets the conditions on the role assignment. This limits the + /// resources it can be assigned to. e.g.: + /// @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] + /// StringEqualsIgnoreCase 'foo_storage_container' /// [JsonProperty(PropertyName = "properties.condition")] public string Condition { get; set; } /// - /// Gets or sets version of the condition + /// Gets or sets version of the condition. Currently accepted value is + /// '2.0' /// [JsonProperty(PropertyName = "properties.conditionVersion")] public string ConditionVersion { get; set; } 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 a2400ef800cf..3c6b2f94a848 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperations.cs @@ -314,7 +314,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -414,7 +414,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 400) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -449,7 +449,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")) @@ -474,6 +474,24 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 400) + { + _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); @@ -603,7 +621,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 && (int)_statusCode != 412) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -709,7 +727,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateWithHttpMessagesAsync(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateWithHttpMessagesAsync(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { @@ -816,7 +834,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 201) + if ((int)_statusCode != 201 && (int)_statusCode != 400 && (int)_statusCode != 409) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -851,7 +869,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")) @@ -876,6 +894,42 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 400) + { + _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 == 409) + { + _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); @@ -913,7 +967,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string scope, string roleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string scope, string roleAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { @@ -1005,7 +1059,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 400 && (int)_statusCode != 404) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1040,7 +1094,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")) @@ -1065,6 +1119,24 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 400) + { + _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); @@ -1657,7 +1729,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -1751,7 +1823,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 400) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1786,7 +1858,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")) @@ -1811,6 +1883,24 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 400) + { + _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); @@ -1848,7 +1938,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListForScopeWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListForScopeWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { @@ -1943,7 +2033,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 400) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1978,7 +2068,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")) @@ -2003,6 +2093,24 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 400) + { + _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); @@ -2210,7 +2318,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListForResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListForResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2289,7 +2397,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 400) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2324,7 +2432,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")) @@ -2349,6 +2457,24 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 400) + { + _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); @@ -2383,7 +2509,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(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) { @@ -2462,7 +2588,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 400) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2497,7 +2623,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")) @@ -2522,6 +2648,24 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 400) + { + _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); @@ -2556,7 +2700,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListForScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListForScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2635,7 +2779,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 400) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2670,7 +2814,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")) @@ -2695,6 +2839,24 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 400) + { + _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); 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 9d7240347434..b0dd45436daa 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperationsExtensions.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperationsExtensions.cs @@ -98,7 +98,7 @@ public static partial class RoleAssignmentsOperationsExtensions /// /// OData parameters to apply to the operation. /// - public static IPage ListForResourceGroup(this IRoleAssignmentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery)) + public static object ListForResourceGroup(this IRoleAssignmentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery)) { return operations.ListForResourceGroupAsync(resourceGroupName, odataQuery).GetAwaiter().GetResult(); } @@ -118,7 +118,7 @@ public static partial class RoleAssignmentsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListForResourceGroupAsync(this IRoleAssignmentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListForResourceGroupAsync(this IRoleAssignmentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListForResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { @@ -187,7 +187,7 @@ public static RoleAssignment Delete(this IRoleAssignmentsOperations operations, /// /// Parameters for the role assignment. /// - public static RoleAssignment Create(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters) + public static object Create(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters) { return operations.CreateAsync(scope, roleAssignmentName, parameters).GetAwaiter().GetResult(); } @@ -216,7 +216,7 @@ public static RoleAssignment Create(this IRoleAssignmentsOperations operations, /// /// The cancellation token. /// - public static async Task CreateAsync(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateAsync(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateWithHttpMessagesAsync(scope, roleAssignmentName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -236,7 +236,7 @@ public static RoleAssignment Create(this IRoleAssignmentsOperations operations, /// /// The name of the role assignment to get. /// - public static RoleAssignment Get(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName) + public static object Get(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName) { return operations.GetAsync(scope, roleAssignmentName).GetAwaiter().GetResult(); } @@ -256,7 +256,7 @@ public static RoleAssignment Get(this IRoleAssignmentsOperations operations, str /// /// The cancellation token. /// - public static async Task GetAsync(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(scope, roleAssignmentName, null, cancellationToken).ConfigureAwait(false)) { @@ -381,7 +381,7 @@ public static RoleAssignment GetById(this IRoleAssignmentsOperations operations, /// /// OData parameters to apply to the operation. /// - public static IPage List(this IRoleAssignmentsOperations operations, ODataQuery odataQuery = default(ODataQuery)) + public static object List(this IRoleAssignmentsOperations operations, ODataQuery odataQuery = default(ODataQuery)) { return operations.ListAsync(odataQuery).GetAwaiter().GetResult(); } @@ -398,7 +398,7 @@ public static RoleAssignment GetById(this IRoleAssignmentsOperations operations, /// /// The cancellation token. /// - public static async Task> ListAsync(this IRoleAssignmentsOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListAsync(this IRoleAssignmentsOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) { @@ -418,7 +418,7 @@ public static RoleAssignment GetById(this IRoleAssignmentsOperations operations, /// /// OData parameters to apply to the operation. /// - public static IPage ListForScope(this IRoleAssignmentsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery)) + public static object ListForScope(this IRoleAssignmentsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery)) { return operations.ListForScopeAsync(scope, odataQuery).GetAwaiter().GetResult(); } @@ -438,7 +438,7 @@ public static RoleAssignment GetById(this IRoleAssignmentsOperations operations, /// /// The cancellation token. /// - public static async Task> ListForScopeAsync(this IRoleAssignmentsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListForScopeAsync(this IRoleAssignmentsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListForScopeWithHttpMessagesAsync(scope, odataQuery, null, cancellationToken).ConfigureAwait(false)) { @@ -489,7 +489,7 @@ public static IPage ListForResourceNext(this IRoleAssignmentsOpe /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListForResourceGroupNext(this IRoleAssignmentsOperations operations, string nextPageLink) + public static object ListForResourceGroupNext(this IRoleAssignmentsOperations operations, string nextPageLink) { return operations.ListForResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); } @@ -506,7 +506,7 @@ public static IPage ListForResourceGroupNext(this IRoleAssignmen /// /// The cancellation token. /// - public static async Task> ListForResourceGroupNextAsync(this IRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListForResourceGroupNextAsync(this IRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListForResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { @@ -523,7 +523,7 @@ public static IPage ListForResourceGroupNext(this IRoleAssignmen /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListNext(this IRoleAssignmentsOperations operations, string nextPageLink) + public static object ListNext(this IRoleAssignmentsOperations operations, string nextPageLink) { return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); } @@ -540,7 +540,7 @@ public static IPage ListNext(this IRoleAssignmentsOperations ope /// /// The cancellation token. /// - public static async Task> ListNextAsync(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.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { @@ -557,7 +557,7 @@ public static IPage ListNext(this IRoleAssignmentsOperations ope /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListForScopeNext(this IRoleAssignmentsOperations operations, string nextPageLink) + public static object ListForScopeNext(this IRoleAssignmentsOperations operations, string nextPageLink) { return operations.ListForScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); } @@ -574,7 +574,7 @@ public static IPage ListForScopeNext(this IRoleAssignmentsOperat /// /// The cancellation token. /// - public static async Task> ListForScopeNextAsync(this IRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListForScopeNextAsync(this IRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListForScopeNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { 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 3e08e4b08e2f..f6969688e7c2 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 @@ -21,12 +21,13 @@ public static IEnumerable> ApiInfo_AuthorizationMa { 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", "RoleAssignments", "2018-09-01-preview"), + new Tuple("Authorization", "RoleAssignments", "2020-04-01-preview"), new Tuple("Authorization", "RoleDefinitions", "2018-01-01-preview"), new Tuple("AuthorizationManagementClient", "DenyAssignments", "2018-07-01-preview"), - new Tuple("AuthorizationManagementClient", "RoleAssignments", "2018-09-01-preview"), + new Tuple("AuthorizationManagementClient", "RoleAssignments", "2020-04-01-preview"), new Tuple("AuthorizationManagementClient", "RoleDefinitions", "2018-01-01-preview"), }.AsEnumerable(); }