From f27430d8df61788d43fb4bc601916c561f597d60 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 31 Mar 2022 10:14:08 +0000 Subject: [PATCH] CodeGen from PR 18459 in Azure/azure-rest-api-specs Merge 01575f1a9430751c5318295e9f00d5fe4c655dad into b6a78456cab458910378135995f1d019765ccec3 --- .../AccessReviewDefaultSettingsOperations.cs | 414 +++ ...viewDefaultSettingsOperationsExtensions.cs | 87 + ...iewHistoryDefinitionInstanceOperations.cs} | 66 +- ...yDefinitionInstanceOperationsExtensions.cs | 71 + ...iewHistoryDefinitionInstancesOperations.cs | 404 +++ ...DefinitionInstancesOperationsExtensions.cs | 93 + ...AccessReviewHistoryDefinitionOperations.cs | 411 +++ ...ewHistoryDefinitionOperationsExtensions.cs | 96 + ...ccessReviewHistoryDefinitionsOperations.cs | 588 +++ ...HistoryDefinitionsOperationsExtensions.cs} | 64 +- ...iewInstanceContactedReviewersOperations.cs | 413 +++ ...eContactedReviewersOperationsExtensions.cs | 99 + ...AccessReviewInstanceDecisionsOperations.cs | 424 +++ ...ewInstanceDecisionsOperationsExtensions.cs | 111 + ...cessReviewInstanceMyDecisionsOperations.cs | 823 +++++ ...InstanceMyDecisionsOperationsExtensions.cs | 209 ++ .../AccessReviewInstanceOperations.cs | 900 +++++ ...ccessReviewInstanceOperationsExtensions.cs | 212 ++ ...stancesAssignedForMyApprovalOperations.cs} | 133 +- ...signedForMyApprovalOperationsExtensions.cs | 145 + ....cs => AccessReviewInstancesOperations.cs} | 251 +- ...cessReviewInstancesOperationsExtensions.cs | 191 + ...initionsAssignedForMyApprovalOperations.cs | 401 +++ ...signedForMyApprovalOperationsExtensions.cs | 99 + ...essReviewScheduleDefinitionsOperations.cs} | 355 +- ...ScheduleDefinitionsOperationsExtensions.cs | 235 ++ .../AuthorizationManagementClient.cs | 104 +- .../Generated/DenyAssignmentsOperations.cs | 1923 ---------- .../DenyAssignmentsOperationsExtensions.cs | 422 --- .../GlobalAdministratorOperations.cs | 193 - ...GlobalAdministratorOperationsExtensions.cs | 50 - .../IAccessReviewDefaultSettingsOperations.cs | 68 + ...iewHistoryDefinitionInstanceOperations.cs} | 19 +- ...iewHistoryDefinitionInstancesOperations.cs | 71 + ...AccessReviewHistoryDefinitionOperations.cs | 71 + ...cessReviewHistoryDefinitionsOperations.cs} | 39 +- ...iewInstanceContactedReviewersOperations.cs | 74 + ...AccessReviewInstanceDecisionsOperations.cs | 80 + ...cessReviewInstanceMyDecisionsOperations.cs | 139 + .../IAccessReviewInstanceOperations.cs | 138 + ...nstancesAssignedForMyApprovalOperations.cs | 102 + ...cs => IAccessReviewInstancesOperations.cs} | 65 +- ...initionsAssignedForMyApprovalOperations.cs | 74 + ...essReviewScheduleDefinitionsOperations.cs} | 90 +- .../IAuthorizationManagementClient.cs | 74 +- .../Generated/IDenyAssignmentsOperations.cs | 277 -- .../IGlobalAdministratorOperations.cs | 43 - ...nistratorsOperations.cs => IOperations.cs} | 18 +- .../Generated/IRoleAssignmentsOperations.cs | 489 --- ...iewInstanceContactedReviewersOperations.cs | 74 + .../Models/AccessRecommendationType.cs | 23 + .../Models/AccessReviewActorIdentityType.cs | 22 + .../Models/AccessReviewApplyResult.cs | 26 + .../Models/AccessReviewContactedReviewer.cs | 100 + .../Generated/Models/AccessReviewDecision.cs | 246 ++ .../Models/AccessReviewDecisionIdentity.cs | 63 + .../Models/AccessReviewDecisionProperties.cs | 148 + .../Models/AccessReviewDecisionResource.cs | 64 + ... AccessReviewDecisionResourceAzureRole.cs} | 29 +- ...sReviewDecisionServicePrincipalIdentity.cs | 60 + .../AccessReviewDecisionUserIdentity.cs | 60 + .../Models/AccessReviewDefaultSettings.cs | 254 ++ .../Models/AccessReviewHistoryDefinition.cs | 267 ++ ...AccessReviewHistoryDefinitionProperties.cs | 158 + .../AccessReviewHistoryDefinitionStatus.cs | 24 + .../Models/AccessReviewHistoryInstance.cs | 173 + .../Generated/Models/AccessReviewInstance.cs | 143 + .../Models/AccessReviewInstanceProperties.cs | 117 + .../AccessReviewInstanceReviewersType.cs | 23 + .../Models/AccessReviewInstanceStatus.cs | 31 + .../AccessReviewRecurrencePatternType.cs | 22 + .../Models/AccessReviewRecurrenceRangeType.cs | 23 + .../Generated/Models/AccessReviewResult.cs | 25 + .../Generated/Models/AccessReviewReviewer.cs | 63 + .../Models/AccessReviewReviewerType.cs | 22 + .../Models/AccessReviewScheduleDefinition.cs | 446 +++ ...ccessReviewScheduleDefinitionProperties.cs | 164 + ...ssReviewScheduleDefinitionReviewersType.cs | 23 + .../AccessReviewScheduleDefinitionStatus.cs | 31 + .../Models/AccessReviewScheduleSettings.cs | 166 + .../src/Generated/Models/AccessReviewScope.cs | 110 + .../AccessReviewScopeAssignmentState.cs | 22 + .../Models/AccessReviewScopePrincipalType.cs | 25 + .../Generated/Models/ClassicAdministrator.cs | 87 - .../Generated/Models/DefaultDecisionType.cs | 23 + .../src/Generated/Models/DenyAssignment.cs | 149 - .../Generated/Models/DenyAssignmentFilter.cs | 75 - .../Models/DenyAssignmentPermission.cs | 85 - .../Generated/Models/ErrorAdditionalInfo.cs | 59 - .../{ErrorResponse.cs => ErrorDefinition.cs} | 22 +- ...ception.cs => ErrorDefinitionException.cs} | 18 +- ...orInfo.cs => ErrorDefinitionProperties.cs} | 37 +- .../src/Generated/Models/ErrorDetail.cs | 85 - .../src/Generated/Models/Operation.cs | 76 + .../src/Generated/Models/OperationDisplay.cs | 79 + .../src/Generated/Models/Permission.cs | 77 - .../src/Generated/Models/Principal.cs | 75 - .../src/Generated/Models/PrincipalType.cs | 30 - .../src/Generated/Models/ProviderOperation.cs | 92 - .../Models/ProviderOperationsMetadata.cs | 93 - .../src/Generated/Models/ResourceType.cs | 69 - .../src/Generated/Models/RoleAssignment.cs | 202 -- .../Models/RoleAssignmentCreateParameters.cs | 179 - .../Models/RoleAssignmentMetricsResult.cs | 80 - .../src/Generated/Models/RoleDefinition.cs | 113 - .../Generated/Models/RoleDefinitionFilter.cs | 61 - .../Generated/Models/ValidationResponse.cs | 59 - ...inistratorsOperations.cs => Operations.cs} | 58 +- ...sExtensions.cs => OperationsExtensions.cs} | 24 +- .../PermissionsOperationsExtensions.cs | 185 - ...leAssignmentMetricsOperationsExtensions.cs | 53 - .../Generated/RoleAssignmentsOperations.cs | 3196 ----------------- .../RoleAssignmentsOperationsExtensions.cs | 776 ---- .../RoleDefinitionsOperationsExtensions.cs | 268 -- .../SdkInfo_AuthorizationManagementClient.cs | 37 +- ...iewInstanceContactedReviewersOperations.cs | 408 +++ ...eContactedReviewersOperationsExtensions.cs | 99 + 117 files changed, 11918 insertions(+), 10276 deletions(-) create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewDefaultSettingsOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewDefaultSettingsOperationsExtensions.cs rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/{RoleAssignmentMetricsOperations.cs => AccessReviewHistoryDefinitionInstanceOperations.cs} (73%) create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionInstanceOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionInstancesOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionInstancesOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionsOperations.cs rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/{ProviderOperationsMetadataOperationsExtensions.cs => AccessReviewHistoryDefinitionsOperationsExtensions.cs} (50%) create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceContactedReviewersOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceContactedReviewersOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceDecisionsOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceDecisionsOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceMyDecisionsOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceMyDecisionsOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceOperationsExtensions.cs rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/{ProviderOperationsMetadataOperations.cs => AccessReviewInstancesAssignedForMyApprovalOperations.cs} (78%) create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesAssignedForMyApprovalOperationsExtensions.cs rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/{PermissionsOperations.cs => AccessReviewInstancesOperations.cs} (77%) create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsAssignedForMyApprovalOperationsExtensions.cs rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/{RoleDefinitionsOperations.cs => AccessReviewScheduleDefinitionsOperations.cs} (76%) create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsOperationsExtensions.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 create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewDefaultSettingsOperations.cs rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/{IRoleAssignmentMetricsOperations.cs => IAccessReviewHistoryDefinitionInstanceOperations.cs} (57%) create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewHistoryDefinitionInstancesOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewHistoryDefinitionOperations.cs rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/{IProviderOperationsMetadataOperations.cs => IAccessReviewHistoryDefinitionsOperations.cs} (61%) create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceContactedReviewersOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceDecisionsOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceMyDecisionsOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstancesAssignedForMyApprovalOperations.cs rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/{IPermissionsOperations.cs => IAccessReviewInstancesOperations.cs} (59%) create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations.cs rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/{IRoleDefinitionsOperations.cs => IAccessReviewScheduleDefinitionsOperations.cs} (54%) 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 rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/{IClassicAdministratorsOperations.cs => IOperations.cs} (69%) delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentsOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ITenantLevelAccessReviewInstanceContactedReviewersOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessRecommendationType.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewActorIdentityType.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewApplyResult.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewContactedReviewer.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecision.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionIdentity.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionProperties.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionResource.cs rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/{RoleAssignmentFilter.cs => AccessReviewDecisionResourceAzureRole.cs} (51%) create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionServicePrincipalIdentity.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionUserIdentity.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDefaultSettings.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryDefinition.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryDefinitionProperties.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryDefinitionStatus.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryInstance.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstance.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstanceProperties.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstanceReviewersType.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstanceStatus.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewRecurrencePatternType.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewRecurrenceRangeType.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewResult.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewReviewer.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewReviewerType.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinition.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinitionProperties.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinitionReviewersType.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinitionStatus.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleSettings.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScope.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScopeAssignmentState.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScopePrincipalType.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ClassicAdministrator.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/DefaultDecisionType.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/ErrorAdditionalInfo.cs rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/{ErrorResponse.cs => ErrorDefinition.cs} (62%) rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/{ErrorResponseException.cs => ErrorDefinitionException.cs} (70%) rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/{ValidationResponseErrorInfo.cs => ErrorDefinitionProperties.cs} (59%) delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDetail.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Operation.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/OperationDisplay.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/PrincipalType.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/RoleAssignment.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentCreateParameters.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 rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/{ClassicAdministratorsOperations.cs => Operations.cs} (83%) rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/{ClassicAdministratorsOperationsExtensions.cs => OperationsExtensions.cs} (66%) delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/PermissionsOperationsExtensions.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/RoleAssignmentsOperations.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperationsExtensions.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleDefinitionsOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/TenantLevelAccessReviewInstanceContactedReviewersOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/TenantLevelAccessReviewInstanceContactedReviewersOperationsExtensions.cs diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewDefaultSettingsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewDefaultSettingsOperations.cs new file mode 100644 index 000000000000..7dbb49c4666d --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewDefaultSettingsOperations.cs @@ -0,0 +1,414 @@ +// +// 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; + + /// + /// AccessReviewDefaultSettingsOperations operations. + /// + internal partial class AccessReviewDefaultSettingsOperations : IServiceOperations, IAccessReviewDefaultSettingsOperations + { + /// + /// Initializes a new instance of the AccessReviewDefaultSettingsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AccessReviewDefaultSettingsOperations(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 access review default settings 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> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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 access review default settings for the subscription + /// + /// + /// Access review schedule settings. + /// + /// + /// 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> PutWithHttpMessagesAsync(AccessReviewScheduleSettings properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("properties", properties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Put", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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(properties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(properties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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/AccessReviewDefaultSettingsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewDefaultSettingsOperationsExtensions.cs new file mode 100644 index 000000000000..b3cad09dddfd --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewDefaultSettingsOperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// 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 AccessReviewDefaultSettingsOperations. + /// + public static partial class AccessReviewDefaultSettingsOperationsExtensions + { + /// + /// Get access review default settings for the subscription + /// + /// + /// The operations group for this extension method. + /// + public static AccessReviewDefaultSettings Get(this IAccessReviewDefaultSettingsOperations operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// Get access review default settings for the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAccessReviewDefaultSettingsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get access review default settings for the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// Access review schedule settings. + /// + public static AccessReviewDefaultSettings Put(this IAccessReviewDefaultSettingsOperations operations, AccessReviewScheduleSettings properties) + { + return operations.PutAsync(properties).GetAwaiter().GetResult(); + } + + /// + /// Get access review default settings for the subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// Access review schedule settings. + /// + /// + /// The cancellation token. + /// + public static async Task PutAsync(this IAccessReviewDefaultSettingsOperations operations, AccessReviewScheduleSettings properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PutWithHttpMessagesAsync(properties, 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/AccessReviewHistoryDefinitionInstanceOperations.cs similarity index 73% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentMetricsOperations.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionInstanceOperations.cs index e9bf5465ba0b..0b9a8e5f5b14 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentMetricsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionInstanceOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Authorization using System.Threading.Tasks; /// - /// RoleAssignmentMetricsOperations operations. + /// AccessReviewHistoryDefinitionInstanceOperations operations. /// - internal partial class RoleAssignmentMetricsOperations : IServiceOperations, IRoleAssignmentMetricsOperations + internal partial class AccessReviewHistoryDefinitionInstanceOperations : IServiceOperations, IAccessReviewHistoryDefinitionInstanceOperations { /// - /// Initializes a new instance of the RoleAssignmentMetricsOperations class. + /// Initializes a new instance of the AccessReviewHistoryDefinitionInstanceOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class RoleAssignmentMetricsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal RoleAssignmentMetricsOperations(AuthorizationManagementClient client) + internal AccessReviewHistoryDefinitionInstanceOperations(AuthorizationManagementClient client) { if (client == null) { @@ -51,15 +51,24 @@ internal RoleAssignmentMetricsOperations(AuthorizationManagementClient client) public AuthorizationManagementClient Client { get; private set; } /// - /// Get role assignment usage metrics for a subscription + /// Generates a uri which can be used to retrieve review history data. This URI + /// has a TTL of 1 day and can be retrieved by fetching the + /// accessReviewHistoryDefinition object. /// + /// + /// The id of the access review history definition. + /// + /// + /// The id of the access review history definition instance to generate a URI + /// for. + /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -74,20 +83,24 @@ internal RoleAssignmentMetricsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetMetricsForSubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GenerateDownloadUriWithHttpMessagesAsync(string historyDefinitionId, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) + if (historyDefinitionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "historyDefinitionId"); } - if (Client.SubscriptionId != null) + if (instanceId == null) { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } + throw new ValidationException(ValidationRules.CannotBeNull, "instanceId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-08-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -95,18 +108,21 @@ internal RoleAssignmentMetricsOperations(AuthorizationManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("historyDefinitionId", historyDefinitionId); + tracingParameters.Add("instanceId", instanceId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetMetricsForSubscription", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GenerateDownloadUri", 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(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}/instances/{instanceId}/generateDownloadUri").ToString(); + _url = _url.Replace("{historyDefinitionId}", System.Uri.EscapeDataString(historyDefinitionId)); + _url = _url.Replace("{instanceId}", System.Uri.EscapeDataString(instanceId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -115,7 +131,7 @@ internal RoleAssignmentMetricsOperations(AuthorizationManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -168,11 +184,11 @@ internal RoleAssignmentMetricsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -196,7 +212,7 @@ internal RoleAssignmentMetricsOperations(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")) @@ -209,7 +225,7 @@ internal RoleAssignmentMetricsOperations(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) { diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionInstanceOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionInstanceOperationsExtensions.cs new file mode 100644 index 000000000000..761001c16874 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionInstanceOperationsExtensions.cs @@ -0,0 +1,71 @@ +// +// 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 AccessReviewHistoryDefinitionInstanceOperations. + /// + public static partial class AccessReviewHistoryDefinitionInstanceOperationsExtensions + { + /// + /// Generates a uri which can be used to retrieve review history data. This URI + /// has a TTL of 1 day and can be retrieved by fetching the + /// accessReviewHistoryDefinition object. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review history definition. + /// + /// + /// The id of the access review history definition instance to generate a URI + /// for. + /// + public static AccessReviewHistoryInstance GenerateDownloadUri(this IAccessReviewHistoryDefinitionInstanceOperations operations, string historyDefinitionId, string instanceId) + { + return operations.GenerateDownloadUriAsync(historyDefinitionId, instanceId).GetAwaiter().GetResult(); + } + + /// + /// Generates a uri which can be used to retrieve review history data. This URI + /// has a TTL of 1 day and can be retrieved by fetching the + /// accessReviewHistoryDefinition object. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review history definition. + /// + /// + /// The id of the access review history definition instance to generate a URI + /// for. + /// + /// + /// The cancellation token. + /// + public static async Task GenerateDownloadUriAsync(this IAccessReviewHistoryDefinitionInstanceOperations operations, string historyDefinitionId, string instanceId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GenerateDownloadUriWithHttpMessagesAsync(historyDefinitionId, instanceId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionInstancesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionInstancesOperations.cs new file mode 100644 index 000000000000..22de12477a60 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionInstancesOperations.cs @@ -0,0 +1,404 @@ +// +// 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; + + /// + /// AccessReviewHistoryDefinitionInstancesOperations operations. + /// + internal partial class AccessReviewHistoryDefinitionInstancesOperations : IServiceOperations, IAccessReviewHistoryDefinitionInstancesOperations + { + /// + /// Initializes a new instance of the AccessReviewHistoryDefinitionInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AccessReviewHistoryDefinitionInstancesOperations(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 access review history definition instances by definition Id + /// + /// + /// The id of the access review history 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>> ListWithHttpMessagesAsync(string historyDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (historyDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "historyDefinitionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("historyDefinitionId", historyDefinitionId); + 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/accessReviewHistoryDefinitions/{historyDefinitionId}/instances").ToString(); + _url = _url.Replace("{historyDefinitionId}", System.Uri.EscapeDataString(historyDefinitionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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 access review history definition instances by definition Id + /// + /// + /// 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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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/AccessReviewHistoryDefinitionInstancesOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionInstancesOperationsExtensions.cs new file mode 100644 index 000000000000..a419b2197ca5 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionInstancesOperationsExtensions.cs @@ -0,0 +1,93 @@ +// +// 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 AccessReviewHistoryDefinitionInstancesOperations. + /// + public static partial class AccessReviewHistoryDefinitionInstancesOperationsExtensions + { + /// + /// Get access review history definition instances by definition Id + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review history definition. + /// + public static IPage List(this IAccessReviewHistoryDefinitionInstancesOperations operations, string historyDefinitionId) + { + return operations.ListAsync(historyDefinitionId).GetAwaiter().GetResult(); + } + + /// + /// Get access review history definition instances by definition Id + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review history definition. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAccessReviewHistoryDefinitionInstancesOperations operations, string historyDefinitionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(historyDefinitionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get access review history definition instances by definition Id + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IAccessReviewHistoryDefinitionInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get access review history definition instances by definition Id + /// + /// + /// 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 IAccessReviewHistoryDefinitionInstancesOperations 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/AccessReviewHistoryDefinitionOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionOperations.cs new file mode 100644 index 000000000000..13d9ab1e50f1 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionOperations.cs @@ -0,0 +1,411 @@ +// +// 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; + + /// + /// AccessReviewHistoryDefinitionOperations operations. + /// + internal partial class AccessReviewHistoryDefinitionOperations : IServiceOperations, IAccessReviewHistoryDefinitionOperations + { + /// + /// Initializes a new instance of the AccessReviewHistoryDefinitionOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AccessReviewHistoryDefinitionOperations(AuthorizationManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AuthorizationManagementClient + /// + public AuthorizationManagementClient Client { get; private set; } + + /// + /// Create a scheduled or one-time Access Review History Definition + /// + /// + /// The id of the access review history definition. + /// + /// + /// Access review history definition properties. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string historyDefinitionId, AccessReviewHistoryDefinitionProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (historyDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "historyDefinitionId"); + } + if (properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("historyDefinitionId", historyDefinitionId); + tracingParameters.Add("properties", properties); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}").ToString(); + _url = _url.Replace("{historyDefinitionId}", System.Uri.EscapeDataString(historyDefinitionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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(properties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(properties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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; + } + + /// + /// Delete an access review history definition + /// + /// + /// The id of the access review history definition. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteByIdWithHttpMessagesAsync(string historyDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (historyDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "historyDefinitionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("historyDefinitionId", historyDefinitionId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteById", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}").ToString(); + _url = _url.Replace("{historyDefinitionId}", System.Uri.EscapeDataString(historyDefinitionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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/AccessReviewHistoryDefinitionOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionOperationsExtensions.cs new file mode 100644 index 000000000000..dcf7e02889a7 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionOperationsExtensions.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Authorization +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AccessReviewHistoryDefinitionOperations. + /// + public static partial class AccessReviewHistoryDefinitionOperationsExtensions + { + /// + /// Create a scheduled or one-time Access Review History Definition + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review history definition. + /// + /// + /// Access review history definition properties. + /// + public static AccessReviewHistoryDefinition Create(this IAccessReviewHistoryDefinitionOperations operations, string historyDefinitionId, AccessReviewHistoryDefinitionProperties properties) + { + return operations.CreateAsync(historyDefinitionId, properties).GetAwaiter().GetResult(); + } + + /// + /// Create a scheduled or one-time Access Review History Definition + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review history definition. + /// + /// + /// Access review history definition properties. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IAccessReviewHistoryDefinitionOperations operations, string historyDefinitionId, AccessReviewHistoryDefinitionProperties properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(historyDefinitionId, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete an access review history definition + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review history definition. + /// + public static void DeleteById(this IAccessReviewHistoryDefinitionOperations operations, string historyDefinitionId) + { + operations.DeleteByIdAsync(historyDefinitionId).GetAwaiter().GetResult(); + } + + /// + /// Delete an access review history definition + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review history definition. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteByIdAsync(this IAccessReviewHistoryDefinitionOperations operations, string historyDefinitionId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteByIdWithHttpMessagesAsync(historyDefinitionId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionsOperations.cs new file mode 100644 index 000000000000..92edb2bce56d --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionsOperations.cs @@ -0,0 +1,588 @@ +// +// 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; + + /// + /// AccessReviewHistoryDefinitionsOperations operations. + /// + internal partial class AccessReviewHistoryDefinitionsOperations : IServiceOperations, IAccessReviewHistoryDefinitionsOperations + { + /// + /// Initializes a new instance of the AccessReviewHistoryDefinitionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AccessReviewHistoryDefinitionsOperations(AuthorizationManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AuthorizationManagementClient + /// + public AuthorizationManagementClient Client { get; private set; } + + /// + /// Lists the accessReviewHistoryDefinitions available from this provider, + /// definition instances are only available for 30 days after creation. + /// + /// + /// The filter to apply on the operation. Only standard filters on definition + /// name and created date are supported + /// + /// + /// 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 filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("filter", filter); + 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/accessReviewHistoryDefinitions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", filter)); + } + 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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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 access review history definition by definition Id + /// + /// + /// The id of the access review history 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> GetByIdWithHttpMessagesAsync(string historyDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (historyDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "historyDefinitionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("historyDefinitionId", historyDefinitionId); + 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewHistoryDefinitions/{historyDefinitionId}").ToString(); + _url = _url.Replace("{historyDefinitionId}", System.Uri.EscapeDataString(historyDefinitionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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; + } + + /// + /// Lists the accessReviewHistoryDefinitions available from this provider, + /// definition instances are only available for 30 days after creation. + /// + /// + /// 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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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/AccessReviewHistoryDefinitionsOperationsExtensions.cs similarity index 50% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ProviderOperationsMetadataOperationsExtensions.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionsOperationsExtensions.cs index 1e2c53134366..a74027795eda 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ProviderOperationsMetadataOperationsExtensions.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewHistoryDefinitionsOperationsExtensions.cs @@ -17,86 +17,85 @@ namespace Microsoft.Azure.Management.Authorization using System.Threading.Tasks; /// - /// Extension methods for ProviderOperationsMetadataOperations. + /// Extension methods for AccessReviewHistoryDefinitionsOperations. /// - public static partial class ProviderOperationsMetadataOperationsExtensions + public static partial class AccessReviewHistoryDefinitionsOperationsExtensions { /// - /// Gets provider operations metadata for the specified resource provider. + /// Lists the accessReviewHistoryDefinitions available from this provider, + /// definition instances are only available for 30 days after creation. /// /// /// The operations group for this extension method. /// - /// - /// The namespace of the resource provider. + /// + /// The filter to apply on the operation. Only standard filters on definition + /// name and created date are supported /// - /// - /// Specifies whether to expand the values. - /// - public static ProviderOperationsMetadata Get(this IProviderOperationsMetadataOperations operations, string resourceProviderNamespace, string expand = "resourceTypes") + public static IPage List(this IAccessReviewHistoryDefinitionsOperations operations, string filter = default(string)) { - return operations.GetAsync(resourceProviderNamespace, expand).GetAwaiter().GetResult(); + return operations.ListAsync(filter).GetAwaiter().GetResult(); } /// - /// Gets provider operations metadata for the specified resource provider. + /// Lists the accessReviewHistoryDefinitions available from this provider, + /// definition instances are only available for 30 days after creation. /// /// /// The operations group for this extension method. /// - /// - /// The namespace of the resource provider. - /// - /// - /// Specifies whether to expand the values. + /// + /// The filter to apply on the operation. Only standard filters on definition + /// name and created date are supported /// /// /// The cancellation token. /// - public static async Task GetAsync(this IProviderOperationsMetadataOperations operations, string resourceProviderNamespace, string expand = "resourceTypes", CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IAccessReviewHistoryDefinitionsOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceProviderNamespace, expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets provider operations metadata for all resource providers. + /// Get access review history definition by definition Id /// /// /// The operations group for this extension method. /// - /// - /// Specifies whether to expand the values. + /// + /// The id of the access review history definition. /// - public static IPage List(this IProviderOperationsMetadataOperations operations, string expand = "resourceTypes") + public static AccessReviewHistoryDefinition GetById(this IAccessReviewHistoryDefinitionsOperations operations, string historyDefinitionId) { - return operations.ListAsync(expand).GetAwaiter().GetResult(); + return operations.GetByIdAsync(historyDefinitionId).GetAwaiter().GetResult(); } /// - /// Gets provider operations metadata for all resource providers. + /// Get access review history definition by definition Id /// /// /// The operations group for this extension method. /// - /// - /// Specifies whether to expand the values. + /// + /// The id of the access review history definition. /// /// /// The cancellation token. /// - public static async Task> ListAsync(this IProviderOperationsMetadataOperations operations, string expand = "resourceTypes", CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetByIdAsync(this IAccessReviewHistoryDefinitionsOperations operations, string historyDefinitionId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetByIdWithHttpMessagesAsync(historyDefinitionId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets provider operations metadata for all resource providers. + /// Lists the accessReviewHistoryDefinitions available from this provider, + /// definition instances are only available for 30 days after creation. /// /// /// The operations group for this extension method. @@ -104,13 +103,14 @@ public static IPage List(this IProviderOperationsMet /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListNext(this IProviderOperationsMetadataOperations operations, string nextPageLink) + public static IPage ListNext(this IAccessReviewHistoryDefinitionsOperations operations, string nextPageLink) { return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets provider operations metadata for all resource providers. + /// Lists the accessReviewHistoryDefinitions available from this provider, + /// definition instances are only available for 30 days after creation. /// /// /// The operations group for this extension method. @@ -121,7 +121,7 @@ public static IPage ListNext(this IProviderOperation /// /// The cancellation token. /// - public static async Task> ListNextAsync(this IProviderOperationsMetadataOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListNextAsync(this IAccessReviewHistoryDefinitionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceContactedReviewersOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceContactedReviewersOperations.cs new file mode 100644 index 000000000000..75d4cc1b5599 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceContactedReviewersOperations.cs @@ -0,0 +1,413 @@ +// +// 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; + + /// + /// AccessReviewInstanceContactedReviewersOperations operations. + /// + internal partial class AccessReviewInstanceContactedReviewersOperations : IServiceOperations, IAccessReviewInstanceContactedReviewersOperations + { + /// + /// Initializes a new instance of the AccessReviewInstanceContactedReviewersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AccessReviewInstanceContactedReviewersOperations(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 access review instance contacted reviewers + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// 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 scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("id", id); + 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/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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 access review instance contacted reviewers + /// + /// + /// 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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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/AccessReviewInstanceContactedReviewersOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceContactedReviewersOperationsExtensions.cs new file mode 100644 index 000000000000..b9e7a50437fa --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceContactedReviewersOperationsExtensions.cs @@ -0,0 +1,99 @@ +// +// 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 AccessReviewInstanceContactedReviewersOperations. + /// + public static partial class AccessReviewInstanceContactedReviewersOperationsExtensions + { + /// + /// Get access review instance contacted reviewers + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + public static IPage List(this IAccessReviewInstanceContactedReviewersOperations operations, string scheduleDefinitionId, string id) + { + return operations.ListAsync(scheduleDefinitionId, id).GetAwaiter().GetResult(); + } + + /// + /// Get access review instance contacted reviewers + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAccessReviewInstanceContactedReviewersOperations operations, string scheduleDefinitionId, string id, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scheduleDefinitionId, id, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get access review instance contacted reviewers + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IAccessReviewInstanceContactedReviewersOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get access review instance contacted reviewers + /// + /// + /// 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 IAccessReviewInstanceContactedReviewersOperations 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/AccessReviewInstanceDecisionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceDecisionsOperations.cs new file mode 100644 index 000000000000..63667b868872 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceDecisionsOperations.cs @@ -0,0 +1,424 @@ +// +// 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; + + /// + /// AccessReviewInstanceDecisionsOperations operations. + /// + internal partial class AccessReviewInstanceDecisionsOperations : IServiceOperations, IAccessReviewInstanceDecisionsOperations + { + /// + /// Initializes a new instance of the AccessReviewInstanceDecisionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AccessReviewInstanceDecisionsOperations(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 access review instance decisions + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned + /// + /// + /// 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 scheduleDefinitionId, string id, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("id", id); + tracingParameters.Add("filter", filter); + 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/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", filter)); + } + 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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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 access review instance decisions + /// + /// + /// 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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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/AccessReviewInstanceDecisionsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceDecisionsOperationsExtensions.cs new file mode 100644 index 000000000000..e2fe73a13ffb --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceDecisionsOperationsExtensions.cs @@ -0,0 +1,111 @@ +// +// 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 AccessReviewInstanceDecisionsOperations. + /// + public static partial class AccessReviewInstanceDecisionsOperationsExtensions + { + /// + /// Get access review instance decisions + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned + /// + public static IPage List(this IAccessReviewInstanceDecisionsOperations operations, string scheduleDefinitionId, string id, string filter = default(string)) + { + return operations.ListAsync(scheduleDefinitionId, id, filter).GetAwaiter().GetResult(); + } + + /// + /// Get access review instance decisions + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAccessReviewInstanceDecisionsOperations operations, string scheduleDefinitionId, string id, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scheduleDefinitionId, id, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get access review instance decisions + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IAccessReviewInstanceDecisionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get access review instance decisions + /// + /// + /// 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 IAccessReviewInstanceDecisionsOperations 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/AccessReviewInstanceMyDecisionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceMyDecisionsOperations.cs new file mode 100644 index 000000000000..aba46a808795 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceMyDecisionsOperations.cs @@ -0,0 +1,823 @@ +// +// 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; + + /// + /// AccessReviewInstanceMyDecisionsOperations operations. + /// + internal partial class AccessReviewInstanceMyDecisionsOperations : IServiceOperations, IAccessReviewInstanceMyDecisionsOperations + { + /// + /// Initializes a new instance of the AccessReviewInstanceMyDecisionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AccessReviewInstanceMyDecisionsOperations(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 my access review instance decisions. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned + /// + /// + /// 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 scheduleDefinitionId, string id, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("id", id); + tracingParameters.Add("filter", filter); + 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/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", filter)); + } + 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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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 my single access review instance decision. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The id of the decision record. + /// + /// + /// 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 scheduleDefinitionId, string id, string decisionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (decisionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "decisionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("id", id); + tracingParameters.Add("decisionId", decisionId); + 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("/") ? "" : "/")), "providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{decisionId}", System.Uri.EscapeDataString(decisionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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; + } + + /// + /// Record a decision. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The id of the decision record. + /// + /// + /// Access review decision properties to patch. + /// + /// + /// 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> PatchWithHttpMessagesAsync(string scheduleDefinitionId, string id, string decisionId, AccessReviewDecisionProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (decisionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "decisionId"); + } + if (properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("id", id); + tracingParameters.Add("decisionId", decisionId); + tracingParameters.Add("properties", properties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Patch", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{decisionId}", System.Uri.EscapeDataString(decisionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(properties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(properties, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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 my access review instance decisions. + /// + /// + /// 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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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/AccessReviewInstanceMyDecisionsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceMyDecisionsOperationsExtensions.cs new file mode 100644 index 000000000000..f9b3566f10a1 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceMyDecisionsOperationsExtensions.cs @@ -0,0 +1,209 @@ +// +// 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 AccessReviewInstanceMyDecisionsOperations. + /// + public static partial class AccessReviewInstanceMyDecisionsOperationsExtensions + { + /// + /// Get my access review instance decisions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned + /// + public static IPage List(this IAccessReviewInstanceMyDecisionsOperations operations, string scheduleDefinitionId, string id, string filter = default(string)) + { + return operations.ListAsync(scheduleDefinitionId, id, filter).GetAwaiter().GetResult(); + } + + /// + /// Get my access review instance decisions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAccessReviewInstanceMyDecisionsOperations operations, string scheduleDefinitionId, string id, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scheduleDefinitionId, id, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get my single access review instance decision. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The id of the decision record. + /// + public static AccessReviewDecision GetById(this IAccessReviewInstanceMyDecisionsOperations operations, string scheduleDefinitionId, string id, string decisionId) + { + return operations.GetByIdAsync(scheduleDefinitionId, id, decisionId).GetAwaiter().GetResult(); + } + + /// + /// Get my single access review instance decision. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The id of the decision record. + /// + /// + /// The cancellation token. + /// + public static async Task GetByIdAsync(this IAccessReviewInstanceMyDecisionsOperations operations, string scheduleDefinitionId, string id, string decisionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByIdWithHttpMessagesAsync(scheduleDefinitionId, id, decisionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Record a decision. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The id of the decision record. + /// + /// + /// Access review decision properties to patch. + /// + public static AccessReviewDecision Patch(this IAccessReviewInstanceMyDecisionsOperations operations, string scheduleDefinitionId, string id, string decisionId, AccessReviewDecisionProperties properties) + { + return operations.PatchAsync(scheduleDefinitionId, id, decisionId, properties).GetAwaiter().GetResult(); + } + + /// + /// Record a decision. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The id of the decision record. + /// + /// + /// Access review decision properties to patch. + /// + /// + /// The cancellation token. + /// + public static async Task PatchAsync(this IAccessReviewInstanceMyDecisionsOperations operations, string scheduleDefinitionId, string id, string decisionId, AccessReviewDecisionProperties properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PatchWithHttpMessagesAsync(scheduleDefinitionId, id, decisionId, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get my access review instance decisions. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IAccessReviewInstanceMyDecisionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get my access review instance decisions. + /// + /// + /// 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 IAccessReviewInstanceMyDecisionsOperations 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/AccessReviewInstanceOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceOperations.cs new file mode 100644 index 000000000000..845f08e58e98 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceOperations.cs @@ -0,0 +1,900 @@ +// +// 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; + + /// + /// AccessReviewInstanceOperations operations. + /// + internal partial class AccessReviewInstanceOperations : IServiceOperations, IAccessReviewInstanceOperations + { + /// + /// Initializes a new instance of the AccessReviewInstanceOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AccessReviewInstanceOperations(AuthorizationManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AuthorizationManagementClient + /// + public AuthorizationManagementClient Client { get; private set; } + + /// + /// An action to stop an access review instance. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task StopWithHttpMessagesAsync(string scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("id", id); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Stop", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 != 204) + { + var ex = new ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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; + } + + /// + /// An action to reset all decisions for an access review instance. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task ResetDecisionsWithHttpMessagesAsync(string scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("id", id); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ResetDecisions", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 != 204) + { + var ex = new ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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; + } + + /// + /// An action to apply all decisions for an access review instance. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task ApplyDecisionsWithHttpMessagesAsync(string scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("id", id); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ApplyDecisions", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 != 204) + { + var ex = new ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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; + } + + /// + /// An action to send reminders for an access review instance. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task SendRemindersWithHttpMessagesAsync(string scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("id", id); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "SendReminders", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 != 204) + { + var ex = new ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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; + } + + /// + /// An action to accept recommendations for decision in an access review + /// instance. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task AcceptRecommendationsWithHttpMessagesAsync(string scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("id", id); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "AcceptRecommendations", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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 != 204) + { + var ex = new ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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/AccessReviewInstanceOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceOperationsExtensions.cs new file mode 100644 index 000000000000..7921aa28f54c --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceOperationsExtensions.cs @@ -0,0 +1,212 @@ +// +// 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 AccessReviewInstanceOperations. + /// + public static partial class AccessReviewInstanceOperationsExtensions + { + /// + /// An action to stop an access review instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + public static void Stop(this IAccessReviewInstanceOperations operations, string scheduleDefinitionId, string id) + { + operations.StopAsync(scheduleDefinitionId, id).GetAwaiter().GetResult(); + } + + /// + /// An action to stop an access review instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The cancellation token. + /// + public static async Task StopAsync(this IAccessReviewInstanceOperations operations, string scheduleDefinitionId, string id, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StopWithHttpMessagesAsync(scheduleDefinitionId, id, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// An action to reset all decisions for an access review instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + public static void ResetDecisions(this IAccessReviewInstanceOperations operations, string scheduleDefinitionId, string id) + { + operations.ResetDecisionsAsync(scheduleDefinitionId, id).GetAwaiter().GetResult(); + } + + /// + /// An action to reset all decisions for an access review instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The cancellation token. + /// + public static async Task ResetDecisionsAsync(this IAccessReviewInstanceOperations operations, string scheduleDefinitionId, string id, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ResetDecisionsWithHttpMessagesAsync(scheduleDefinitionId, id, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// An action to apply all decisions for an access review instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + public static void ApplyDecisions(this IAccessReviewInstanceOperations operations, string scheduleDefinitionId, string id) + { + operations.ApplyDecisionsAsync(scheduleDefinitionId, id).GetAwaiter().GetResult(); + } + + /// + /// An action to apply all decisions for an access review instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The cancellation token. + /// + public static async Task ApplyDecisionsAsync(this IAccessReviewInstanceOperations operations, string scheduleDefinitionId, string id, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ApplyDecisionsWithHttpMessagesAsync(scheduleDefinitionId, id, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// An action to send reminders for an access review instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + public static void SendReminders(this IAccessReviewInstanceOperations operations, string scheduleDefinitionId, string id) + { + operations.SendRemindersAsync(scheduleDefinitionId, id).GetAwaiter().GetResult(); + } + + /// + /// An action to send reminders for an access review instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The cancellation token. + /// + public static async Task SendRemindersAsync(this IAccessReviewInstanceOperations operations, string scheduleDefinitionId, string id, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.SendRemindersWithHttpMessagesAsync(scheduleDefinitionId, id, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// An action to accept recommendations for decision in an access review + /// instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + public static void AcceptRecommendations(this IAccessReviewInstanceOperations operations, string scheduleDefinitionId, string id) + { + operations.AcceptRecommendationsAsync(scheduleDefinitionId, id).GetAwaiter().GetResult(); + } + + /// + /// An action to accept recommendations for decision in an access review + /// instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The cancellation token. + /// + public static async Task AcceptRecommendationsAsync(this IAccessReviewInstanceOperations operations, string scheduleDefinitionId, string id, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.AcceptRecommendationsWithHttpMessagesAsync(scheduleDefinitionId, id, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ProviderOperationsMetadataOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesAssignedForMyApprovalOperations.cs similarity index 78% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ProviderOperationsMetadataOperations.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesAssignedForMyApprovalOperations.cs index c34779e5996f..fd487c71c27d 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ProviderOperationsMetadataOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesAssignedForMyApprovalOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Authorization using System.Threading.Tasks; /// - /// ProviderOperationsMetadataOperations operations. + /// AccessReviewInstancesAssignedForMyApprovalOperations operations. /// - internal partial class ProviderOperationsMetadataOperations : IServiceOperations, IProviderOperationsMetadataOperations + internal partial class AccessReviewInstancesAssignedForMyApprovalOperations : IServiceOperations, IAccessReviewInstancesAssignedForMyApprovalOperations { /// - /// Initializes a new instance of the ProviderOperationsMetadataOperations class. + /// Initializes a new instance of the AccessReviewInstancesAssignedForMyApprovalOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class ProviderOperationsMetadataOperations : IServiceOperations /// /// Thrown when a required parameter is null /// - internal ProviderOperationsMetadataOperations(AuthorizationManagementClient client) + internal AccessReviewInstancesAssignedForMyApprovalOperations(AuthorizationManagementClient client) { if (client == null) { @@ -51,13 +51,16 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie public AuthorizationManagementClient Client { get; private set; } /// - /// Gets provider operations metadata for the specified resource provider. + /// Get access review instances assigned for my approval. /// - /// - /// The namespace of the resource provider. + /// + /// The id of the access review schedule definition. /// - /// - /// Specifies whether to expand the values. + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned /// /// /// Headers that will be added to request. @@ -65,7 +68,7 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -80,13 +83,16 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie /// /// 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)) + public async Task>> ListWithHttpMessagesAsync(string scheduleDefinitionId, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceProviderNamespace == null) + if (scheduleDefinitionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2018-01-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -94,24 +100,23 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceProviderNamespace", resourceProviderNamespace); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("expand", expand); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", 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("/") ? "" : "/")), "providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}").ToString(); - _url = _url.Replace("{resourceProviderNamespace}", resourceProviderNamespace); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); 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 (expand != null) + if (filter != null) { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + _queryParameters.Add(string.Format("$filter={0}", filter)); } if (_queryParameters.Count > 0) { @@ -173,11 +178,11 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -201,7 +206,7 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie 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")) @@ -214,7 +219,7 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie _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) { @@ -234,10 +239,13 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie } /// - /// Gets provider operations metadata for all resource providers. + /// Get single access review instance assigned for my approval. /// - /// - /// Specifies whether to expand the values. + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. /// /// /// Headers that will be added to request. @@ -245,18 +253,35 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie /// /// 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 expand = "resourceTypes", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByIdWithHttpMessagesAsync(string scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - string apiVersion = "2018-01-01-preview"; + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -264,22 +289,20 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("expand", expand); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", 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("/") ? "" : "/")), "providers/Microsoft.Authorization/providerOperations").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (expand != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -341,11 +364,11 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -369,7 +392,7 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie 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")) @@ -382,7 +405,7 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie _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) { @@ -402,7 +425,7 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie } /// - /// Gets provider operations metadata for all resource providers. + /// Get access review instances assigned for my approval. /// /// /// The NextLink from the previous successful call to List operation. @@ -413,7 +436,7 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -428,7 +451,7 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie /// /// 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) { @@ -509,11 +532,11 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -537,7 +560,7 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie 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")) @@ -550,7 +573,7 @@ internal ProviderOperationsMetadataOperations(AuthorizationManagementClient clie _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) { diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesAssignedForMyApprovalOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesAssignedForMyApprovalOperationsExtensions.cs new file mode 100644 index 000000000000..ad4daf922407 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesAssignedForMyApprovalOperationsExtensions.cs @@ -0,0 +1,145 @@ +// +// 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 AccessReviewInstancesAssignedForMyApprovalOperations. + /// + public static partial class AccessReviewInstancesAssignedForMyApprovalOperationsExtensions + { + /// + /// Get access review instances assigned for my approval. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned + /// + public static IPage List(this IAccessReviewInstancesAssignedForMyApprovalOperations operations, string scheduleDefinitionId, string filter = default(string)) + { + return operations.ListAsync(scheduleDefinitionId, filter).GetAwaiter().GetResult(); + } + + /// + /// Get access review instances assigned for my approval. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAccessReviewInstancesAssignedForMyApprovalOperations operations, string scheduleDefinitionId, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scheduleDefinitionId, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get single access review instance assigned for my approval. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + public static AccessReviewInstance GetById(this IAccessReviewInstancesAssignedForMyApprovalOperations operations, string scheduleDefinitionId, string id) + { + return operations.GetByIdAsync(scheduleDefinitionId, id).GetAwaiter().GetResult(); + } + + /// + /// Get single access review instance assigned for my approval. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The cancellation token. + /// + public static async Task GetByIdAsync(this IAccessReviewInstancesAssignedForMyApprovalOperations operations, string scheduleDefinitionId, string id, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByIdWithHttpMessagesAsync(scheduleDefinitionId, id, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get access review instances assigned for my approval. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IAccessReviewInstancesAssignedForMyApprovalOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get access review instances assigned for my approval. + /// + /// + /// 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 IAccessReviewInstancesAssignedForMyApprovalOperations 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/PermissionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesOperations.cs similarity index 77% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/PermissionsOperations.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesOperations.cs index 939bb9c65fb3..7e379749db40 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/PermissionsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Authorization using System.Threading.Tasks; /// - /// PermissionsOperations operations. + /// AccessReviewInstancesOperations operations. /// - internal partial class PermissionsOperations : IServiceOperations, IPermissionsOperations + internal partial class AccessReviewInstancesOperations : IServiceOperations, IAccessReviewInstancesOperations { /// - /// Initializes a new instance of the PermissionsOperations class. + /// Initializes a new instance of the AccessReviewInstancesOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class PermissionsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal PermissionsOperations(AuthorizationManagementClient client) + internal AccessReviewInstancesOperations(AuthorizationManagementClient client) { if (client == null) { @@ -51,10 +51,16 @@ internal PermissionsOperations(AuthorizationManagementClient client) public AuthorizationManagementClient Client { get; private set; } /// - /// Gets all permissions the caller has for a resource group. + /// Get access review instances /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The id of the access review schedule definition. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned /// /// /// Headers that will be added to request. @@ -62,7 +68,7 @@ internal PermissionsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -77,35 +83,20 @@ internal PermissionsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string scheduleDefinitionId, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) + if (scheduleDefinitionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); } - if (resourceGroupName != null) + if (Client.ApiVersion == null) { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } 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; @@ -113,20 +104,24 @@ internal PermissionsOperations(AuthorizationManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListForResourceGroup", 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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("$filter={0}", filter)); } if (_queryParameters.Count > 0) { @@ -188,11 +183,11 @@ internal PermissionsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -216,7 +211,7 @@ internal PermissionsOperations(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")) @@ -229,7 +224,7 @@ internal PermissionsOperations(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) { @@ -249,22 +244,13 @@ internal PermissionsOperations(AuthorizationManagementClient client) } /// - /// Gets all permissions the caller has for a resource. + /// Get access review instances /// - /// - /// 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 id of the access review schedule definition. /// - /// - /// The name of the resource to get the permissions for. + /// + /// The id of the access review instance. /// /// /// Headers that will be added to request. @@ -272,7 +258,7 @@ internal PermissionsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -287,51 +273,24 @@ internal PermissionsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetByIdWithHttpMessagesAsync(string scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) + if (scheduleDefinitionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); } - if (resourceGroupName != null) + if (id == null) { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } + throw new ValidationException(ValidationRules.CannotBeNull, "id"); } - if (resourceProviderNamespace == null) + if (Client.ApiVersion == 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"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } 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; @@ -339,28 +298,21 @@ internal PermissionsOperations(AuthorizationManagementClient client) { _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("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("id", id); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListForResource", 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("/") ? "" : "/")), "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)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -422,11 +374,11 @@ internal PermissionsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -450,7 +402,7 @@ internal PermissionsOperations(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")) @@ -463,7 +415,7 @@ internal PermissionsOperations(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) { @@ -483,10 +435,16 @@ internal PermissionsOperations(AuthorizationManagementClient client) } /// - /// Gets all permissions the caller has for a resource group. + /// Update access review instance. /// - /// - /// The NextLink from the previous successful call to List operation. + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// Access review instance properties. /// /// /// Headers that will be added to request. @@ -494,7 +452,7 @@ internal PermissionsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -509,11 +467,27 @@ internal PermissionsOperations(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> CreateWithHttpMessagesAsync(string scheduleDefinitionId, string id, AccessReviewInstanceProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (nextPageLink == null) + if (scheduleDefinitionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -522,14 +496,23 @@ internal PermissionsOperations(AuthorizationManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("id", id); + tracingParameters.Add("properties", properties); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListForResourceGroupNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); } // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -537,7 +520,7 @@ internal PermissionsOperations(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) @@ -568,6 +551,12 @@ internal PermissionsOperations(AuthorizationManagementClient client) // Serialize Request string _requestContent = null; + if(properties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(properties, 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) { @@ -590,11 +579,11 @@ internal PermissionsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -618,7 +607,7 @@ internal PermissionsOperations(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")) @@ -631,7 +620,7 @@ internal PermissionsOperations(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) { @@ -651,7 +640,7 @@ internal PermissionsOperations(AuthorizationManagementClient client) } /// - /// Gets all permissions the caller has for a resource. + /// Get access review instances /// /// /// The NextLink from the previous successful call to List operation. @@ -662,7 +651,7 @@ internal PermissionsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -677,7 +666,7 @@ internal PermissionsOperations(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) { @@ -692,7 +681,7 @@ internal PermissionsOperations(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}"; @@ -758,11 +747,11 @@ internal PermissionsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -786,7 +775,7 @@ internal PermissionsOperations(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")) @@ -799,7 +788,7 @@ internal PermissionsOperations(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) { diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesOperationsExtensions.cs new file mode 100644 index 000000000000..c9d00e49f867 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesOperationsExtensions.cs @@ -0,0 +1,191 @@ +// +// 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 AccessReviewInstancesOperations. + /// + public static partial class AccessReviewInstancesOperationsExtensions + { + /// + /// Get access review instances + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned + /// + public static IPage List(this IAccessReviewInstancesOperations operations, string scheduleDefinitionId, string filter = default(string)) + { + return operations.ListAsync(scheduleDefinitionId, filter).GetAwaiter().GetResult(); + } + + /// + /// Get access review instances + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAccessReviewInstancesOperations operations, string scheduleDefinitionId, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scheduleDefinitionId, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get access review instances + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + public static AccessReviewInstance GetById(this IAccessReviewInstancesOperations operations, string scheduleDefinitionId, string id) + { + return operations.GetByIdAsync(scheduleDefinitionId, id).GetAwaiter().GetResult(); + } + + /// + /// Get access review instances + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The cancellation token. + /// + public static async Task GetByIdAsync(this IAccessReviewInstancesOperations operations, string scheduleDefinitionId, string id, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByIdWithHttpMessagesAsync(scheduleDefinitionId, id, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update access review instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// Access review instance properties. + /// + public static AccessReviewInstance Create(this IAccessReviewInstancesOperations operations, string scheduleDefinitionId, string id, AccessReviewInstanceProperties properties) + { + return operations.CreateAsync(scheduleDefinitionId, id, properties).GetAwaiter().GetResult(); + } + + /// + /// Update access review instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// Access review instance properties. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IAccessReviewInstancesOperations operations, string scheduleDefinitionId, string id, AccessReviewInstanceProperties properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(scheduleDefinitionId, id, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get access review instances + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IAccessReviewInstancesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get access review instances + /// + /// + /// 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 IAccessReviewInstancesOperations 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/AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations.cs new file mode 100644 index 000000000000..3867baa7c0f3 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations.cs @@ -0,0 +1,401 @@ +// +// 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; + + /// + /// AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations operations. + /// + internal partial class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations : IServiceOperations, IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations + { + /// + /// Initializes a new instance of the AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations(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 access review instances assigned for my approval. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned + /// + /// + /// 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 filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("filter", filter); + 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/accessReviewScheduleDefinitions").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", filter)); + } + 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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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 access review instances assigned for my approval. + /// + /// + /// 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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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/AccessReviewScheduleDefinitionsAssignedForMyApprovalOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsAssignedForMyApprovalOperationsExtensions.cs new file mode 100644 index 000000000000..4b42e4c3699c --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsAssignedForMyApprovalOperationsExtensions.cs @@ -0,0 +1,99 @@ +// +// 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 AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations. + /// + public static partial class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperationsExtensions + { + /// + /// Get access review instances assigned for my approval. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned + /// + public static IPage List(this IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations operations, string filter = default(string)) + { + return operations.ListAsync(filter).GetAwaiter().GetResult(); + } + + /// + /// Get access review instances assigned for my approval. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get access review instances assigned for my approval. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get access review instances assigned for my approval. + /// + /// + /// 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 IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations 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/RoleDefinitionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsOperations.cs similarity index 76% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleDefinitionsOperations.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsOperations.cs index 2b7b41d5a6e9..ce3b12e8a3a0 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleDefinitionsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsOperations.cs @@ -12,7 +12,6 @@ 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; @@ -24,12 +23,12 @@ namespace Microsoft.Azure.Management.Authorization using System.Threading.Tasks; /// - /// RoleDefinitionsOperations operations. + /// AccessReviewScheduleDefinitionsOperations operations. /// - internal partial class RoleDefinitionsOperations : IServiceOperations, IRoleDefinitionsOperations + internal partial class AccessReviewScheduleDefinitionsOperations : IServiceOperations, IAccessReviewScheduleDefinitionsOperations { /// - /// Initializes a new instance of the RoleDefinitionsOperations class. + /// Initializes a new instance of the AccessReviewScheduleDefinitionsOperations class. /// /// /// Reference to the service client. @@ -37,7 +36,7 @@ internal partial class RoleDefinitionsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal RoleDefinitionsOperations(AuthorizationManagementClient client) + internal AccessReviewScheduleDefinitionsOperations(AuthorizationManagementClient client) { if (client == null) { @@ -52,13 +51,13 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) public AuthorizationManagementClient Client { get; private set; } /// - /// Deletes a role definition. + /// Get access review schedule definitions /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition to delete. + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned /// /// /// Headers that will be added to request. @@ -66,7 +65,7 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -81,17 +80,16 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) /// /// 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)) + public async Task>> ListWithHttpMessagesAsync(string filter = 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 (roleDefinitionId == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "roleDefinitionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-01-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -99,21 +97,22 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("scope", scope); - tracingParameters.Add("roleDefinitionId", roleDefinitionId); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("filter", filter); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}").ToString(); - _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{roleDefinitionId}", System.Uri.EscapeDataString(roleDefinitionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("$filter={0}", filter)); } if (_queryParameters.Count > 0) { @@ -122,7 +121,7 @@ internal RoleDefinitionsOperations(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) @@ -173,13 +172,13 @@ internal RoleDefinitionsOperations(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)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -203,7 +202,7 @@ internal RoleDefinitionsOperations(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")) @@ -216,7 +215,7 @@ internal RoleDefinitionsOperations(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) { @@ -236,13 +235,10 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) } /// - /// Get role definition by name (GUID). + /// Get single access review definition /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition. + /// + /// The id of the access review schedule definition. /// /// /// Headers that will be added to request. @@ -250,7 +246,7 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -265,17 +261,20 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) /// /// 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)) + public async Task> GetByIdWithHttpMessagesAsync(string scheduleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (scope == null) + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (roleDefinitionId == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "roleDefinitionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-01-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -283,21 +282,19 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("scope", scope); - tracingParameters.Add("roleDefinitionId", roleDefinitionId); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}").ToString(); - _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{roleDefinitionId}", System.Uri.EscapeDataString(roleDefinitionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -359,11 +356,11 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -387,7 +384,7 @@ internal RoleDefinitionsOperations(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")) @@ -400,7 +397,7 @@ internal RoleDefinitionsOperations(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) { @@ -420,16 +417,10 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) } /// - /// Creates or updates a role definition. + /// Delete access review schedule definition /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition. - /// - /// - /// The values for the role definition. + /// + /// The id of the access review schedule definition. /// /// /// Headers that will be added to request. @@ -437,12 +428,9 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) /// /// 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 /// @@ -452,21 +440,20 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) /// /// 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)) + public async Task DeleteByIdWithHttpMessagesAsync(string scheduleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (scope == null) + if (scheduleDefinitionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); } - if (roleDefinitionId == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "roleDefinitionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (roleDefinition == null) + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "roleDefinition"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-01-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -474,22 +461,19 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) { _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("scheduleDefinitionId", scheduleDefinitionId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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/roleDefinitions/{roleDefinitionId}").ToString(); - _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{roleDefinitionId}", System.Uri.EscapeDataString(roleDefinitionId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -498,7 +482,7 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -529,12 +513,6 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) // 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) { @@ -555,13 +533,13 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -585,31 +563,13 @@ internal RoleDefinitionsOperations(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")) { _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); @@ -618,13 +578,13 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) } /// - /// Get all role definitions that are applicable at scope and above. + /// Create or Update access review schedule definition. /// - /// - /// The scope of the role definition. + /// + /// The id of the access review schedule definition. /// - /// - /// OData parameters to apply to the operation. + /// + /// Access review schedule definition properties. /// /// /// Headers that will be added to request. @@ -632,7 +592,7 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -647,13 +607,24 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) /// /// 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)) + public async Task> CreateOrUpdateByIdWithHttpMessagesAsync(string scheduleDefinitionId, AccessReviewScheduleDefinitionProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (scope == null) + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (properties == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-01-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -661,28 +632,20 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("scope", scope); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("properties", properties); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateById", 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); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (odataQuery != null) + if (Client.ApiVersion != 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))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -691,7 +654,7 @@ internal RoleDefinitionsOperations(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) @@ -722,6 +685,12 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) // Serialize Request string _requestContent = null; + if(properties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(properties, 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) { @@ -744,11 +713,11 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -772,7 +741,7 @@ internal RoleDefinitionsOperations(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")) @@ -785,7 +754,7 @@ internal RoleDefinitionsOperations(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) { @@ -805,14 +774,10 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) } /// - /// Gets a role definition by ID. + /// Stop access review definition /// - /// - /// 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 id of the access review schedule definition. /// /// /// Headers that will be added to request. @@ -820,12 +785,9 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) /// /// 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 /// @@ -835,13 +797,20 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetByIdWithHttpMessagesAsync(string roleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task StopWithHttpMessagesAsync(string scheduleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (roleId == null) + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "roleId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-01-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -849,19 +818,19 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("roleId", roleId); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetById", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Stop", 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); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -870,7 +839,7 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -921,13 +890,13 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 204) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -951,31 +920,13 @@ internal RoleDefinitionsOperations(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")) { _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); @@ -984,7 +935,7 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) } /// - /// Get all role definitions that are applicable at scope and above. + /// Get access review schedule definitions /// /// /// The NextLink from the previous successful call to List operation. @@ -995,7 +946,7 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1010,7 +961,7 @@ internal RoleDefinitionsOperations(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) { @@ -1091,11 +1042,11 @@ internal RoleDefinitionsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -1119,7 +1070,7 @@ internal RoleDefinitionsOperations(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")) @@ -1132,7 +1083,7 @@ internal RoleDefinitionsOperations(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) { diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsOperationsExtensions.cs new file mode 100644 index 000000000000..25a0792cd9cb --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsOperationsExtensions.cs @@ -0,0 +1,235 @@ +// +// 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 AccessReviewScheduleDefinitionsOperations. + /// + public static partial class AccessReviewScheduleDefinitionsOperationsExtensions + { + /// + /// Get access review schedule definitions + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned + /// + public static IPage List(this IAccessReviewScheduleDefinitionsOperations operations, string filter = default(string)) + { + return operations.ListAsync(filter).GetAwaiter().GetResult(); + } + + /// + /// Get access review schedule definitions + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter to apply on the operation. Other than standard filters, one + /// custom filter option is supported : 'assignedToMeToReview()'. When one + /// specified $filter=assignedToMeToReview(), only items that are assigned to + /// the calling user to review are returned + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAccessReviewScheduleDefinitionsOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get single access review definition + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + public static AccessReviewScheduleDefinition GetById(this IAccessReviewScheduleDefinitionsOperations operations, string scheduleDefinitionId) + { + return operations.GetByIdAsync(scheduleDefinitionId).GetAwaiter().GetResult(); + } + + /// + /// Get single access review definition + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The cancellation token. + /// + public static async Task GetByIdAsync(this IAccessReviewScheduleDefinitionsOperations operations, string scheduleDefinitionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByIdWithHttpMessagesAsync(scheduleDefinitionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete access review schedule definition + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + public static void DeleteById(this IAccessReviewScheduleDefinitionsOperations operations, string scheduleDefinitionId) + { + operations.DeleteByIdAsync(scheduleDefinitionId).GetAwaiter().GetResult(); + } + + /// + /// Delete access review schedule definition + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteByIdAsync(this IAccessReviewScheduleDefinitionsOperations operations, string scheduleDefinitionId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteByIdWithHttpMessagesAsync(scheduleDefinitionId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create or Update access review schedule definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// Access review schedule definition properties. + /// + public static AccessReviewScheduleDefinition CreateOrUpdateById(this IAccessReviewScheduleDefinitionsOperations operations, string scheduleDefinitionId, AccessReviewScheduleDefinitionProperties properties) + { + return operations.CreateOrUpdateByIdAsync(scheduleDefinitionId, properties).GetAwaiter().GetResult(); + } + + /// + /// Create or Update access review schedule definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// Access review schedule definition properties. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateByIdAsync(this IAccessReviewScheduleDefinitionsOperations operations, string scheduleDefinitionId, AccessReviewScheduleDefinitionProperties properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateByIdWithHttpMessagesAsync(scheduleDefinitionId, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Stop access review definition + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + public static void Stop(this IAccessReviewScheduleDefinitionsOperations operations, string scheduleDefinitionId) + { + operations.StopAsync(scheduleDefinitionId).GetAwaiter().GetResult(); + } + + /// + /// Stop access review definition + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The cancellation token. + /// + public static async Task StopAsync(this IAccessReviewScheduleDefinitionsOperations operations, string scheduleDefinitionId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.StopWithHttpMessagesAsync(scheduleDefinitionId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get access review schedule definitions + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IAccessReviewScheduleDefinitionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get access review schedule definitions + /// + /// + /// 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 IAccessReviewScheduleDefinitionsOperations 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/AuthorizationManagementClient.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AuthorizationManagementClient.cs index b01a18622e16..cad3b30c9ed4 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,10 @@ namespace Microsoft.Azure.Management.Authorization using System.Net; using System.Net.Http; + /// + /// Access reviews service provides the workflow for running access reviews + /// on different kind of resources. + /// public partial class AuthorizationManagementClient : ServiceClient, IAuthorizationManagementClient, IAzureClient { /// @@ -48,6 +52,11 @@ public partial class AuthorizationManagementClient : ServiceClient public string SubscriptionId { get; set; } + /// + /// The API version to be used with the HTTP request. + /// + public string ApiVersion { get; private set; } + /// /// The preferred language for the response. /// @@ -67,44 +76,79 @@ public partial class AuthorizationManagementClient : ServiceClient - /// Gets the IClassicAdministratorsOperations. + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IAccessReviewHistoryDefinitionsOperations. + /// + public virtual IAccessReviewHistoryDefinitionsOperations AccessReviewHistoryDefinitions { get; private set; } + + /// + /// Gets the IAccessReviewHistoryDefinitionOperations. + /// + public virtual IAccessReviewHistoryDefinitionOperations AccessReviewHistoryDefinition { get; private set; } + + /// + /// Gets the IAccessReviewHistoryDefinitionInstanceOperations. + /// + public virtual IAccessReviewHistoryDefinitionInstanceOperations AccessReviewHistoryDefinitionInstance { get; private set; } + + /// + /// Gets the IAccessReviewHistoryDefinitionInstancesOperations. + /// + public virtual IAccessReviewHistoryDefinitionInstancesOperations AccessReviewHistoryDefinitionInstances { get; private set; } + + /// + /// Gets the IAccessReviewScheduleDefinitionsOperations. + /// + public virtual IAccessReviewScheduleDefinitionsOperations AccessReviewScheduleDefinitions { get; private set; } + + /// + /// Gets the IAccessReviewInstancesOperations. + /// + public virtual IAccessReviewInstancesOperations AccessReviewInstances { get; private set; } + + /// + /// Gets the IAccessReviewInstanceOperations. /// - public virtual IClassicAdministratorsOperations ClassicAdministrators { get; private set; } + public virtual IAccessReviewInstanceOperations AccessReviewInstance { get; private set; } /// - /// Gets the IGlobalAdministratorOperations. + /// Gets the IAccessReviewInstanceDecisionsOperations. /// - public virtual IGlobalAdministratorOperations GlobalAdministrator { get; private set; } + public virtual IAccessReviewInstanceDecisionsOperations AccessReviewInstanceDecisions { get; private set; } /// - /// Gets the IProviderOperationsMetadataOperations. + /// Gets the IAccessReviewInstanceContactedReviewersOperations. /// - public virtual IProviderOperationsMetadataOperations ProviderOperationsMetadata { get; private set; } + public virtual IAccessReviewInstanceContactedReviewersOperations AccessReviewInstanceContactedReviewers { get; private set; } /// - /// Gets the IPermissionsOperations. + /// Gets the IAccessReviewDefaultSettingsOperations. /// - public virtual IPermissionsOperations Permissions { get; private set; } + public virtual IAccessReviewDefaultSettingsOperations AccessReviewDefaultSettings { get; private set; } /// - /// Gets the IRoleDefinitionsOperations. + /// Gets the IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations. /// - public virtual IRoleDefinitionsOperations RoleDefinitions { get; private set; } + public virtual IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations AccessReviewScheduleDefinitionsAssignedForMyApproval { get; private set; } /// - /// Gets the IDenyAssignmentsOperations. + /// Gets the IAccessReviewInstancesAssignedForMyApprovalOperations. /// - public virtual IDenyAssignmentsOperations DenyAssignments { get; private set; } + public virtual IAccessReviewInstancesAssignedForMyApprovalOperations AccessReviewInstancesAssignedForMyApproval { get; private set; } /// - /// Gets the IRoleAssignmentMetricsOperations. + /// Gets the IAccessReviewInstanceMyDecisionsOperations. /// - public virtual IRoleAssignmentMetricsOperations RoleAssignmentMetrics { get; private set; } + public virtual IAccessReviewInstanceMyDecisionsOperations AccessReviewInstanceMyDecisions { get; private set; } /// - /// Gets the IRoleAssignmentsOperations. + /// Gets the ITenantLevelAccessReviewInstanceContactedReviewersOperations. /// - public virtual IRoleAssignmentsOperations RoleAssignments { get; private set; } + public virtual ITenantLevelAccessReviewInstanceContactedReviewersOperations TenantLevelAccessReviewInstanceContactedReviewers { get; private set; } /// /// Initializes a new instance of the AuthorizationManagementClient class. @@ -347,15 +391,23 @@ 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); + Operations = new Operations(this); + AccessReviewHistoryDefinitions = new AccessReviewHistoryDefinitionsOperations(this); + AccessReviewHistoryDefinition = new AccessReviewHistoryDefinitionOperations(this); + AccessReviewHistoryDefinitionInstance = new AccessReviewHistoryDefinitionInstanceOperations(this); + AccessReviewHistoryDefinitionInstances = new AccessReviewHistoryDefinitionInstancesOperations(this); + AccessReviewScheduleDefinitions = new AccessReviewScheduleDefinitionsOperations(this); + AccessReviewInstances = new AccessReviewInstancesOperations(this); + AccessReviewInstance = new AccessReviewInstanceOperations(this); + AccessReviewInstanceDecisions = new AccessReviewInstanceDecisionsOperations(this); + AccessReviewInstanceContactedReviewers = new AccessReviewInstanceContactedReviewersOperations(this); + AccessReviewDefaultSettings = new AccessReviewDefaultSettingsOperations(this); + AccessReviewScheduleDefinitionsAssignedForMyApproval = new AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations(this); + AccessReviewInstancesAssignedForMyApproval = new AccessReviewInstancesAssignedForMyApprovalOperations(this); + AccessReviewInstanceMyDecisions = new AccessReviewInstanceMyDecisionsOperations(this); + TenantLevelAccessReviewInstanceContactedReviewers = new TenantLevelAccessReviewInstanceContactedReviewersOperations(this); BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2021-11-16-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -385,6 +437,10 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); CustomInitialize(); DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); 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/IAccessReviewDefaultSettingsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewDefaultSettingsOperations.cs new file mode 100644 index 000000000000..e69dd538c4fb --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewDefaultSettingsOperations.cs @@ -0,0 +1,68 @@ +// +// 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; + + /// + /// AccessReviewDefaultSettingsOperations operations. + /// + public partial interface IAccessReviewDefaultSettingsOperations + { + /// + /// Get access review default settings 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> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get access review default settings for the subscription + /// + /// + /// Access review schedule settings. + /// + /// + /// 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> PutWithHttpMessagesAsync(AccessReviewScheduleSettings properties, 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/IAccessReviewHistoryDefinitionInstanceOperations.cs similarity index 57% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentMetricsOperations.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewHistoryDefinitionInstanceOperations.cs index 2ea3b894e4a6..4ba86f69dcdc 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentMetricsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewHistoryDefinitionInstanceOperations.cs @@ -19,20 +19,29 @@ namespace Microsoft.Azure.Management.Authorization using System.Threading.Tasks; /// - /// RoleAssignmentMetricsOperations operations. + /// AccessReviewHistoryDefinitionInstanceOperations operations. /// - public partial interface IRoleAssignmentMetricsOperations + public partial interface IAccessReviewHistoryDefinitionInstanceOperations { /// - /// Get role assignment usage metrics for a subscription + /// Generates a uri which can be used to retrieve review history data. + /// This URI has a TTL of 1 day and can be retrieved by fetching the + /// accessReviewHistoryDefinition object. /// + /// + /// The id of the access review history definition. + /// + /// + /// The id of the access review history definition instance to generate + /// a URI for. + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -41,6 +50,6 @@ public partial interface IRoleAssignmentMetricsOperations /// /// Thrown when a required parameter is null /// - Task> GetMetricsForSubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GenerateDownloadUriWithHttpMessagesAsync(string historyDefinitionId, string instanceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewHistoryDefinitionInstancesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewHistoryDefinitionInstancesOperations.cs new file mode 100644 index 000000000000..f23f97d3fd2e --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewHistoryDefinitionInstancesOperations.cs @@ -0,0 +1,71 @@ +// +// 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; + + /// + /// AccessReviewHistoryDefinitionInstancesOperations operations. + /// + public partial interface IAccessReviewHistoryDefinitionInstancesOperations + { + /// + /// Get access review history definition instances by definition Id + /// + /// + /// The id of the access review history 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>> ListWithHttpMessagesAsync(string historyDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get access review history definition instances by definition Id + /// + /// + /// 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/IAccessReviewHistoryDefinitionOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewHistoryDefinitionOperations.cs new file mode 100644 index 000000000000..22f5d79c582a --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewHistoryDefinitionOperations.cs @@ -0,0 +1,71 @@ +// +// 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; + + /// + /// AccessReviewHistoryDefinitionOperations operations. + /// + public partial interface IAccessReviewHistoryDefinitionOperations + { + /// + /// Create a scheduled or one-time Access Review History Definition + /// + /// + /// The id of the access review history definition. + /// + /// + /// Access review history definition properties. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string historyDefinitionId, AccessReviewHistoryDefinitionProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete an access review history definition + /// + /// + /// The id of the access review history definition. + /// + /// + /// 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 DeleteByIdWithHttpMessagesAsync(string historyDefinitionId, 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/IAccessReviewHistoryDefinitionsOperations.cs similarity index 61% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IProviderOperationsMetadataOperations.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewHistoryDefinitionsOperations.cs index 30e22c3f7d81..006d8f7acde7 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IProviderOperationsMetadataOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewHistoryDefinitionsOperations.cs @@ -19,19 +19,18 @@ namespace Microsoft.Azure.Management.Authorization using System.Threading.Tasks; /// - /// ProviderOperationsMetadataOperations operations. + /// AccessReviewHistoryDefinitionsOperations operations. /// - public partial interface IProviderOperationsMetadataOperations + public partial interface IAccessReviewHistoryDefinitionsOperations { /// - /// Gets provider operations metadata for the specified resource - /// provider. + /// Lists the accessReviewHistoryDefinitions available from this + /// provider, definition instances are only available for 30 days after + /// creation. /// - /// - /// The namespace of the resource provider. - /// - /// - /// Specifies whether to expand the values. + /// + /// The filter to apply on the operation. Only standard filters on + /// definition name and created date are supported /// /// /// The headers that will be added to request. @@ -39,7 +38,7 @@ public partial interface IProviderOperationsMetadataOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -48,12 +47,12 @@ public partial interface IProviderOperationsMetadataOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceProviderNamespace, string expand = "resourceTypes", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets provider operations metadata for all resource providers. + /// Get access review history definition by definition Id /// - /// - /// Specifies whether to expand the values. + /// + /// The id of the access review history definition. /// /// /// The headers that will be added to request. @@ -61,7 +60,7 @@ public partial interface IProviderOperationsMetadataOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -70,9 +69,11 @@ public partial interface IProviderOperationsMetadataOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string expand = "resourceTypes", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByIdWithHttpMessagesAsync(string historyDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets provider operations metadata for all resource providers. + /// Lists the accessReviewHistoryDefinitions available from this + /// provider, definition instances are only available for 30 days after + /// creation. /// /// /// The NextLink from the previous successful call to List operation. @@ -83,7 +84,7 @@ public partial interface IProviderOperationsMetadataOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -92,6 +93,6 @@ public partial interface IProviderOperationsMetadataOperations /// /// 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)); } } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceContactedReviewersOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceContactedReviewersOperations.cs new file mode 100644 index 000000000000..6af3d493e594 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceContactedReviewersOperations.cs @@ -0,0 +1,74 @@ +// +// 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; + + /// + /// AccessReviewInstanceContactedReviewersOperations operations. + /// + public partial interface IAccessReviewInstanceContactedReviewersOperations + { + /// + /// Get access review instance contacted reviewers + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// 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 scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get access review instance contacted reviewers + /// + /// + /// 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/IAccessReviewInstanceDecisionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceDecisionsOperations.cs new file mode 100644 index 000000000000..df2b7e33e81c --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceDecisionsOperations.cs @@ -0,0 +1,80 @@ +// +// 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; + + /// + /// AccessReviewInstanceDecisionsOperations operations. + /// + public partial interface IAccessReviewInstanceDecisionsOperations + { + /// + /// Get access review instance decisions + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The filter to apply on the operation. Other than standard filters, + /// one custom filter option is supported : 'assignedToMeToReview()'. + /// When one specified $filter=assignedToMeToReview(), only items that + /// are assigned to the calling user to review are returned + /// + /// + /// 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 scheduleDefinitionId, string id, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get access review instance decisions + /// + /// + /// 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/IAccessReviewInstanceMyDecisionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceMyDecisionsOperations.cs new file mode 100644 index 000000000000..6938834eea22 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceMyDecisionsOperations.cs @@ -0,0 +1,139 @@ +// +// 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; + + /// + /// AccessReviewInstanceMyDecisionsOperations operations. + /// + public partial interface IAccessReviewInstanceMyDecisionsOperations + { + /// + /// Get my access review instance decisions. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The filter to apply on the operation. Other than standard filters, + /// one custom filter option is supported : 'assignedToMeToReview()'. + /// When one specified $filter=assignedToMeToReview(), only items that + /// are assigned to the calling user to review are returned + /// + /// + /// 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 scheduleDefinitionId, string id, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get my single access review instance decision. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The id of the decision record. + /// + /// + /// 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 scheduleDefinitionId, string id, string decisionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Record a decision. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The id of the decision record. + /// + /// + /// Access review decision properties to patch. + /// + /// + /// 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> PatchWithHttpMessagesAsync(string scheduleDefinitionId, string id, string decisionId, AccessReviewDecisionProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get my access review instance decisions. + /// + /// + /// 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/IAccessReviewInstanceOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceOperations.cs new file mode 100644 index 000000000000..3079aa6b0809 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceOperations.cs @@ -0,0 +1,138 @@ +// +// 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; + + /// + /// AccessReviewInstanceOperations operations. + /// + public partial interface IAccessReviewInstanceOperations + { + /// + /// An action to stop an access review instance. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// 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 StopWithHttpMessagesAsync(string scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// An action to reset all decisions for an access review instance. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// 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 ResetDecisionsWithHttpMessagesAsync(string scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// An action to apply all decisions for an access review instance. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// 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 ApplyDecisionsWithHttpMessagesAsync(string scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// An action to send reminders for an access review instance. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// 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 SendRemindersWithHttpMessagesAsync(string scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// An action to accept recommendations for decision in an access + /// review instance. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// 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 AcceptRecommendationsWithHttpMessagesAsync(string scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstancesAssignedForMyApprovalOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstancesAssignedForMyApprovalOperations.cs new file mode 100644 index 000000000000..67e86520c6d3 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstancesAssignedForMyApprovalOperations.cs @@ -0,0 +1,102 @@ +// +// 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; + + /// + /// AccessReviewInstancesAssignedForMyApprovalOperations operations. + /// + public partial interface IAccessReviewInstancesAssignedForMyApprovalOperations + { + /// + /// Get access review instances assigned for my approval. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The filter to apply on the operation. Other than standard filters, + /// one custom filter option is supported : 'assignedToMeToReview()'. + /// When one specified $filter=assignedToMeToReview(), only items that + /// are assigned to the calling user to review are returned + /// + /// + /// 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 scheduleDefinitionId, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get single access review instance assigned for my approval. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// 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 scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get access review instances assigned for my approval. + /// + /// + /// 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/IPermissionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstancesOperations.cs similarity index 59% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IPermissionsOperations.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstancesOperations.cs index aecc8912990f..7b52d61a1762 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IPermissionsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstancesOperations.cs @@ -19,15 +19,21 @@ namespace Microsoft.Azure.Management.Authorization using System.Threading.Tasks; /// - /// PermissionsOperations operations. + /// AccessReviewInstancesOperations operations. /// - public partial interface IPermissionsOperations + public partial interface IAccessReviewInstancesOperations { /// - /// Gets all permissions the caller has for a resource group. + /// Get access review instances /// - /// - /// The name of the resource group. The name is case insensitive. + /// + /// The id of the access review schedule definition. + /// + /// + /// The filter to apply on the operation. Other than standard filters, + /// one custom filter option is supported : 'assignedToMeToReview()'. + /// When one specified $filter=assignedToMeToReview(), only items that + /// are assigned to the calling user to review are returned /// /// /// The headers that will be added to request. @@ -35,7 +41,7 @@ public partial interface IPermissionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -44,24 +50,15 @@ public partial interface IPermissionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string scheduleDefinitionId, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets all permissions the caller has for a resource. + /// Get access review instances /// - /// - /// 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 id of the access review schedule definition. /// - /// - /// The name of the resource to get the permissions for. + /// + /// The id of the access review instance. /// /// /// The headers that will be added to request. @@ -69,7 +66,7 @@ public partial interface IPermissionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -78,12 +75,18 @@ public partial interface IPermissionsOperations /// /// 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)); + Task> GetByIdWithHttpMessagesAsync(string scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets all permissions the caller has for a resource group. + /// Update access review instance. /// - /// - /// The NextLink from the previous successful call to List operation. + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// Access review instance properties. /// /// /// The headers that will be added to request. @@ -91,7 +94,7 @@ public partial interface IPermissionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -100,9 +103,9 @@ public partial interface IPermissionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListForResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateWithHttpMessagesAsync(string scheduleDefinitionId, string id, AccessReviewInstanceProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets all permissions the caller has for a resource. + /// Get access review instances /// /// /// The NextLink from the previous successful call to List operation. @@ -113,7 +116,7 @@ public partial interface IPermissionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -122,6 +125,6 @@ public partial interface IPermissionsOperations /// /// 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)); } } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations.cs new file mode 100644 index 000000000000..719d895d527e --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations.cs @@ -0,0 +1,74 @@ +// +// 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; + + /// + /// AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations operations. + /// + public partial interface IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations + { + /// + /// Get access review instances assigned for my approval. + /// + /// + /// The filter to apply on the operation. Other than standard filters, + /// one custom filter option is supported : 'assignedToMeToReview()'. + /// When one specified $filter=assignedToMeToReview(), only items that + /// are assigned to the calling user to review are returned + /// + /// + /// 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 filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get access review instances assigned for my approval. + /// + /// + /// 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/IRoleDefinitionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewScheduleDefinitionsOperations.cs similarity index 54% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleDefinitionsOperations.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewScheduleDefinitionsOperations.cs index f80bcbddb181..198fffc41483 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleDefinitionsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewScheduleDefinitionsOperations.cs @@ -12,7 +12,6 @@ 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; @@ -20,18 +19,18 @@ namespace Microsoft.Azure.Management.Authorization using System.Threading.Tasks; /// - /// RoleDefinitionsOperations operations. + /// AccessReviewScheduleDefinitionsOperations operations. /// - public partial interface IRoleDefinitionsOperations + public partial interface IAccessReviewScheduleDefinitionsOperations { /// - /// Deletes a role definition. + /// Get access review schedule definitions /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition to delete. + /// + /// The filter to apply on the operation. Other than standard filters, + /// one custom filter option is supported : 'assignedToMeToReview()'. + /// When one specified $filter=assignedToMeToReview(), only items that + /// are assigned to the calling user to review are returned /// /// /// The headers that will be added to request. @@ -39,7 +38,7 @@ public partial interface IRoleDefinitionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -48,15 +47,12 @@ public partial interface IRoleDefinitionsOperations /// /// Thrown when a required parameter is null /// - Task> DeleteWithHttpMessagesAsync(string scope, string roleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get role definition by name (GUID). + /// Get single access review definition /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition. + /// + /// The id of the access review schedule definition. /// /// /// The headers that will be added to request. @@ -64,7 +60,7 @@ public partial interface IRoleDefinitionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -73,18 +69,12 @@ public partial interface IRoleDefinitionsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string scope, string roleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetByIdWithHttpMessagesAsync(string scheduleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates or updates a role definition. + /// Delete access review schedule definition /// - /// - /// The scope of the role definition. - /// - /// - /// The ID of the role definition. - /// - /// - /// The values for the role definition. + /// + /// The id of the access review schedule definition. /// /// /// The headers that will be added to request. @@ -92,24 +82,21 @@ public partial interface IRoleDefinitionsOperations /// /// 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)); + Task DeleteByIdWithHttpMessagesAsync(string scheduleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get all role definitions that are applicable at scope and above. + /// Create or Update access review schedule definition. /// - /// - /// The scope of the role definition. + /// + /// The id of the access review schedule definition. /// - /// - /// OData parameters to apply to the operation. + /// + /// Access review schedule definition properties. /// /// /// The headers that will be added to request. @@ -117,7 +104,7 @@ public partial interface IRoleDefinitionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -126,16 +113,12 @@ public partial interface IRoleDefinitionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateByIdWithHttpMessagesAsync(string scheduleDefinitionId, AccessReviewScheduleDefinitionProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a role definition by ID. + /// Stop access review definition /// - /// - /// 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 id of the access review schedule definition. /// /// /// The headers that will be added to request. @@ -143,18 +126,15 @@ public partial interface IRoleDefinitionsOperations /// /// 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)); + Task StopWithHttpMessagesAsync(string scheduleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get all role definitions that are applicable at scope and above. + /// Get access review schedule definitions /// /// /// The NextLink from the previous successful call to List operation. @@ -165,7 +145,7 @@ public partial interface IRoleDefinitionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -174,6 +154,6 @@ public partial interface IRoleDefinitionsOperations /// /// 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)); } } 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..74dfa01992fa 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,8 @@ namespace Microsoft.Azure.Management.Authorization using Newtonsoft.Json; /// + /// Access reviews service provides the workflow for running access reviews + /// on different kind of resources. /// public partial interface IAuthorizationManagementClient : System.IDisposable { @@ -44,6 +46,11 @@ public partial interface IAuthorizationManagementClient : System.IDisposable /// string SubscriptionId { get; set; } + /// + /// The API version to be used with the HTTP request. + /// + string ApiVersion { get; } + /// /// The preferred language for the response. /// @@ -64,44 +71,79 @@ public partial interface IAuthorizationManagementClient : System.IDisposable /// - /// Gets the IClassicAdministratorsOperations. + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IAccessReviewHistoryDefinitionsOperations. + /// + IAccessReviewHistoryDefinitionsOperations AccessReviewHistoryDefinitions { get; } + + /// + /// Gets the IAccessReviewHistoryDefinitionOperations. + /// + IAccessReviewHistoryDefinitionOperations AccessReviewHistoryDefinition { get; } + + /// + /// Gets the IAccessReviewHistoryDefinitionInstanceOperations. + /// + IAccessReviewHistoryDefinitionInstanceOperations AccessReviewHistoryDefinitionInstance { get; } + + /// + /// Gets the IAccessReviewHistoryDefinitionInstancesOperations. + /// + IAccessReviewHistoryDefinitionInstancesOperations AccessReviewHistoryDefinitionInstances { get; } + + /// + /// Gets the IAccessReviewScheduleDefinitionsOperations. + /// + IAccessReviewScheduleDefinitionsOperations AccessReviewScheduleDefinitions { get; } + + /// + /// Gets the IAccessReviewInstancesOperations. + /// + IAccessReviewInstancesOperations AccessReviewInstances { get; } + + /// + /// Gets the IAccessReviewInstanceOperations. /// - IClassicAdministratorsOperations ClassicAdministrators { get; } + IAccessReviewInstanceOperations AccessReviewInstance { get; } /// - /// Gets the IGlobalAdministratorOperations. + /// Gets the IAccessReviewInstanceDecisionsOperations. /// - IGlobalAdministratorOperations GlobalAdministrator { get; } + IAccessReviewInstanceDecisionsOperations AccessReviewInstanceDecisions { get; } /// - /// Gets the IProviderOperationsMetadataOperations. + /// Gets the IAccessReviewInstanceContactedReviewersOperations. /// - IProviderOperationsMetadataOperations ProviderOperationsMetadata { get; } + IAccessReviewInstanceContactedReviewersOperations AccessReviewInstanceContactedReviewers { get; } /// - /// Gets the IPermissionsOperations. + /// Gets the IAccessReviewDefaultSettingsOperations. /// - IPermissionsOperations Permissions { get; } + IAccessReviewDefaultSettingsOperations AccessReviewDefaultSettings { get; } /// - /// Gets the IRoleDefinitionsOperations. + /// Gets the IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations. /// - IRoleDefinitionsOperations RoleDefinitions { get; } + IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations AccessReviewScheduleDefinitionsAssignedForMyApproval { get; } /// - /// Gets the IDenyAssignmentsOperations. + /// Gets the IAccessReviewInstancesAssignedForMyApprovalOperations. /// - IDenyAssignmentsOperations DenyAssignments { get; } + IAccessReviewInstancesAssignedForMyApprovalOperations AccessReviewInstancesAssignedForMyApproval { get; } /// - /// Gets the IRoleAssignmentMetricsOperations. + /// Gets the IAccessReviewInstanceMyDecisionsOperations. /// - IRoleAssignmentMetricsOperations RoleAssignmentMetrics { get; } + IAccessReviewInstanceMyDecisionsOperations AccessReviewInstanceMyDecisions { get; } /// - /// Gets the IRoleAssignmentsOperations. + /// Gets the ITenantLevelAccessReviewInstanceContactedReviewersOperations. /// - IRoleAssignmentsOperations RoleAssignments { get; } + ITenantLevelAccessReviewInstanceContactedReviewersOperations TenantLevelAccessReviewInstanceContactedReviewers { get; } } } 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/IClassicAdministratorsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IOperations.cs similarity index 69% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IClassicAdministratorsOperations.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IOperations.cs index 11e82ae50a1f..2b486b19a9b5 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IClassicAdministratorsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IOperations.cs @@ -19,13 +19,12 @@ namespace Microsoft.Azure.Management.Authorization using System.Threading.Tasks; /// - /// ClassicAdministratorsOperations operations. + /// Operations operations. /// - public partial interface IClassicAdministratorsOperations + public partial interface IOperations { /// - /// Gets service administrator, account administrator, and - /// co-administrators for the subscription. + /// Lists the operations available from this provider. /// /// /// The headers that will be added to request. @@ -33,7 +32,7 @@ public partial interface IClassicAdministratorsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -42,10 +41,9 @@ public partial interface IClassicAdministratorsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets service administrator, account administrator, and - /// co-administrators for the subscription. + /// Lists the operations available from this provider. /// /// /// The NextLink from the previous successful call to List operation. @@ -56,7 +54,7 @@ public partial interface IClassicAdministratorsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -65,6 +63,6 @@ public partial interface IClassicAdministratorsOperations /// /// 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)); } } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentsOperations.cs deleted file mode 100644 index 4e479bf0825e..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentsOperations.cs +++ /dev/null @@ -1,489 +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; - - /// - /// RoleAssignmentsOperations operations. - /// - public partial interface IRoleAssignmentsOperations - { - /// - /// List all role assignments that apply to a subscription. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// Tenant ID for cross-tenant request - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// 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. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// Tenant ID for cross-tenant request - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// 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)); - /// - /// List all role assignments that apply to a resource. - /// - /// - /// 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 - /// - /// - /// 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 resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get 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 - /// - /// - /// 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 roleAssignmentName, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create or update 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. - /// - /// - /// 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> CreateWithHttpMessagesAsync(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// 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 - /// - /// - /// 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 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)); - /// - /// List all role assignments that apply to a scope. - /// - /// - /// 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. - /// - /// - /// Tenant ID for cross-tenant request - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// 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)); - /// - /// Get 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> - /// - /// - /// Tenant ID for cross-tenant request - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetByIdWithHttpMessagesAsync(string roleAssignmentId, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create or update 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> - /// - /// - /// 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> CreateByIdWithHttpMessagesAsync(string roleAssignmentId, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete 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> - /// - /// - /// Tenant ID for cross-tenant request - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> DeleteByIdWithHttpMessagesAsync(string roleAssignmentId, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Validate a role assignment create or update operation 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> - /// - /// - /// 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> ValidateByIdWithHttpMessagesAsync(string roleAssignmentId, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List all role assignments that apply to a 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>> ListForSubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List all role assignments that apply to 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)); - /// - /// List all role assignments that apply to 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)); - /// - /// List all role assignments that apply to 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/ITenantLevelAccessReviewInstanceContactedReviewersOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ITenantLevelAccessReviewInstanceContactedReviewersOperations.cs new file mode 100644 index 000000000000..95c5962f1591 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ITenantLevelAccessReviewInstanceContactedReviewersOperations.cs @@ -0,0 +1,74 @@ +// +// 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; + + /// + /// TenantLevelAccessReviewInstanceContactedReviewersOperations operations. + /// + public partial interface ITenantLevelAccessReviewInstanceContactedReviewersOperations + { + /// + /// Get access review instance contacted reviewers + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// 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 scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get access review instance contacted reviewers + /// + /// + /// 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/AccessRecommendationType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessRecommendationType.cs new file mode 100644 index 000000000000..e23816e94413 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessRecommendationType.cs @@ -0,0 +1,23 @@ +// +// 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 +{ + + /// + /// Defines values for AccessRecommendationType. + /// + public static class AccessRecommendationType + { + public const string Approve = "Approve"; + public const string Deny = "Deny"; + public const string NoInfoAvailable = "NoInfoAvailable"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewActorIdentityType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewActorIdentityType.cs new file mode 100644 index 000000000000..e85e3439b4ce --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewActorIdentityType.cs @@ -0,0 +1,22 @@ +// +// 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 +{ + + /// + /// Defines values for AccessReviewActorIdentityType. + /// + public static class AccessReviewActorIdentityType + { + public const string User = "user"; + public const string ServicePrincipal = "servicePrincipal"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewApplyResult.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewApplyResult.cs new file mode 100644 index 000000000000..b1d3ed143f19 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewApplyResult.cs @@ -0,0 +1,26 @@ +// +// 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 +{ + + /// + /// Defines values for AccessReviewApplyResult. + /// + public static class AccessReviewApplyResult + { + public const string New = "New"; + public const string Applying = "Applying"; + public const string AppliedSuccessfully = "AppliedSuccessfully"; + public const string AppliedWithUnknownFailure = "AppliedWithUnknownFailure"; + public const string AppliedSuccessfullyButObjectNotFound = "AppliedSuccessfullyButObjectNotFound"; + public const string ApplyNotSupported = "ApplyNotSupported"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewContactedReviewer.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewContactedReviewer.cs new file mode 100644 index 000000000000..adceb35a827b --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewContactedReviewer.cs @@ -0,0 +1,100 @@ +// +// 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.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Access Review Contacted Reviewer. + /// + [Rest.Serialization.JsonTransformation] + public partial class AccessReviewContactedReviewer : IResource + { + /// + /// Initializes a new instance of the AccessReviewContactedReviewer + /// class. + /// + public AccessReviewContactedReviewer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessReviewContactedReviewer + /// class. + /// + /// The access review reviewer id. + /// The access review reviewer id. + /// The resource type. + /// The display name of the + /// reviewer + /// The user principal name of the + /// reviewer + /// Date Time when the reviewer was + /// contacted. + public AccessReviewContactedReviewer(string id = default(string), string name = default(string), string type = default(string), string userDisplayName = default(string), string userPrincipalName = default(string), System.DateTime? createdDateTime = default(System.DateTime?)) + { + Id = id; + Name = name; + Type = type; + UserDisplayName = userDisplayName; + UserPrincipalName = userPrincipalName; + CreatedDateTime = createdDateTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the access review reviewer id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the access review reviewer id. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the display name of the reviewer + /// + [JsonProperty(PropertyName = "properties.userDisplayName")] + public string UserDisplayName { get; private set; } + + /// + /// Gets the user principal name of the reviewer + /// + [JsonProperty(PropertyName = "properties.userPrincipalName")] + public string UserPrincipalName { get; private set; } + + /// + /// Gets date Time when the reviewer was contacted. + /// + [JsonProperty(PropertyName = "properties.createdDateTime")] + public System.DateTime? CreatedDateTime { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecision.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecision.cs new file mode 100644 index 000000000000..3870a323cb13 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecision.cs @@ -0,0 +1,246 @@ +// +// 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.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Access Review. + /// + [Rest.Serialization.JsonTransformation] + public partial class AccessReviewDecision : IResource + { + /// + /// Initializes a new instance of the AccessReviewDecision class. + /// + public AccessReviewDecision() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessReviewDecision class. + /// + /// The access review decision id. + /// The access review decision name. + /// The resource type. + /// The id of principal whose access was + /// reviewed. + /// The display name of the user whose access + /// was reviewed. + /// The id of resource associated with a decision + /// record. + /// The display name of resource associated + /// with a decision record. + /// The feature- generated recommendation + /// shown to the reviewer. Possible values include: 'Approve', 'Deny', + /// 'NoInfoAvailable' + /// The decision on the approval step. This + /// value is initially set to NotReviewed. Approvers can take action of + /// Approve/Deny. Possible values include: 'Approve', 'Deny', + /// 'NotReviewed', 'DontKnow', 'NotNotified' + /// Justification provided by approvers for + /// their action + /// Date Time when a decision was + /// taken. + /// The identity id + /// The identity type : + /// user/servicePrincipal. Possible values include: 'user', + /// 'servicePrincipal' + /// The identity display name + /// The user principal name(if + /// valid) + /// The outcome of applying the decision. + /// Possible values include: 'New', 'Applying', 'AppliedSuccessfully', + /// 'AppliedWithUnknownFailure', + /// 'AppliedSuccessfullyButObjectNotFound', 'ApplyNotSupported' + /// The date and time when the review + /// decision was applied. + /// The identity id + /// The identity type : + /// user/servicePrincipal. Possible values include: 'user', + /// 'servicePrincipal' + /// The identity display name + /// The user principal name(if + /// valid) + public AccessReviewDecision(string id = default(string), string name = default(string), string type = default(string), string id1 = default(string), string displayName = default(string), string id2 = default(string), string displayName1 = default(string), string recommendation = default(string), string decision = default(string), string justification = default(string), System.DateTime? reviewedDateTime = default(System.DateTime?), string principalId = default(string), string principalType = default(string), string principalName = default(string), string userPrincipalName = default(string), string applyResult = default(string), System.DateTime? appliedDateTime = default(System.DateTime?), string principalId1 = default(string), string principalType1 = default(string), string principalName1 = default(string), string userPrincipalName1 = default(string)) + { + Id = id; + Name = name; + Type = type; + Id1 = id1; + DisplayName = displayName; + Id2 = id2; + DisplayName1 = displayName1; + Recommendation = recommendation; + Decision = decision; + Justification = justification; + ReviewedDateTime = reviewedDateTime; + PrincipalId = principalId; + PrincipalType = principalType; + PrincipalName = principalName; + UserPrincipalName = userPrincipalName; + ApplyResult = applyResult; + AppliedDateTime = appliedDateTime; + PrincipalId1 = principalId1; + PrincipalType1 = principalType1; + PrincipalName1 = principalName1; + UserPrincipalName1 = userPrincipalName1; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the access review decision id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the access review decision name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the id of principal whose access was reviewed. + /// + [JsonProperty(PropertyName = "properties.principal.id")] + public string Id1 { get; private set; } + + /// + /// Gets the display name of the user whose access was reviewed. + /// + [JsonProperty(PropertyName = "properties.principal.displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets the id of resource associated with a decision record. + /// + [JsonProperty(PropertyName = "properties.resource.id")] + public string Id2 { get; private set; } + + /// + /// Gets the display name of resource associated with a decision + /// record. + /// + [JsonProperty(PropertyName = "properties.resource.displayName")] + public string DisplayName1 { get; private set; } + + /// + /// Gets the feature- generated recommendation shown to the reviewer. + /// Possible values include: 'Approve', 'Deny', 'NoInfoAvailable' + /// + [JsonProperty(PropertyName = "properties.recommendation")] + public string Recommendation { get; private set; } + + /// + /// Gets or sets the decision on the approval step. This value is + /// initially set to NotReviewed. Approvers can take action of + /// Approve/Deny. Possible values include: 'Approve', 'Deny', + /// 'NotReviewed', 'DontKnow', 'NotNotified' + /// + [JsonProperty(PropertyName = "properties.decision")] + public string Decision { get; set; } + + /// + /// Gets or sets justification provided by approvers for their action + /// + [JsonProperty(PropertyName = "properties.justification")] + public string Justification { get; set; } + + /// + /// Gets date Time when a decision was taken. + /// + [JsonProperty(PropertyName = "properties.reviewedDateTime")] + public System.DateTime? ReviewedDateTime { get; private set; } + + /// + /// Gets the identity id + /// + [JsonProperty(PropertyName = "properties.reviewedBy.principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the identity type : user/servicePrincipal. Possible values + /// include: 'user', 'servicePrincipal' + /// + [JsonProperty(PropertyName = "properties.reviewedBy.principalType")] + public string PrincipalType { get; private set; } + + /// + /// Gets the identity display name + /// + [JsonProperty(PropertyName = "properties.reviewedBy.principalName")] + public string PrincipalName { get; private set; } + + /// + /// Gets the user principal name(if valid) + /// + [JsonProperty(PropertyName = "properties.reviewedBy.userPrincipalName")] + public string UserPrincipalName { get; private set; } + + /// + /// Gets the outcome of applying the decision. Possible values include: + /// 'New', 'Applying', 'AppliedSuccessfully', + /// 'AppliedWithUnknownFailure', + /// 'AppliedSuccessfullyButObjectNotFound', 'ApplyNotSupported' + /// + [JsonProperty(PropertyName = "properties.applyResult")] + public string ApplyResult { get; private set; } + + /// + /// Gets the date and time when the review decision was applied. + /// + [JsonProperty(PropertyName = "properties.appliedDateTime")] + public System.DateTime? AppliedDateTime { get; private set; } + + /// + /// Gets the identity id + /// + [JsonProperty(PropertyName = "properties.appliedBy.principalId")] + public string PrincipalId1 { get; private set; } + + /// + /// Gets the identity type : user/servicePrincipal. Possible values + /// include: 'user', 'servicePrincipal' + /// + [JsonProperty(PropertyName = "properties.appliedBy.principalType")] + public string PrincipalType1 { get; private set; } + + /// + /// Gets the identity display name + /// + [JsonProperty(PropertyName = "properties.appliedBy.principalName")] + public string PrincipalName1 { get; private set; } + + /// + /// Gets the user principal name(if valid) + /// + [JsonProperty(PropertyName = "properties.appliedBy.userPrincipalName")] + public string UserPrincipalName1 { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionIdentity.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionIdentity.cs new file mode 100644 index 000000000000..4b3f55148954 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionIdentity.cs @@ -0,0 +1,63 @@ +// +// 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; + + /// + /// Target of the decision. + /// + public partial class AccessReviewDecisionIdentity + { + /// + /// Initializes a new instance of the AccessReviewDecisionIdentity + /// class. + /// + public AccessReviewDecisionIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessReviewDecisionIdentity + /// class. + /// + /// The id of principal whose access was + /// reviewed. + /// The display name of the user whose access + /// was reviewed. + public AccessReviewDecisionIdentity(string id = default(string), string displayName = default(string)) + { + Id = id; + DisplayName = displayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the id of principal whose access was reviewed. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the display name of the user whose access was reviewed. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionProperties.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionProperties.cs new file mode 100644 index 000000000000..28c09e561c81 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionProperties.cs @@ -0,0 +1,148 @@ +// +// 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; + + /// + /// Approval Step. + /// + public partial class AccessReviewDecisionProperties + { + /// + /// Initializes a new instance of the AccessReviewDecisionProperties + /// class. + /// + public AccessReviewDecisionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessReviewDecisionProperties + /// class. + /// + /// Principal associated with the decision + /// record. Can be AccessReviewDecisionUserIdentity or + /// AccessReviewDecisionServicePrincipalIdentity + /// Resource associated with this decision + /// record. + /// The feature- generated recommendation + /// shown to the reviewer. Possible values include: 'Approve', 'Deny', + /// 'NoInfoAvailable' + /// The decision on the approval step. This + /// value is initially set to NotReviewed. Approvers can take action of + /// Approve/Deny. Possible values include: 'Approve', 'Deny', + /// 'NotReviewed', 'DontKnow', 'NotNotified' + /// Justification provided by approvers for + /// their action + /// Date Time when a decision was + /// taken. + /// Details of the approver. + /// The outcome of applying the decision. + /// Possible values include: 'New', 'Applying', 'AppliedSuccessfully', + /// 'AppliedWithUnknownFailure', + /// 'AppliedSuccessfullyButObjectNotFound', 'ApplyNotSupported' + /// The date and time when the review + /// decision was applied. + /// Details of the approver. + public AccessReviewDecisionProperties(AccessReviewDecisionIdentity principal = default(AccessReviewDecisionIdentity), AccessReviewDecisionResource resource = default(AccessReviewDecisionResource), string recommendation = default(string), string decision = default(string), string justification = default(string), System.DateTime? reviewedDateTime = default(System.DateTime?), AccessReviewActorIdentity reviewedBy = default(AccessReviewActorIdentity), string applyResult = default(string), System.DateTime? appliedDateTime = default(System.DateTime?), AccessReviewActorIdentity appliedBy = default(AccessReviewActorIdentity)) + { + Principal = principal; + Resource = resource; + Recommendation = recommendation; + Decision = decision; + Justification = justification; + ReviewedDateTime = reviewedDateTime; + ReviewedBy = reviewedBy; + ApplyResult = applyResult; + AppliedDateTime = appliedDateTime; + AppliedBy = appliedBy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets principal associated with the decision record. Can be + /// AccessReviewDecisionUserIdentity or + /// AccessReviewDecisionServicePrincipalIdentity + /// + [JsonProperty(PropertyName = "principal")] + public AccessReviewDecisionIdentity Principal { get; private set; } + + /// + /// Gets resource associated with this decision record. + /// + [JsonProperty(PropertyName = "resource")] + public AccessReviewDecisionResource Resource { get; private set; } + + /// + /// Gets the feature- generated recommendation shown to the reviewer. + /// Possible values include: 'Approve', 'Deny', 'NoInfoAvailable' + /// + [JsonProperty(PropertyName = "recommendation")] + public string Recommendation { get; private set; } + + /// + /// Gets or sets the decision on the approval step. This value is + /// initially set to NotReviewed. Approvers can take action of + /// Approve/Deny. Possible values include: 'Approve', 'Deny', + /// 'NotReviewed', 'DontKnow', 'NotNotified' + /// + [JsonProperty(PropertyName = "decision")] + public string Decision { get; set; } + + /// + /// Gets or sets justification provided by approvers for their action + /// + [JsonProperty(PropertyName = "justification")] + public string Justification { get; set; } + + /// + /// Gets date Time when a decision was taken. + /// + [JsonProperty(PropertyName = "reviewedDateTime")] + public System.DateTime? ReviewedDateTime { get; private set; } + + /// + /// Gets details of the approver. + /// + [JsonProperty(PropertyName = "reviewedBy")] + public AccessReviewActorIdentity ReviewedBy { get; private set; } + + /// + /// Gets the outcome of applying the decision. Possible values include: + /// 'New', 'Applying', 'AppliedSuccessfully', + /// 'AppliedWithUnknownFailure', + /// 'AppliedSuccessfullyButObjectNotFound', 'ApplyNotSupported' + /// + [JsonProperty(PropertyName = "applyResult")] + public string ApplyResult { get; private set; } + + /// + /// Gets the date and time when the review decision was applied. + /// + [JsonProperty(PropertyName = "appliedDateTime")] + public System.DateTime? AppliedDateTime { get; private set; } + + /// + /// Gets details of the approver. + /// + [JsonProperty(PropertyName = "appliedBy")] + public AccessReviewActorIdentity AppliedBy { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionResource.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionResource.cs new file mode 100644 index 000000000000..e253e41ff01d --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionResource.cs @@ -0,0 +1,64 @@ +// +// 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; + + /// + /// Target of the decision. + /// + public partial class AccessReviewDecisionResource + { + /// + /// Initializes a new instance of the AccessReviewDecisionResource + /// class. + /// + public AccessReviewDecisionResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessReviewDecisionResource + /// class. + /// + /// The id of resource associated with a decision + /// record. + /// The display name of resource associated + /// with a decision record. + public AccessReviewDecisionResource(string id = default(string), string displayName = default(string)) + { + Id = id; + DisplayName = displayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the id of resource associated with a decision record. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the display name of resource associated with a decision + /// record. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentFilter.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionResourceAzureRole.cs similarity index 51% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentFilter.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionResourceAzureRole.cs index 2fabe7f357c8..4a79803ee958 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentFilter.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionResourceAzureRole.cs @@ -14,26 +14,31 @@ namespace Microsoft.Azure.Management.Authorization.Models using System.Linq; /// - /// Role Assignments filter + /// Target of the decision. /// - public partial class RoleAssignmentFilter + [Newtonsoft.Json.JsonObject("azureRole")] + public partial class AccessReviewDecisionResourceAzureRole : AccessReviewDecisionResource { /// - /// Initializes a new instance of the RoleAssignmentFilter class. + /// Initializes a new instance of the + /// AccessReviewDecisionResourceAzureRole class. /// - public RoleAssignmentFilter() + public AccessReviewDecisionResourceAzureRole() { CustomInit(); } /// - /// Initializes a new instance of the RoleAssignmentFilter class. + /// Initializes a new instance of the + /// AccessReviewDecisionResourceAzureRole class. /// - /// Returns role assignment of the specific - /// principal. - public RoleAssignmentFilter(string principalId = default(string)) + /// The id of resource associated with a decision + /// record. + /// The display name of resource associated + /// with a decision record. + public AccessReviewDecisionResourceAzureRole(string id = default(string), string displayName = default(string)) + : base(id, displayName) { - PrincipalId = principalId; CustomInit(); } @@ -42,11 +47,5 @@ public RoleAssignmentFilter() /// partial void CustomInit(); - /// - /// Gets or sets returns role assignment of the specific principal. - /// - [JsonProperty(PropertyName = "principalId")] - public string PrincipalId { get; set; } - } } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionServicePrincipalIdentity.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionServicePrincipalIdentity.cs new file mode 100644 index 000000000000..1e5a52bc8cc4 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionServicePrincipalIdentity.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; + + /// + /// Service Principal Decision Target + /// + [Newtonsoft.Json.JsonObject("servicePrincipal")] + public partial class AccessReviewDecisionServicePrincipalIdentity : AccessReviewDecisionIdentity + { + /// + /// Initializes a new instance of the + /// AccessReviewDecisionServicePrincipalIdentity class. + /// + public AccessReviewDecisionServicePrincipalIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AccessReviewDecisionServicePrincipalIdentity class. + /// + /// The id of principal whose access was + /// reviewed. + /// The display name of the user whose access + /// was reviewed. + /// The appId for the service principal entity + /// being reviewed + public AccessReviewDecisionServicePrincipalIdentity(string id = default(string), string displayName = default(string), string appId = default(string)) + : base(id, displayName) + { + AppId = appId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the appId for the service principal entity being reviewed + /// + [JsonProperty(PropertyName = "appId")] + public string AppId { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionUserIdentity.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionUserIdentity.cs new file mode 100644 index 000000000000..603a20946934 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionUserIdentity.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; + + /// + /// User Decision Target + /// + [Newtonsoft.Json.JsonObject("user")] + public partial class AccessReviewDecisionUserIdentity : AccessReviewDecisionIdentity + { + /// + /// Initializes a new instance of the AccessReviewDecisionUserIdentity + /// class. + /// + public AccessReviewDecisionUserIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessReviewDecisionUserIdentity + /// class. + /// + /// The id of principal whose access was + /// reviewed. + /// The display name of the user whose access + /// was reviewed. + /// The user principal name of the user + /// whose access was reviewed. + public AccessReviewDecisionUserIdentity(string id = default(string), string displayName = default(string), string userPrincipalName = default(string)) + : base(id, displayName) + { + UserPrincipalName = userPrincipalName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the user principal name of the user whose access was reviewed. + /// + [JsonProperty(PropertyName = "userPrincipalName")] + public string UserPrincipalName { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDefaultSettings.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDefaultSettings.cs new file mode 100644 index 000000000000..1e20b158ab7d --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDefaultSettings.cs @@ -0,0 +1,254 @@ +// +// 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.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Access Review Default Settings. + /// + [Rest.Serialization.JsonTransformation] + public partial class AccessReviewDefaultSettings : IResource + { + /// + /// Initializes a new instance of the AccessReviewDefaultSettings + /// class. + /// + public AccessReviewDefaultSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessReviewDefaultSettings + /// class. + /// + /// The access review default settings id. This is + /// only going to be default + /// The access review default settings name. This is + /// always going to be Access Review Default Settings + /// The resource type. + /// Flag to indicate whether + /// sending mails to reviewers and the review creator is + /// enabled. + /// Flag to indicate whether + /// sending reminder emails to reviewers are enabled. + /// Flag to indicate whether + /// reviewers are required to provide a justification when reviewing + /// access. + /// Flag to indicate + /// whether the reviewer is required to pass justification when + /// recording a decision. + /// This specifies the behavior for the + /// autoReview feature when an access review completes. Possible values + /// include: 'Approve', 'Deny', 'Recommendation' + /// Flag to indicate whether + /// auto-apply capability, to automatically change the target object + /// access resource, is enabled. If not enabled, a user must, after the + /// review completes, apply the access review. + /// Flag to indicate whether + /// showing recommendations to reviewers is enabled. + /// Recommendations for + /// access reviews are calculated by looking back at 30 days of + /// data(w.r.t the start date of the review) by default. However, in + /// some scenarios, customers want to change how far back to look at + /// and want to configure 60 days, 90 days, etc. instead. This setting + /// allows customers to configure this duration. The value should be in + /// ISO 8601 format + /// (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be + /// used to convert TimeSpan to a valid interval string: + /// XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)) + /// The duration in days for an + /// instance. + /// The recurrence type : weekly, monthly, etc. + /// Possible values include: 'weekly', 'absoluteMonthly' + /// The interval for recurrence. For a quarterly + /// review, the interval is 3 for type : absoluteMonthly. + /// The recurrence range type. The possible values + /// are: endDate, noEnd, numbered. Possible values include: 'endDate', + /// 'noEnd', 'numbered' + /// The number of times to repeat the + /// access review. Required and must be positive if type is + /// numbered. + /// The DateTime when the review is scheduled + /// to be start. This could be a date in the future. Required on + /// create. + /// The DateTime when the review is scheduled to + /// end. Required if type is endDate + public AccessReviewDefaultSettings(string id = default(string), string name = default(string), string type = default(string), bool? mailNotificationsEnabled = default(bool?), bool? reminderNotificationsEnabled = default(bool?), bool? defaultDecisionEnabled = default(bool?), bool? justificationRequiredOnApproval = default(bool?), string defaultDecision = default(string), bool? autoApplyDecisionsEnabled = default(bool?), bool? recommendationsEnabled = default(bool?), System.TimeSpan? recommendationLookBackDuration = default(System.TimeSpan?), int? instanceDurationInDays = default(int?), string type1 = default(string), int? interval = default(int?), string type2 = default(string), int? numberOfOccurrences = default(int?), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?)) + { + Id = id; + Name = name; + Type = type; + MailNotificationsEnabled = mailNotificationsEnabled; + ReminderNotificationsEnabled = reminderNotificationsEnabled; + DefaultDecisionEnabled = defaultDecisionEnabled; + JustificationRequiredOnApproval = justificationRequiredOnApproval; + DefaultDecision = defaultDecision; + AutoApplyDecisionsEnabled = autoApplyDecisionsEnabled; + RecommendationsEnabled = recommendationsEnabled; + RecommendationLookBackDuration = recommendationLookBackDuration; + InstanceDurationInDays = instanceDurationInDays; + Type1 = type1; + Interval = interval; + Type2 = type2; + NumberOfOccurrences = numberOfOccurrences; + StartDate = startDate; + EndDate = endDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the access review default settings id. This is only going to + /// be default + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the access review default settings name. This is always going + /// to be Access Review Default Settings + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets flag to indicate whether sending mails to reviewers + /// and the review creator is enabled. + /// + [JsonProperty(PropertyName = "properties.mailNotificationsEnabled")] + public bool? MailNotificationsEnabled { get; set; } + + /// + /// Gets or sets flag to indicate whether sending reminder emails to + /// reviewers are enabled. + /// + [JsonProperty(PropertyName = "properties.reminderNotificationsEnabled")] + public bool? ReminderNotificationsEnabled { get; set; } + + /// + /// Gets or sets flag to indicate whether reviewers are required to + /// provide a justification when reviewing access. + /// + [JsonProperty(PropertyName = "properties.defaultDecisionEnabled")] + public bool? DefaultDecisionEnabled { get; set; } + + /// + /// Gets or sets flag to indicate whether the reviewer is required to + /// pass justification when recording a decision. + /// + [JsonProperty(PropertyName = "properties.justificationRequiredOnApproval")] + public bool? JustificationRequiredOnApproval { get; set; } + + /// + /// Gets or sets this specifies the behavior for the autoReview feature + /// when an access review completes. Possible values include: + /// 'Approve', 'Deny', 'Recommendation' + /// + [JsonProperty(PropertyName = "properties.defaultDecision")] + public string DefaultDecision { get; set; } + + /// + /// Gets or sets flag to indicate whether auto-apply capability, to + /// automatically change the target object access resource, is enabled. + /// If not enabled, a user must, after the review completes, apply the + /// access review. + /// + [JsonProperty(PropertyName = "properties.autoApplyDecisionsEnabled")] + public bool? AutoApplyDecisionsEnabled { get; set; } + + /// + /// Gets or sets flag to indicate whether showing recommendations to + /// reviewers is enabled. + /// + [JsonProperty(PropertyName = "properties.recommendationsEnabled")] + public bool? RecommendationsEnabled { get; set; } + + /// + /// Gets or sets recommendations for access reviews are calculated by + /// looking back at 30 days of data(w.r.t the start date of the review) + /// by default. However, in some scenarios, customers want to change + /// how far back to look at and want to configure 60 days, 90 days, + /// etc. instead. This setting allows customers to configure this + /// duration. The value should be in ISO 8601 format + /// (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be + /// used to convert TimeSpan to a valid interval string: + /// XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)) + /// + [JsonProperty(PropertyName = "properties.recommendationLookBackDuration")] + public System.TimeSpan? RecommendationLookBackDuration { get; set; } + + /// + /// Gets or sets the duration in days for an instance. + /// + [JsonProperty(PropertyName = "properties.instanceDurationInDays")] + public int? InstanceDurationInDays { get; set; } + + /// + /// Gets or sets the recurrence type : weekly, monthly, etc. Possible + /// values include: 'weekly', 'absoluteMonthly' + /// + [JsonProperty(PropertyName = "properties.recurrence.pattern.type")] + public string Type1 { get; set; } + + /// + /// Gets or sets the interval for recurrence. For a quarterly review, + /// the interval is 3 for type : absoluteMonthly. + /// + [JsonProperty(PropertyName = "properties.recurrence.pattern.interval")] + public int? Interval { get; set; } + + /// + /// Gets or sets the recurrence range type. The possible values are: + /// endDate, noEnd, numbered. Possible values include: 'endDate', + /// 'noEnd', 'numbered' + /// + [JsonProperty(PropertyName = "properties.recurrence.range.type")] + public string Type2 { get; set; } + + /// + /// Gets or sets the number of times to repeat the access review. + /// Required and must be positive if type is numbered. + /// + [JsonProperty(PropertyName = "properties.recurrence.range.numberOfOccurrences")] + public int? NumberOfOccurrences { get; set; } + + /// + /// Gets or sets the DateTime when the review is scheduled to be start. + /// This could be a date in the future. Required on create. + /// + [JsonProperty(PropertyName = "properties.recurrence.range.startDate")] + public System.DateTime? StartDate { get; set; } + + /// + /// Gets or sets the DateTime when the review is scheduled to end. + /// Required if type is endDate + /// + [JsonProperty(PropertyName = "properties.recurrence.range.endDate")] + public System.DateTime? EndDate { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryDefinition.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryDefinition.cs new file mode 100644 index 000000000000..e8ac54c3a4a8 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryDefinition.cs @@ -0,0 +1,267 @@ +// +// 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.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Access Review History Definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class AccessReviewHistoryDefinition : IResource + { + /// + /// Initializes a new instance of the AccessReviewHistoryDefinition + /// class. + /// + public AccessReviewHistoryDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessReviewHistoryDefinition + /// class. + /// + /// The access review history definition id. + /// The access review history definition unique + /// id. + /// The resource type. + /// The display name for the history + /// definition. + /// Date time used when + /// selecting review data, all reviews included in data start on or + /// after this date. For use only with one-time/non-recurring + /// reports. + /// Date time used when + /// selecting review data, all reviews included in data end on or + /// before this date. For use only with one-time/non-recurring + /// reports. + /// Collection of review decisions which the + /// history data should be filtered on. For example if Approve and Deny + /// are supplied the data will only contain review results in which the + /// decision maker approved or denied a review request. + /// This read-only field specifies the of the + /// requested review history data. This is either requested, + /// in-progress, done or error. Possible values include: 'Requested', + /// 'InProgress', 'Done', 'Error' + /// Date time when history definition was + /// created + /// The identity id + /// The identity type : + /// user/servicePrincipal. Possible values include: 'user', + /// 'servicePrincipal' + /// The identity display name + /// The user principal name(if + /// valid) + /// A collection of scopes used when selecting + /// review history data + /// The recurrence type : weekly, monthly, etc. + /// Possible values include: 'weekly', 'absoluteMonthly' + /// The interval for recurrence. For a quarterly + /// review, the interval is 3 for type : absoluteMonthly. + /// The recurrence range type. The possible values + /// are: endDate, noEnd, numbered. Possible values include: 'endDate', + /// 'noEnd', 'numbered' + /// The number of times to repeat the + /// access review. Required and must be positive if type is + /// numbered. + /// The DateTime when the review is scheduled + /// to be start. This could be a date in the future. Required on + /// create. + /// The DateTime when the review is scheduled to + /// end. Required if type is endDate + /// Set of access review history instances for + /// this history definition. + public AccessReviewHistoryDefinition(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), System.DateTime? reviewHistoryPeriodStartDateTime = default(System.DateTime?), System.DateTime? reviewHistoryPeriodEndDateTime = default(System.DateTime?), IList decisions = default(IList), string status = default(string), System.DateTime? createdDateTime = default(System.DateTime?), string principalId = default(string), string principalType = default(string), string principalName = default(string), string userPrincipalName = default(string), IList scopes = default(IList), string type1 = default(string), int? interval = default(int?), string type2 = default(string), int? numberOfOccurrences = default(int?), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), IList instances = default(IList)) + { + Id = id; + Name = name; + Type = type; + DisplayName = displayName; + ReviewHistoryPeriodStartDateTime = reviewHistoryPeriodStartDateTime; + ReviewHistoryPeriodEndDateTime = reviewHistoryPeriodEndDateTime; + Decisions = decisions; + Status = status; + CreatedDateTime = createdDateTime; + PrincipalId = principalId; + PrincipalType = principalType; + PrincipalName = principalName; + UserPrincipalName = userPrincipalName; + Scopes = scopes; + Type1 = type1; + Interval = interval; + Type2 = type2; + NumberOfOccurrences = numberOfOccurrences; + StartDate = startDate; + EndDate = endDate; + Instances = instances; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the access review history definition id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the access review history definition unique id. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the display name for the history definition. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets date time used when selecting review data, all reviews + /// included in data start on or after this date. For use only with + /// one-time/non-recurring reports. + /// + [JsonProperty(PropertyName = "properties.reviewHistoryPeriodStartDateTime")] + public System.DateTime? ReviewHistoryPeriodStartDateTime { get; private set; } + + /// + /// Gets date time used when selecting review data, all reviews + /// included in data end on or before this date. For use only with + /// one-time/non-recurring reports. + /// + [JsonProperty(PropertyName = "properties.reviewHistoryPeriodEndDateTime")] + public System.DateTime? ReviewHistoryPeriodEndDateTime { get; private set; } + + /// + /// Gets or sets collection of review decisions which the history data + /// should be filtered on. For example if Approve and Deny are supplied + /// the data will only contain review results in which the decision + /// maker approved or denied a review request. + /// + [JsonProperty(PropertyName = "properties.decisions")] + public IList Decisions { get; set; } + + /// + /// Gets this read-only field specifies the of the requested review + /// history data. This is either requested, in-progress, done or error. + /// Possible values include: 'Requested', 'InProgress', 'Done', 'Error' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets date time when history definition was created + /// + [JsonProperty(PropertyName = "properties.createdDateTime")] + public System.DateTime? CreatedDateTime { get; private set; } + + /// + /// Gets the identity id + /// + [JsonProperty(PropertyName = "properties.createdBy.principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the identity type : user/servicePrincipal. Possible values + /// include: 'user', 'servicePrincipal' + /// + [JsonProperty(PropertyName = "properties.createdBy.principalType")] + public string PrincipalType { get; private set; } + + /// + /// Gets the identity display name + /// + [JsonProperty(PropertyName = "properties.createdBy.principalName")] + public string PrincipalName { get; private set; } + + /// + /// Gets the user principal name(if valid) + /// + [JsonProperty(PropertyName = "properties.createdBy.userPrincipalName")] + public string UserPrincipalName { get; private set; } + + /// + /// Gets or sets a collection of scopes used when selecting review + /// history data + /// + [JsonProperty(PropertyName = "properties.scopes")] + public IList Scopes { get; set; } + + /// + /// Gets or sets the recurrence type : weekly, monthly, etc. Possible + /// values include: 'weekly', 'absoluteMonthly' + /// + [JsonProperty(PropertyName = "properties.settings.pattern.type")] + public string Type1 { get; set; } + + /// + /// Gets or sets the interval for recurrence. For a quarterly review, + /// the interval is 3 for type : absoluteMonthly. + /// + [JsonProperty(PropertyName = "properties.settings.pattern.interval")] + public int? Interval { get; set; } + + /// + /// Gets or sets the recurrence range type. The possible values are: + /// endDate, noEnd, numbered. Possible values include: 'endDate', + /// 'noEnd', 'numbered' + /// + [JsonProperty(PropertyName = "properties.settings.range.type")] + public string Type2 { get; set; } + + /// + /// Gets or sets the number of times to repeat the access review. + /// Required and must be positive if type is numbered. + /// + [JsonProperty(PropertyName = "properties.settings.range.numberOfOccurrences")] + public int? NumberOfOccurrences { get; set; } + + /// + /// Gets or sets the DateTime when the review is scheduled to be start. + /// This could be a date in the future. Required on create. + /// + [JsonProperty(PropertyName = "properties.settings.range.startDate")] + public System.DateTime? StartDate { get; set; } + + /// + /// Gets or sets the DateTime when the review is scheduled to end. + /// Required if type is endDate + /// + [JsonProperty(PropertyName = "properties.settings.range.endDate")] + public System.DateTime? EndDate { get; set; } + + /// + /// Gets or sets set of access review history instances for this + /// history definition. + /// + [JsonProperty(PropertyName = "properties.instances")] + public IList Instances { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryDefinitionProperties.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryDefinitionProperties.cs new file mode 100644 index 000000000000..d27d63e566f3 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryDefinitionProperties.cs @@ -0,0 +1,158 @@ +// +// 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; + + /// + /// Access Review History Instances. + /// + public partial class AccessReviewHistoryDefinitionProperties + { + /// + /// Initializes a new instance of the + /// AccessReviewHistoryDefinitionProperties class. + /// + public AccessReviewHistoryDefinitionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AccessReviewHistoryDefinitionProperties class. + /// + /// The display name for the history + /// definition. + /// Date time used when + /// selecting review data, all reviews included in data start on or + /// after this date. For use only with one-time/non-recurring + /// reports. + /// Date time used when + /// selecting review data, all reviews included in data end on or + /// before this date. For use only with one-time/non-recurring + /// reports. + /// Collection of review decisions which the + /// history data should be filtered on. For example if Approve and Deny + /// are supplied the data will only contain review results in which the + /// decision maker approved or denied a review request. + /// This read-only field specifies the of the + /// requested review history data. This is either requested, + /// in-progress, done or error. Possible values include: 'Requested', + /// 'InProgress', 'Done', 'Error' + /// Date time when history definition was + /// created + /// The user or other identity who created this + /// history definition. + /// A collection of scopes used when selecting + /// review history data + /// Recurrence settings for recurring history + /// reports, skip for one-time reports. + /// Set of access review history instances for + /// this history definition. + public AccessReviewHistoryDefinitionProperties(string displayName = default(string), System.DateTime? reviewHistoryPeriodStartDateTime = default(System.DateTime?), System.DateTime? reviewHistoryPeriodEndDateTime = default(System.DateTime?), IList decisions = default(IList), string status = default(string), System.DateTime? createdDateTime = default(System.DateTime?), AccessReviewActorIdentity createdBy = default(AccessReviewActorIdentity), IList scopes = default(IList), AccessReviewHistoryScheduleSettings settings = default(AccessReviewHistoryScheduleSettings), IList instances = default(IList)) + { + DisplayName = displayName; + ReviewHistoryPeriodStartDateTime = reviewHistoryPeriodStartDateTime; + ReviewHistoryPeriodEndDateTime = reviewHistoryPeriodEndDateTime; + Decisions = decisions; + Status = status; + CreatedDateTime = createdDateTime; + CreatedBy = createdBy; + Scopes = scopes; + Settings = settings; + Instances = instances; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the display name for the history definition. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets date time used when selecting review data, all reviews + /// included in data start on or after this date. For use only with + /// one-time/non-recurring reports. + /// + [JsonProperty(PropertyName = "reviewHistoryPeriodStartDateTime")] + public System.DateTime? ReviewHistoryPeriodStartDateTime { get; private set; } + + /// + /// Gets date time used when selecting review data, all reviews + /// included in data end on or before this date. For use only with + /// one-time/non-recurring reports. + /// + [JsonProperty(PropertyName = "reviewHistoryPeriodEndDateTime")] + public System.DateTime? ReviewHistoryPeriodEndDateTime { get; private set; } + + /// + /// Gets or sets collection of review decisions which the history data + /// should be filtered on. For example if Approve and Deny are supplied + /// the data will only contain review results in which the decision + /// maker approved or denied a review request. + /// + [JsonProperty(PropertyName = "decisions")] + public IList Decisions { get; set; } + + /// + /// Gets this read-only field specifies the of the requested review + /// history data. This is either requested, in-progress, done or error. + /// Possible values include: 'Requested', 'InProgress', 'Done', 'Error' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets date time when history definition was created + /// + [JsonProperty(PropertyName = "createdDateTime")] + public System.DateTime? CreatedDateTime { get; private set; } + + /// + /// Gets the user or other identity who created this history + /// definition. + /// + [JsonProperty(PropertyName = "createdBy")] + public AccessReviewActorIdentity CreatedBy { get; private set; } + + /// + /// Gets or sets a collection of scopes used when selecting review + /// history data + /// + [JsonProperty(PropertyName = "scopes")] + public IList Scopes { get; set; } + + /// + /// Gets or sets recurrence settings for recurring history reports, + /// skip for one-time reports. + /// + [JsonProperty(PropertyName = "settings")] + public AccessReviewHistoryScheduleSettings Settings { get; set; } + + /// + /// Gets or sets set of access review history instances for this + /// history definition. + /// + [JsonProperty(PropertyName = "instances")] + public IList Instances { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryDefinitionStatus.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryDefinitionStatus.cs new file mode 100644 index 000000000000..97dae1e642ce --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryDefinitionStatus.cs @@ -0,0 +1,24 @@ +// +// 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 +{ + + /// + /// Defines values for AccessReviewHistoryDefinitionStatus. + /// + public static class AccessReviewHistoryDefinitionStatus + { + public const string Requested = "Requested"; + public const string InProgress = "InProgress"; + public const string Done = "Done"; + public const string Error = "Error"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryInstance.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryInstance.cs new file mode 100644 index 000000000000..3edd6b806672 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewHistoryInstance.cs @@ -0,0 +1,173 @@ +// +// 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.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Access Review History Definition Instance. + /// + [Rest.Serialization.JsonTransformation] + public partial class AccessReviewHistoryInstance : IResource + { + /// + /// Initializes a new instance of the AccessReviewHistoryInstance + /// class. + /// + public AccessReviewHistoryInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessReviewHistoryInstance + /// class. + /// + /// The access review history definition instance + /// id. + /// The access review history definition instance + /// unique id. + /// The resource type. + /// Date time used when + /// selecting review data, all reviews included in data start on or + /// after this date. For use only with one-time/non-recurring + /// reports. + /// Date time used when + /// selecting review data, all reviews included in data end on or + /// before this date. For use only with one-time/non-recurring + /// reports. + /// The display name for the parent history + /// definition. + /// Status of the requested review history + /// instance data. This is either requested, in-progress, done or + /// error. The state transitions are as follows - Requested -> + /// InProgress -> Done -> Expired. Possible values include: + /// 'Requested', 'InProgress', 'Done', 'Error' + /// Date time when the history data report is + /// scheduled to be generated. + /// Date time when the history data + /// report is scheduled to be generated. + /// Uri which can be used to retrieve review + /// history data. To generate this Uri, generateDownloadUri() must be + /// called for a specific accessReviewHistoryDefinitionInstance. The + /// link expires after a 24 hour period. Callers can see the expiration + /// date time by looking at the 'se' parameter in the generated + /// uri. + /// Date time when history data report expires + /// and the associated data is deleted. + public AccessReviewHistoryInstance(string id = default(string), string name = default(string), string type = default(string), System.DateTime? reviewHistoryPeriodStartDateTime = default(System.DateTime?), System.DateTime? reviewHistoryPeriodEndDateTime = default(System.DateTime?), string displayName = default(string), string status = default(string), System.DateTime? runDateTime = default(System.DateTime?), System.DateTime? fulfilledDateTime = default(System.DateTime?), string downloadUri = default(string), System.DateTime? expiration = default(System.DateTime?)) + { + Id = id; + Name = name; + Type = type; + ReviewHistoryPeriodStartDateTime = reviewHistoryPeriodStartDateTime; + ReviewHistoryPeriodEndDateTime = reviewHistoryPeriodEndDateTime; + DisplayName = displayName; + Status = status; + RunDateTime = runDateTime; + FulfilledDateTime = fulfilledDateTime; + DownloadUri = downloadUri; + Expiration = expiration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the access review history definition instance id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the access review history definition instance unique id. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets date time used when selecting review data, all reviews + /// included in data start on or after this date. For use only with + /// one-time/non-recurring reports. + /// + [JsonProperty(PropertyName = "properties.reviewHistoryPeriodStartDateTime")] + public System.DateTime? ReviewHistoryPeriodStartDateTime { get; set; } + + /// + /// Gets or sets date time used when selecting review data, all reviews + /// included in data end on or before this date. For use only with + /// one-time/non-recurring reports. + /// + [JsonProperty(PropertyName = "properties.reviewHistoryPeriodEndDateTime")] + public System.DateTime? ReviewHistoryPeriodEndDateTime { get; set; } + + /// + /// Gets or sets the display name for the parent history definition. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets status of the requested review history instance data. This is + /// either requested, in-progress, done or error. The state transitions + /// are as follows - Requested -&gt; InProgress -&gt; Done + /// -&gt; Expired. Possible values include: 'Requested', + /// 'InProgress', 'Done', 'Error' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets or sets date time when the history data report is scheduled to + /// be generated. + /// + [JsonProperty(PropertyName = "properties.runDateTime")] + public System.DateTime? RunDateTime { get; set; } + + /// + /// Gets or sets date time when the history data report is scheduled to + /// be generated. + /// + [JsonProperty(PropertyName = "properties.fulfilledDateTime")] + public System.DateTime? FulfilledDateTime { get; set; } + + /// + /// Gets uri which can be used to retrieve review history data. To + /// generate this Uri, generateDownloadUri() must be called for a + /// specific accessReviewHistoryDefinitionInstance. The link expires + /// after a 24 hour period. Callers can see the expiration date time by + /// looking at the 'se' parameter in the generated uri. + /// + [JsonProperty(PropertyName = "properties.downloadUri")] + public string DownloadUri { get; private set; } + + /// + /// Gets or sets date time when history data report expires and the + /// associated data is deleted. + /// + [JsonProperty(PropertyName = "properties.expiration")] + public System.DateTime? Expiration { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstance.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstance.cs new file mode 100644 index 000000000000..be4b24ce48fb --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstance.cs @@ -0,0 +1,143 @@ +// +// 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.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Access Review Instance. + /// + [Rest.Serialization.JsonTransformation] + public partial class AccessReviewInstance : IResource + { + /// + /// Initializes a new instance of the AccessReviewInstance class. + /// + public AccessReviewInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessReviewInstance class. + /// + /// The access review instance id. + /// The access review instance name. + /// The resource type. + /// This read-only field specifies the status of + /// an access review instance. Possible values include: 'NotStarted', + /// 'InProgress', 'Completed', 'Applied', 'Initializing', 'Applying', + /// 'Completing', 'Scheduled', 'AutoReviewing', 'AutoReviewed', + /// 'Starting' + /// The DateTime when the review instance + /// is scheduled to be start. + /// The DateTime when the review instance is + /// scheduled to end. + /// This is the collection of + /// reviewers. + /// This is the collection of backup + /// reviewers. + /// This field specifies the type of + /// reviewers for a review. Usually for a review, reviewers are + /// explicitly assigned. However, in some cases, the reviewers may not + /// be assigned and instead be chosen dynamically. For example managers + /// review or self review. Possible values include: 'Assigned', 'Self', + /// 'Managers' + public AccessReviewInstance(string id = default(string), string name = default(string), string type = default(string), string status = default(string), System.DateTime startDateTime = default(System.DateTime), System.DateTime endDateTime = default(System.DateTime), IList reviewers = default(IList), IList backupReviewers = default(IList), string reviewersType = default(string)) + { + Id = id; + Name = name; + Type = type; + Status = status; + StartDateTime = startDateTime; + EndDateTime = endDateTime; + Reviewers = reviewers; + BackupReviewers = backupReviewers; + ReviewersType = reviewersType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the access review instance id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the access review instance name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets this read-only field specifies the status of an access review + /// instance. Possible values include: 'NotStarted', 'InProgress', + /// 'Completed', 'Applied', 'Initializing', 'Applying', 'Completing', + /// 'Scheduled', 'AutoReviewing', 'AutoReviewed', 'Starting' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets or sets the DateTime when the review instance is scheduled to + /// be start. + /// + [JsonProperty(PropertyName = "properties.startDateTime")] + public System.DateTime StartDateTime { get; set; } + + /// + /// Gets or sets the DateTime when the review instance is scheduled to + /// end. + /// + [JsonProperty(PropertyName = "properties.endDateTime")] + public System.DateTime EndDateTime { get; set; } + + /// + /// Gets or sets this is the collection of reviewers. + /// + [JsonProperty(PropertyName = "properties.reviewers")] + public IList Reviewers { get; set; } + + /// + /// Gets or sets this is the collection of backup reviewers. + /// + [JsonProperty(PropertyName = "properties.backupReviewers")] + public IList BackupReviewers { get; set; } + + /// + /// Gets this field specifies the type of reviewers for a review. + /// Usually for a review, reviewers are explicitly assigned. However, + /// in some cases, the reviewers may not be assigned and instead be + /// chosen dynamically. For example managers review or self review. + /// Possible values include: 'Assigned', 'Self', 'Managers' + /// + [JsonProperty(PropertyName = "properties.reviewersType")] + public string ReviewersType { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstanceProperties.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstanceProperties.cs new file mode 100644 index 000000000000..0a9dbb227137 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstanceProperties.cs @@ -0,0 +1,117 @@ +// +// 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; + + /// + /// Access Review Instance properties. + /// + public partial class AccessReviewInstanceProperties + { + /// + /// Initializes a new instance of the AccessReviewInstanceProperties + /// class. + /// + public AccessReviewInstanceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessReviewInstanceProperties + /// class. + /// + /// This read-only field specifies the status of + /// an access review instance. Possible values include: 'NotStarted', + /// 'InProgress', 'Completed', 'Applied', 'Initializing', 'Applying', + /// 'Completing', 'Scheduled', 'AutoReviewing', 'AutoReviewed', + /// 'Starting' + /// The DateTime when the review instance + /// is scheduled to be start. + /// The DateTime when the review instance is + /// scheduled to end. + /// This is the collection of + /// reviewers. + /// This is the collection of backup + /// reviewers. + /// This field specifies the type of + /// reviewers for a review. Usually for a review, reviewers are + /// explicitly assigned. However, in some cases, the reviewers may not + /// be assigned and instead be chosen dynamically. For example managers + /// review or self review. Possible values include: 'Assigned', 'Self', + /// 'Managers' + public AccessReviewInstanceProperties(string status = default(string), System.DateTime startDateTime = default(System.DateTime), System.DateTime endDateTime = default(System.DateTime), IList reviewers = default(IList), IList backupReviewers = default(IList), string reviewersType = default(string)) + { + Status = status; + StartDateTime = startDateTime; + EndDateTime = endDateTime; + Reviewers = reviewers; + BackupReviewers = backupReviewers; + ReviewersType = reviewersType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets this read-only field specifies the status of an access review + /// instance. Possible values include: 'NotStarted', 'InProgress', + /// 'Completed', 'Applied', 'Initializing', 'Applying', 'Completing', + /// 'Scheduled', 'AutoReviewing', 'AutoReviewed', 'Starting' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets or sets the DateTime when the review instance is scheduled to + /// be start. + /// + [JsonProperty(PropertyName = "startDateTime")] + public System.DateTime StartDateTime { get; set; } + + /// + /// Gets or sets the DateTime when the review instance is scheduled to + /// end. + /// + [JsonProperty(PropertyName = "endDateTime")] + public System.DateTime EndDateTime { get; set; } + + /// + /// Gets or sets this is the collection of reviewers. + /// + [JsonProperty(PropertyName = "reviewers")] + public IList Reviewers { get; set; } + + /// + /// Gets or sets this is the collection of backup reviewers. + /// + [JsonProperty(PropertyName = "backupReviewers")] + public IList BackupReviewers { get; set; } + + /// + /// Gets this field specifies the type of reviewers for a review. + /// Usually for a review, reviewers are explicitly assigned. However, + /// in some cases, the reviewers may not be assigned and instead be + /// chosen dynamically. For example managers review or self review. + /// Possible values include: 'Assigned', 'Self', 'Managers' + /// + [JsonProperty(PropertyName = "reviewersType")] + public string ReviewersType { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstanceReviewersType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstanceReviewersType.cs new file mode 100644 index 000000000000..4994d47a4a06 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstanceReviewersType.cs @@ -0,0 +1,23 @@ +// +// 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 +{ + + /// + /// Defines values for AccessReviewInstanceReviewersType. + /// + public static class AccessReviewInstanceReviewersType + { + public const string Assigned = "Assigned"; + public const string Self = "Self"; + public const string Managers = "Managers"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstanceStatus.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstanceStatus.cs new file mode 100644 index 000000000000..7151a89fe099 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstanceStatus.cs @@ -0,0 +1,31 @@ +// +// 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 +{ + + /// + /// Defines values for AccessReviewInstanceStatus. + /// + public static class AccessReviewInstanceStatus + { + public const string NotStarted = "NotStarted"; + public const string InProgress = "InProgress"; + public const string Completed = "Completed"; + public const string Applied = "Applied"; + public const string Initializing = "Initializing"; + public const string Applying = "Applying"; + public const string Completing = "Completing"; + public const string Scheduled = "Scheduled"; + public const string AutoReviewing = "AutoReviewing"; + public const string AutoReviewed = "AutoReviewed"; + public const string Starting = "Starting"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewRecurrencePatternType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewRecurrencePatternType.cs new file mode 100644 index 000000000000..51f8de8d9b95 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewRecurrencePatternType.cs @@ -0,0 +1,22 @@ +// +// 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 +{ + + /// + /// Defines values for AccessReviewRecurrencePatternType. + /// + public static class AccessReviewRecurrencePatternType + { + public const string Weekly = "weekly"; + public const string AbsoluteMonthly = "absoluteMonthly"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewRecurrenceRangeType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewRecurrenceRangeType.cs new file mode 100644 index 000000000000..5e34ff887fff --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewRecurrenceRangeType.cs @@ -0,0 +1,23 @@ +// +// 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 +{ + + /// + /// Defines values for AccessReviewRecurrenceRangeType. + /// + public static class AccessReviewRecurrenceRangeType + { + public const string EndDate = "endDate"; + public const string NoEnd = "noEnd"; + public const string Numbered = "numbered"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewResult.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewResult.cs new file mode 100644 index 000000000000..52e5a3fe1de2 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewResult.cs @@ -0,0 +1,25 @@ +// +// 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 +{ + + /// + /// Defines values for AccessReviewResult. + /// + public static class AccessReviewResult + { + public const string Approve = "Approve"; + public const string Deny = "Deny"; + public const string NotReviewed = "NotReviewed"; + public const string DontKnow = "DontKnow"; + public const string NotNotified = "NotNotified"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewReviewer.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewReviewer.cs new file mode 100644 index 000000000000..9de1b083f606 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewReviewer.cs @@ -0,0 +1,63 @@ +// +// 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; + + /// + /// Descriptor for what needs to be reviewed + /// + public partial class AccessReviewReviewer + { + /// + /// Initializes a new instance of the AccessReviewReviewer class. + /// + public AccessReviewReviewer() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessReviewReviewer class. + /// + /// The id of the + /// reviewer(user/servicePrincipal) + /// The identity type : + /// user/servicePrincipal. Possible values include: 'user', + /// 'servicePrincipal' + public AccessReviewReviewer(string principalId = default(string), string principalType = default(string)) + { + PrincipalId = principalId; + PrincipalType = principalType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the id of the reviewer(user/servicePrincipal) + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets the identity type : user/servicePrincipal. Possible values + /// include: 'user', 'servicePrincipal' + /// + [JsonProperty(PropertyName = "principalType")] + public string PrincipalType { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewReviewerType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewReviewerType.cs new file mode 100644 index 000000000000..ff1cf9c48645 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewReviewerType.cs @@ -0,0 +1,22 @@ +// +// 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 +{ + + /// + /// Defines values for AccessReviewReviewerType. + /// + public static class AccessReviewReviewerType + { + public const string User = "user"; + public const string ServicePrincipal = "servicePrincipal"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinition.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinition.cs new file mode 100644 index 000000000000..08a5c7cabca6 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinition.cs @@ -0,0 +1,446 @@ +// +// 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.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Access Review Schedule Definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class AccessReviewScheduleDefinition : IResource + { + /// + /// Initializes a new instance of the AccessReviewScheduleDefinition + /// class. + /// + public AccessReviewScheduleDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessReviewScheduleDefinition + /// class. + /// + /// The access review schedule definition id. + /// The access review schedule definition unique + /// id. + /// The resource type. + /// The display name for the schedule + /// definition. + /// This read-only field specifies the status of + /// an accessReview. Possible values include: 'NotStarted', + /// 'InProgress', 'Completed', 'Applied', 'Initializing', 'Applying', + /// 'Completing', 'Scheduled', 'AutoReviewing', 'AutoReviewed', + /// 'Starting' + /// The description provided by the + /// access review creator and visible to admins. + /// The description provided by + /// the access review creator to be shown to reviewers. + /// The identity id + /// The identity type : + /// user/servicePrincipal. Possible values include: 'user', + /// 'servicePrincipal' + /// The identity display name + /// The user principal name(if + /// valid) + /// Flag to indicate whether + /// sending mails to reviewers and the review creator is + /// enabled. + /// Flag to indicate whether + /// sending reminder emails to reviewers are enabled. + /// Flag to indicate whether + /// reviewers are required to provide a justification when reviewing + /// access. + /// Flag to indicate + /// whether the reviewer is required to pass justification when + /// recording a decision. + /// This specifies the behavior for the + /// autoReview feature when an access review completes. Possible values + /// include: 'Approve', 'Deny', 'Recommendation' + /// Flag to indicate whether + /// auto-apply capability, to automatically change the target object + /// access resource, is enabled. If not enabled, a user must, after the + /// review completes, apply the access review. + /// Flag to indicate whether + /// showing recommendations to reviewers is enabled. + /// Recommendations for + /// access reviews are calculated by looking back at 30 days of + /// data(w.r.t the start date of the review) by default. However, in + /// some scenarios, customers want to change how far back to look at + /// and want to configure 60 days, 90 days, etc. instead. This setting + /// allows customers to configure this duration. The value should be in + /// ISO 8601 format + /// (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be + /// used to convert TimeSpan to a valid interval string: + /// XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)) + /// The duration in days for an + /// instance. + /// The recurrence type : weekly, monthly, etc. + /// Possible values include: 'weekly', 'absoluteMonthly' + /// The interval for recurrence. For a quarterly + /// review, the interval is 3 for type : absoluteMonthly. + /// The recurrence range type. The possible values + /// are: endDate, noEnd, numbered. Possible values include: 'endDate', + /// 'noEnd', 'numbered' + /// The number of times to repeat the + /// access review. Required and must be positive if type is + /// numbered. + /// The DateTime when the review is scheduled + /// to be start. This could be a date in the future. Required on + /// create. + /// The DateTime when the review is scheduled to + /// end. Required if type is endDate + /// ResourceId in which this review is getting + /// created + /// This is used to indicate the role + /// being reviewed + /// The identity type + /// user/servicePrincipal to review. Possible values include: 'user', + /// 'guestUser', 'servicePrincipal', 'user,group', + /// 'redeemedGuestUser' + /// The role assignment state + /// eligible/active to review. Possible values include: 'eligible', + /// 'active' + /// Duration users are inactive for. The + /// value should be in ISO 8601 format + /// (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be + /// used to convert TimeSpan to a valid interval string: + /// XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)) + /// Flag to indicate whether to + /// expand nested memberships or not. + /// This is the collection of + /// reviewers. + /// This is the collection of backup + /// reviewers. + /// This field specifies the type of + /// reviewers for a review. Usually for a review, reviewers are + /// explicitly assigned. However, in some cases, the reviewers may not + /// be assigned and instead be chosen dynamically. For example managers + /// review or self review. Possible values include: 'Assigned', 'Self', + /// 'Managers' + /// This is the collection of instances + /// returned when one does an expand on it. + public AccessReviewScheduleDefinition(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), string status = default(string), string descriptionForAdmins = default(string), string descriptionForReviewers = default(string), string principalId = default(string), string principalType = default(string), string principalName = default(string), string userPrincipalName = default(string), bool? mailNotificationsEnabled = default(bool?), bool? reminderNotificationsEnabled = default(bool?), bool? defaultDecisionEnabled = default(bool?), bool? justificationRequiredOnApproval = default(bool?), string defaultDecision = default(string), bool? autoApplyDecisionsEnabled = default(bool?), bool? recommendationsEnabled = default(bool?), System.TimeSpan? recommendationLookBackDuration = default(System.TimeSpan?), int? instanceDurationInDays = default(int?), string type1 = default(string), int? interval = default(int?), string type2 = default(string), int? numberOfOccurrences = default(int?), System.DateTime? startDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), string resourceId = default(string), string roleDefinitionId = default(string), string principalType1 = default(string), string assignmentState = default(string), System.TimeSpan? inactiveDuration = default(System.TimeSpan?), bool? expandNestedMemberships = default(bool?), IList reviewers = default(IList), IList backupReviewers = default(IList), string reviewersType = default(string), IList instances = default(IList)) + { + Id = id; + Name = name; + Type = type; + DisplayName = displayName; + Status = status; + DescriptionForAdmins = descriptionForAdmins; + DescriptionForReviewers = descriptionForReviewers; + PrincipalId = principalId; + PrincipalType = principalType; + PrincipalName = principalName; + UserPrincipalName = userPrincipalName; + MailNotificationsEnabled = mailNotificationsEnabled; + ReminderNotificationsEnabled = reminderNotificationsEnabled; + DefaultDecisionEnabled = defaultDecisionEnabled; + JustificationRequiredOnApproval = justificationRequiredOnApproval; + DefaultDecision = defaultDecision; + AutoApplyDecisionsEnabled = autoApplyDecisionsEnabled; + RecommendationsEnabled = recommendationsEnabled; + RecommendationLookBackDuration = recommendationLookBackDuration; + InstanceDurationInDays = instanceDurationInDays; + Type1 = type1; + Interval = interval; + Type2 = type2; + NumberOfOccurrences = numberOfOccurrences; + StartDate = startDate; + EndDate = endDate; + ResourceId = resourceId; + RoleDefinitionId = roleDefinitionId; + PrincipalType1 = principalType1; + AssignmentState = assignmentState; + InactiveDuration = inactiveDuration; + ExpandNestedMemberships = expandNestedMemberships; + Reviewers = reviewers; + BackupReviewers = backupReviewers; + ReviewersType = reviewersType; + Instances = instances; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the access review schedule definition id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the access review schedule definition unique id. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the display name for the schedule definition. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets this read-only field specifies the status of an accessReview. + /// Possible values include: 'NotStarted', 'InProgress', 'Completed', + /// 'Applied', 'Initializing', 'Applying', 'Completing', 'Scheduled', + /// 'AutoReviewing', 'AutoReviewed', 'Starting' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets or sets the description provided by the access review creator + /// and visible to admins. + /// + [JsonProperty(PropertyName = "properties.descriptionForAdmins")] + public string DescriptionForAdmins { get; set; } + + /// + /// Gets or sets the description provided by the access review creator + /// to be shown to reviewers. + /// + [JsonProperty(PropertyName = "properties.descriptionForReviewers")] + public string DescriptionForReviewers { get; set; } + + /// + /// Gets the identity id + /// + [JsonProperty(PropertyName = "properties.createdBy.principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the identity type : user/servicePrincipal. Possible values + /// include: 'user', 'servicePrincipal' + /// + [JsonProperty(PropertyName = "properties.createdBy.principalType")] + public string PrincipalType { get; private set; } + + /// + /// Gets the identity display name + /// + [JsonProperty(PropertyName = "properties.createdBy.principalName")] + public string PrincipalName { get; private set; } + + /// + /// Gets the user principal name(if valid) + /// + [JsonProperty(PropertyName = "properties.createdBy.userPrincipalName")] + public string UserPrincipalName { get; private set; } + + /// + /// Gets or sets flag to indicate whether sending mails to reviewers + /// and the review creator is enabled. + /// + [JsonProperty(PropertyName = "properties.settings.mailNotificationsEnabled")] + public bool? MailNotificationsEnabled { get; set; } + + /// + /// Gets or sets flag to indicate whether sending reminder emails to + /// reviewers are enabled. + /// + [JsonProperty(PropertyName = "properties.settings.reminderNotificationsEnabled")] + public bool? ReminderNotificationsEnabled { get; set; } + + /// + /// Gets or sets flag to indicate whether reviewers are required to + /// provide a justification when reviewing access. + /// + [JsonProperty(PropertyName = "properties.settings.defaultDecisionEnabled")] + public bool? DefaultDecisionEnabled { get; set; } + + /// + /// Gets or sets flag to indicate whether the reviewer is required to + /// pass justification when recording a decision. + /// + [JsonProperty(PropertyName = "properties.settings.justificationRequiredOnApproval")] + public bool? JustificationRequiredOnApproval { get; set; } + + /// + /// Gets or sets this specifies the behavior for the autoReview feature + /// when an access review completes. Possible values include: + /// 'Approve', 'Deny', 'Recommendation' + /// + [JsonProperty(PropertyName = "properties.settings.defaultDecision")] + public string DefaultDecision { get; set; } + + /// + /// Gets or sets flag to indicate whether auto-apply capability, to + /// automatically change the target object access resource, is enabled. + /// If not enabled, a user must, after the review completes, apply the + /// access review. + /// + [JsonProperty(PropertyName = "properties.settings.autoApplyDecisionsEnabled")] + public bool? AutoApplyDecisionsEnabled { get; set; } + + /// + /// Gets or sets flag to indicate whether showing recommendations to + /// reviewers is enabled. + /// + [JsonProperty(PropertyName = "properties.settings.recommendationsEnabled")] + public bool? RecommendationsEnabled { get; set; } + + /// + /// Gets or sets recommendations for access reviews are calculated by + /// looking back at 30 days of data(w.r.t the start date of the review) + /// by default. However, in some scenarios, customers want to change + /// how far back to look at and want to configure 60 days, 90 days, + /// etc. instead. This setting allows customers to configure this + /// duration. The value should be in ISO 8601 format + /// (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be + /// used to convert TimeSpan to a valid interval string: + /// XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)) + /// + [JsonProperty(PropertyName = "properties.settings.recommendationLookBackDuration")] + public System.TimeSpan? RecommendationLookBackDuration { get; set; } + + /// + /// Gets or sets the duration in days for an instance. + /// + [JsonProperty(PropertyName = "properties.settings.instanceDurationInDays")] + public int? InstanceDurationInDays { get; set; } + + /// + /// Gets or sets the recurrence type : weekly, monthly, etc. Possible + /// values include: 'weekly', 'absoluteMonthly' + /// + [JsonProperty(PropertyName = "properties.settings.recurrence.pattern.type")] + public string Type1 { get; set; } + + /// + /// Gets or sets the interval for recurrence. For a quarterly review, + /// the interval is 3 for type : absoluteMonthly. + /// + [JsonProperty(PropertyName = "properties.settings.recurrence.pattern.interval")] + public int? Interval { get; set; } + + /// + /// Gets or sets the recurrence range type. The possible values are: + /// endDate, noEnd, numbered. Possible values include: 'endDate', + /// 'noEnd', 'numbered' + /// + [JsonProperty(PropertyName = "properties.settings.recurrence.range.type")] + public string Type2 { get; set; } + + /// + /// Gets or sets the number of times to repeat the access review. + /// Required and must be positive if type is numbered. + /// + [JsonProperty(PropertyName = "properties.settings.recurrence.range.numberOfOccurrences")] + public int? NumberOfOccurrences { get; set; } + + /// + /// Gets or sets the DateTime when the review is scheduled to be start. + /// This could be a date in the future. Required on create. + /// + [JsonProperty(PropertyName = "properties.settings.recurrence.range.startDate")] + public System.DateTime? StartDate { get; set; } + + /// + /// Gets or sets the DateTime when the review is scheduled to end. + /// Required if type is endDate + /// + [JsonProperty(PropertyName = "properties.settings.recurrence.range.endDate")] + public System.DateTime? EndDate { get; set; } + + /// + /// Gets resourceId in which this review is getting created + /// + [JsonProperty(PropertyName = "properties.scope.resourceId")] + public string ResourceId { get; private set; } + + /// + /// Gets this is used to indicate the role being reviewed + /// + [JsonProperty(PropertyName = "properties.scope.roleDefinitionId")] + public string RoleDefinitionId { get; private set; } + + /// + /// Gets the identity type user/servicePrincipal to review. Possible + /// values include: 'user', 'guestUser', 'servicePrincipal', + /// 'user,group', 'redeemedGuestUser' + /// + [JsonProperty(PropertyName = "properties.scope.principalType")] + public string PrincipalType1 { get; private set; } + + /// + /// Gets the role assignment state eligible/active to review. Possible + /// values include: 'eligible', 'active' + /// + [JsonProperty(PropertyName = "properties.scope.assignmentState")] + public string AssignmentState { get; private set; } + + /// + /// Gets or sets duration users are inactive for. The value should be + /// in ISO 8601 format + /// (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be + /// used to convert TimeSpan to a valid interval string: + /// XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)) + /// + [JsonProperty(PropertyName = "properties.scope.inactiveDuration")] + public System.TimeSpan? InactiveDuration { get; set; } + + /// + /// Gets or sets flag to indicate whether to expand nested memberships + /// or not. + /// + [JsonProperty(PropertyName = "properties.scope.expandNestedMemberships")] + public bool? ExpandNestedMemberships { get; set; } + + /// + /// Gets or sets this is the collection of reviewers. + /// + [JsonProperty(PropertyName = "properties.reviewers")] + public IList Reviewers { get; set; } + + /// + /// Gets or sets this is the collection of backup reviewers. + /// + [JsonProperty(PropertyName = "properties.backupReviewers")] + public IList BackupReviewers { get; set; } + + /// + /// Gets this field specifies the type of reviewers for a review. + /// Usually for a review, reviewers are explicitly assigned. However, + /// in some cases, the reviewers may not be assigned and instead be + /// chosen dynamically. For example managers review or self review. + /// Possible values include: 'Assigned', 'Self', 'Managers' + /// + [JsonProperty(PropertyName = "properties.reviewersType")] + public string ReviewersType { get; private set; } + + /// + /// Gets or sets this is the collection of instances returned when one + /// does an expand on it. + /// + [JsonProperty(PropertyName = "properties.instances")] + public IList Instances { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinitionProperties.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinitionProperties.cs new file mode 100644 index 000000000000..93f5b9ba83d1 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinitionProperties.cs @@ -0,0 +1,164 @@ +// +// 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; + + /// + /// Access Review. + /// + public partial class AccessReviewScheduleDefinitionProperties + { + /// + /// Initializes a new instance of the + /// AccessReviewScheduleDefinitionProperties class. + /// + public AccessReviewScheduleDefinitionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AccessReviewScheduleDefinitionProperties class. + /// + /// The display name for the schedule + /// definition. + /// This read-only field specifies the status of + /// an accessReview. Possible values include: 'NotStarted', + /// 'InProgress', 'Completed', 'Applied', 'Initializing', 'Applying', + /// 'Completing', 'Scheduled', 'AutoReviewing', 'AutoReviewed', + /// 'Starting' + /// The description provided by the + /// access review creator and visible to admins. + /// The description provided by + /// the access review creator to be shown to reviewers. + /// The user or other identity who created this + /// review. + /// Access Review Settings. + /// This is used to define what to include in scope + /// of the review. The scope definition includes the resourceId and + /// roleDefinitionId. + /// This is the collection of + /// reviewers. + /// This is the collection of backup + /// reviewers. + /// This field specifies the type of + /// reviewers for a review. Usually for a review, reviewers are + /// explicitly assigned. However, in some cases, the reviewers may not + /// be assigned and instead be chosen dynamically. For example managers + /// review or self review. Possible values include: 'Assigned', 'Self', + /// 'Managers' + /// This is the collection of instances + /// returned when one does an expand on it. + public AccessReviewScheduleDefinitionProperties(string displayName = default(string), string status = default(string), string descriptionForAdmins = default(string), string descriptionForReviewers = default(string), AccessReviewActorIdentity createdBy = default(AccessReviewActorIdentity), AccessReviewScheduleSettings settings = default(AccessReviewScheduleSettings), AccessReviewScope scope = default(AccessReviewScope), IList reviewers = default(IList), IList backupReviewers = default(IList), string reviewersType = default(string), IList instances = default(IList)) + { + DisplayName = displayName; + Status = status; + DescriptionForAdmins = descriptionForAdmins; + DescriptionForReviewers = descriptionForReviewers; + CreatedBy = createdBy; + Settings = settings; + Scope = scope; + Reviewers = reviewers; + BackupReviewers = backupReviewers; + ReviewersType = reviewersType; + Instances = instances; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the display name for the schedule definition. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets this read-only field specifies the status of an accessReview. + /// Possible values include: 'NotStarted', 'InProgress', 'Completed', + /// 'Applied', 'Initializing', 'Applying', 'Completing', 'Scheduled', + /// 'AutoReviewing', 'AutoReviewed', 'Starting' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets or sets the description provided by the access review creator + /// and visible to admins. + /// + [JsonProperty(PropertyName = "descriptionForAdmins")] + public string DescriptionForAdmins { get; set; } + + /// + /// Gets or sets the description provided by the access review creator + /// to be shown to reviewers. + /// + [JsonProperty(PropertyName = "descriptionForReviewers")] + public string DescriptionForReviewers { get; set; } + + /// + /// Gets the user or other identity who created this review. + /// + [JsonProperty(PropertyName = "createdBy")] + public AccessReviewActorIdentity CreatedBy { get; private set; } + + /// + /// Gets or sets access Review Settings. + /// + [JsonProperty(PropertyName = "settings")] + public AccessReviewScheduleSettings Settings { get; set; } + + /// + /// Gets this is used to define what to include in scope of the review. + /// The scope definition includes the resourceId and roleDefinitionId. + /// + [JsonProperty(PropertyName = "scope")] + public AccessReviewScope Scope { get; private set; } + + /// + /// Gets or sets this is the collection of reviewers. + /// + [JsonProperty(PropertyName = "reviewers")] + public IList Reviewers { get; set; } + + /// + /// Gets or sets this is the collection of backup reviewers. + /// + [JsonProperty(PropertyName = "backupReviewers")] + public IList BackupReviewers { get; set; } + + /// + /// Gets this field specifies the type of reviewers for a review. + /// Usually for a review, reviewers are explicitly assigned. However, + /// in some cases, the reviewers may not be assigned and instead be + /// chosen dynamically. For example managers review or self review. + /// Possible values include: 'Assigned', 'Self', 'Managers' + /// + [JsonProperty(PropertyName = "reviewersType")] + public string ReviewersType { get; private set; } + + /// + /// Gets or sets this is the collection of instances returned when one + /// does an expand on it. + /// + [JsonProperty(PropertyName = "instances")] + public IList Instances { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinitionReviewersType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinitionReviewersType.cs new file mode 100644 index 000000000000..d3816a697d8a --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinitionReviewersType.cs @@ -0,0 +1,23 @@ +// +// 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 +{ + + /// + /// Defines values for AccessReviewScheduleDefinitionReviewersType. + /// + public static class AccessReviewScheduleDefinitionReviewersType + { + public const string Assigned = "Assigned"; + public const string Self = "Self"; + public const string Managers = "Managers"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinitionStatus.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinitionStatus.cs new file mode 100644 index 000000000000..dd6f443c55cb --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinitionStatus.cs @@ -0,0 +1,31 @@ +// +// 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 +{ + + /// + /// Defines values for AccessReviewScheduleDefinitionStatus. + /// + public static class AccessReviewScheduleDefinitionStatus + { + public const string NotStarted = "NotStarted"; + public const string InProgress = "InProgress"; + public const string Completed = "Completed"; + public const string Applied = "Applied"; + public const string Initializing = "Initializing"; + public const string Applying = "Applying"; + public const string Completing = "Completing"; + public const string Scheduled = "Scheduled"; + public const string AutoReviewing = "AutoReviewing"; + public const string AutoReviewed = "AutoReviewed"; + public const string Starting = "Starting"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleSettings.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleSettings.cs new file mode 100644 index 000000000000..f6a9d10508fb --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleSettings.cs @@ -0,0 +1,166 @@ +// +// 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; + + /// + /// Settings of an Access Review. + /// + public partial class AccessReviewScheduleSettings + { + /// + /// Initializes a new instance of the AccessReviewScheduleSettings + /// class. + /// + public AccessReviewScheduleSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessReviewScheduleSettings + /// class. + /// + /// Flag to indicate whether + /// sending mails to reviewers and the review creator is + /// enabled. + /// Flag to indicate whether + /// sending reminder emails to reviewers are enabled. + /// Flag to indicate whether + /// reviewers are required to provide a justification when reviewing + /// access. + /// Flag to indicate + /// whether the reviewer is required to pass justification when + /// recording a decision. + /// This specifies the behavior for the + /// autoReview feature when an access review completes. Possible values + /// include: 'Approve', 'Deny', 'Recommendation' + /// Flag to indicate whether + /// auto-apply capability, to automatically change the target object + /// access resource, is enabled. If not enabled, a user must, after the + /// review completes, apply the access review. + /// Flag to indicate whether + /// showing recommendations to reviewers is enabled. + /// Recommendations for + /// access reviews are calculated by looking back at 30 days of + /// data(w.r.t the start date of the review) by default. However, in + /// some scenarios, customers want to change how far back to look at + /// and want to configure 60 days, 90 days, etc. instead. This setting + /// allows customers to configure this duration. The value should be in + /// ISO 8601 format + /// (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be + /// used to convert TimeSpan to a valid interval string: + /// XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)) + /// The duration in days for an + /// instance. + /// Access Review Settings. + public AccessReviewScheduleSettings(bool? mailNotificationsEnabled = default(bool?), bool? reminderNotificationsEnabled = default(bool?), bool? defaultDecisionEnabled = default(bool?), bool? justificationRequiredOnApproval = default(bool?), string defaultDecision = default(string), bool? autoApplyDecisionsEnabled = default(bool?), bool? recommendationsEnabled = default(bool?), System.TimeSpan? recommendationLookBackDuration = default(System.TimeSpan?), int? instanceDurationInDays = default(int?), AccessReviewRecurrenceSettings recurrence = default(AccessReviewRecurrenceSettings)) + { + MailNotificationsEnabled = mailNotificationsEnabled; + ReminderNotificationsEnabled = reminderNotificationsEnabled; + DefaultDecisionEnabled = defaultDecisionEnabled; + JustificationRequiredOnApproval = justificationRequiredOnApproval; + DefaultDecision = defaultDecision; + AutoApplyDecisionsEnabled = autoApplyDecisionsEnabled; + RecommendationsEnabled = recommendationsEnabled; + RecommendationLookBackDuration = recommendationLookBackDuration; + InstanceDurationInDays = instanceDurationInDays; + Recurrence = recurrence; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets flag to indicate whether sending mails to reviewers + /// and the review creator is enabled. + /// + [JsonProperty(PropertyName = "mailNotificationsEnabled")] + public bool? MailNotificationsEnabled { get; set; } + + /// + /// Gets or sets flag to indicate whether sending reminder emails to + /// reviewers are enabled. + /// + [JsonProperty(PropertyName = "reminderNotificationsEnabled")] + public bool? ReminderNotificationsEnabled { get; set; } + + /// + /// Gets or sets flag to indicate whether reviewers are required to + /// provide a justification when reviewing access. + /// + [JsonProperty(PropertyName = "defaultDecisionEnabled")] + public bool? DefaultDecisionEnabled { get; set; } + + /// + /// Gets or sets flag to indicate whether the reviewer is required to + /// pass justification when recording a decision. + /// + [JsonProperty(PropertyName = "justificationRequiredOnApproval")] + public bool? JustificationRequiredOnApproval { get; set; } + + /// + /// Gets or sets this specifies the behavior for the autoReview feature + /// when an access review completes. Possible values include: + /// 'Approve', 'Deny', 'Recommendation' + /// + [JsonProperty(PropertyName = "defaultDecision")] + public string DefaultDecision { get; set; } + + /// + /// Gets or sets flag to indicate whether auto-apply capability, to + /// automatically change the target object access resource, is enabled. + /// If not enabled, a user must, after the review completes, apply the + /// access review. + /// + [JsonProperty(PropertyName = "autoApplyDecisionsEnabled")] + public bool? AutoApplyDecisionsEnabled { get; set; } + + /// + /// Gets or sets flag to indicate whether showing recommendations to + /// reviewers is enabled. + /// + [JsonProperty(PropertyName = "recommendationsEnabled")] + public bool? RecommendationsEnabled { get; set; } + + /// + /// Gets or sets recommendations for access reviews are calculated by + /// looking back at 30 days of data(w.r.t the start date of the review) + /// by default. However, in some scenarios, customers want to change + /// how far back to look at and want to configure 60 days, 90 days, + /// etc. instead. This setting allows customers to configure this + /// duration. The value should be in ISO 8601 format + /// (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be + /// used to convert TimeSpan to a valid interval string: + /// XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)) + /// + [JsonProperty(PropertyName = "recommendationLookBackDuration")] + public System.TimeSpan? RecommendationLookBackDuration { get; set; } + + /// + /// Gets or sets the duration in days for an instance. + /// + [JsonProperty(PropertyName = "instanceDurationInDays")] + public int? InstanceDurationInDays { get; set; } + + /// + /// Gets or sets access Review Settings. + /// + [JsonProperty(PropertyName = "recurrence")] + public AccessReviewRecurrenceSettings Recurrence { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScope.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScope.cs new file mode 100644 index 000000000000..f420d3a36d7b --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScope.cs @@ -0,0 +1,110 @@ +// +// 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; + + /// + /// Descriptor for what needs to be reviewed + /// + public partial class AccessReviewScope + { + /// + /// Initializes a new instance of the AccessReviewScope class. + /// + public AccessReviewScope() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessReviewScope class. + /// + /// ResourceId in which this review is getting + /// created + /// This is used to indicate the role + /// being reviewed + /// The identity type user/servicePrincipal + /// to review. Possible values include: 'user', 'guestUser', + /// 'servicePrincipal', 'user,group', 'redeemedGuestUser' + /// The role assignment state + /// eligible/active to review. Possible values include: 'eligible', + /// 'active' + /// Duration users are inactive for. The + /// value should be in ISO 8601 format + /// (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be + /// used to convert TimeSpan to a valid interval string: + /// XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)) + /// Flag to indicate whether to + /// expand nested memberships or not. + public AccessReviewScope(string resourceId = default(string), string roleDefinitionId = default(string), string principalType = default(string), string assignmentState = default(string), System.TimeSpan? inactiveDuration = default(System.TimeSpan?), bool? expandNestedMemberships = default(bool?)) + { + ResourceId = resourceId; + RoleDefinitionId = roleDefinitionId; + PrincipalType = principalType; + AssignmentState = assignmentState; + InactiveDuration = inactiveDuration; + ExpandNestedMemberships = expandNestedMemberships; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resourceId in which this review is getting created + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; private set; } + + /// + /// Gets this is used to indicate the role being reviewed + /// + [JsonProperty(PropertyName = "roleDefinitionId")] + public string RoleDefinitionId { get; private set; } + + /// + /// Gets the identity type user/servicePrincipal to review. Possible + /// values include: 'user', 'guestUser', 'servicePrincipal', + /// 'user,group', 'redeemedGuestUser' + /// + [JsonProperty(PropertyName = "principalType")] + public string PrincipalType { get; private set; } + + /// + /// Gets the role assignment state eligible/active to review. Possible + /// values include: 'eligible', 'active' + /// + [JsonProperty(PropertyName = "assignmentState")] + public string AssignmentState { get; private set; } + + /// + /// Gets or sets duration users are inactive for. The value should be + /// in ISO 8601 format + /// (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be + /// used to convert TimeSpan to a valid interval string: + /// XmlConvert.ToString(new TimeSpan(hours, minutes, seconds)) + /// + [JsonProperty(PropertyName = "inactiveDuration")] + public System.TimeSpan? InactiveDuration { get; set; } + + /// + /// Gets or sets flag to indicate whether to expand nested memberships + /// or not. + /// + [JsonProperty(PropertyName = "expandNestedMemberships")] + public bool? ExpandNestedMemberships { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScopeAssignmentState.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScopeAssignmentState.cs new file mode 100644 index 000000000000..8de2ae4f00f8 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScopeAssignmentState.cs @@ -0,0 +1,22 @@ +// +// 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 +{ + + /// + /// Defines values for AccessReviewScopeAssignmentState. + /// + public static class AccessReviewScopeAssignmentState + { + public const string Eligible = "eligible"; + public const string Active = "active"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScopePrincipalType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScopePrincipalType.cs new file mode 100644 index 000000000000..ad1fdc25cc34 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScopePrincipalType.cs @@ -0,0 +1,25 @@ +// +// 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 +{ + + /// + /// Defines values for AccessReviewScopePrincipalType. + /// + public static class AccessReviewScopePrincipalType + { + public const string User = "user"; + public const string GuestUser = "guestUser"; + public const string ServicePrincipal = "servicePrincipal"; + public const string Usergroup = "user,group"; + public const string RedeemedGuestUser = "redeemedGuestUser"; + } +} 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/DefaultDecisionType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/DefaultDecisionType.cs new file mode 100644 index 000000000000..dd8e51e35f8e --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/DefaultDecisionType.cs @@ -0,0 +1,23 @@ +// +// 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 +{ + + /// + /// Defines values for DefaultDecisionType. + /// + public static class DefaultDecisionType + { + public const string Approve = "Approve"; + public const string Deny = "Deny"; + public const string Recommendation = "Recommendation"; + } +} 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/ErrorAdditionalInfo.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorAdditionalInfo.cs deleted file mode 100644 index 08e4d8460cfd..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorAdditionalInfo.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; - - /// - /// The resource management error additional info. - /// - public partial class ErrorAdditionalInfo - { - /// - /// Initializes a new instance of the ErrorAdditionalInfo class. - /// - public ErrorAdditionalInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorAdditionalInfo class. - /// - /// The additional info type. - /// The additional info. - public ErrorAdditionalInfo(string type = default(string), object info = default(object)) - { - Type = type; - Info = info; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the additional info type. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets the additional info. - /// - [JsonProperty(PropertyName = "info")] - public object Info { get; private set; } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorResponse.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinition.cs similarity index 62% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorResponse.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinition.cs index 85201d33aa1e..6db4194cd4b9 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorResponse.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinition.cs @@ -14,28 +14,26 @@ namespace Microsoft.Azure.Management.Authorization.Models using System.Linq; /// - /// Error response + /// Error /// /// - /// Common error response for all Azure Resource Manager APIs to return - /// error details for failed operations. (This also follows the OData error - /// response format.). + /// Error description and code explaining why an operation failed. /// - public partial class ErrorResponse + public partial class ErrorDefinition { /// - /// Initializes a new instance of the ErrorResponse class. + /// Initializes a new instance of the ErrorDefinition class. /// - public ErrorResponse() + public ErrorDefinition() { CustomInit(); } /// - /// Initializes a new instance of the ErrorResponse class. + /// Initializes a new instance of the ErrorDefinition class. /// - /// The error object. - public ErrorResponse(ErrorDetail error = default(ErrorDetail)) + /// Error of the list gateway status. + public ErrorDefinition(ErrorDefinitionProperties error = default(ErrorDefinitionProperties)) { Error = error; CustomInit(); @@ -47,10 +45,10 @@ public ErrorResponse() partial void CustomInit(); /// - /// Gets or sets the error object. + /// Gets or sets error of the list gateway status. /// [JsonProperty(PropertyName = "error")] - public ErrorDetail Error { get; set; } + public ErrorDefinitionProperties Error { get; set; } } } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorResponseException.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinitionException.cs similarity index 70% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorResponseException.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinitionException.cs index 061d84c9b444..f83c8edbbb2e 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorResponseException.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinitionException.cs @@ -13,10 +13,10 @@ namespace Microsoft.Azure.Management.Authorization.Models using Microsoft.Rest; /// - /// Exception thrown for an invalid response with ErrorResponse + /// Exception thrown for an invalid response with ErrorDefinition /// information. /// - public partial class ErrorResponseException : RestException + public partial class ErrorDefinitionException : RestException { /// /// Gets information about the associated HTTP request. @@ -31,30 +31,30 @@ public partial class ErrorResponseException : RestException /// /// Gets or sets the body object. /// - public ErrorResponse Body { get; set; } + public ErrorDefinition Body { get; set; } /// - /// Initializes a new instance of the ErrorResponseException class. + /// Initializes a new instance of the ErrorDefinitionException class. /// - public ErrorResponseException() + public ErrorDefinitionException() { } /// - /// Initializes a new instance of the ErrorResponseException class. + /// Initializes a new instance of the ErrorDefinitionException class. /// /// The exception message. - public ErrorResponseException(string message) + public ErrorDefinitionException(string message) : this(message, null) { } /// - /// Initializes a new instance of the ErrorResponseException class. + /// Initializes a new instance of the ErrorDefinitionException class. /// /// The exception message. /// Inner exception. - public ErrorResponseException(string message, System.Exception innerException) + public ErrorDefinitionException(string message, System.Exception innerException) : base(message, innerException) { } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ValidationResponseErrorInfo.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinitionProperties.cs similarity index 59% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ValidationResponseErrorInfo.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinitionProperties.cs index 46c7133225fe..3a0052cf6c9b 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ValidationResponseErrorInfo.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinitionProperties.cs @@ -14,31 +14,30 @@ namespace Microsoft.Azure.Management.Authorization.Models using System.Linq; /// - /// Failed validation result details + /// Error /// - public partial class ValidationResponseErrorInfo + /// + /// Error description and code explaining why an operation failed. + /// + public partial class ErrorDefinitionProperties { /// - /// Initializes a new instance of the ValidationResponseErrorInfo - /// class. + /// Initializes a new instance of the ErrorDefinitionProperties class. /// - public ValidationResponseErrorInfo() + public ErrorDefinitionProperties() { CustomInit(); } /// - /// Initializes a new instance of the ValidationResponseErrorInfo - /// class. + /// Initializes a new instance of the ErrorDefinitionProperties class. /// - /// Error code indicating why validation - /// failed - /// Message indicating why validation - /// failed - public ValidationResponseErrorInfo(string code = default(string), string message = default(string)) + /// Description of the error. + /// Error code of list gateway. + public ErrorDefinitionProperties(string message = default(string), string code = default(string)) { - Code = code; Message = message; + Code = code; CustomInit(); } @@ -48,16 +47,16 @@ public ValidationResponseErrorInfo() partial void CustomInit(); /// - /// Gets error code indicating why validation failed + /// Gets description of the error. /// - [JsonProperty(PropertyName = "code")] - public string Code { get; private set; } + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } /// - /// Gets message indicating why validation failed + /// Gets or sets error code of list gateway. /// - [JsonProperty(PropertyName = "message")] - public string Message { get; private set; } + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } } } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDetail.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDetail.cs deleted file mode 100644 index 40e1b30c1c36..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDetail.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; - - /// - /// The error detail. - /// - public partial class ErrorDetail - { - /// - /// Initializes a new instance of the ErrorDetail class. - /// - public ErrorDetail() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorDetail class. - /// - /// The error code. - /// The error message. - /// The error target. - /// The error details. - /// The error additional info. - public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) - { - Code = code; - Message = message; - Target = target; - Details = details; - AdditionalInfo = additionalInfo; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the error code. - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; private set; } - - /// - /// Gets the error message. - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; private set; } - - /// - /// Gets the error target. - /// - [JsonProperty(PropertyName = "target")] - public string Target { get; private set; } - - /// - /// Gets the error details. - /// - [JsonProperty(PropertyName = "details")] - public IList Details { get; private set; } - - /// - /// Gets the error additional info. - /// - [JsonProperty(PropertyName = "additionalInfo")] - public IList AdditionalInfo { get; private set; } - - } -} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Operation.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..68104f9215d2 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Operation.cs @@ -0,0 +1,76 @@ +// +// 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; + + /// + /// The definition of a Microsoft.Authorization operation. + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// Name of the operation + /// Indicates whether the operation is a + /// data action + /// Display of the operation + /// Origin of the operation + public Operation(string name = default(string), bool? isDataAction = default(bool?), OperationDisplay display = default(OperationDisplay), string origin = default(string)) + { + Name = name; + IsDataAction = isDataAction; + Display = display; + Origin = origin; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the operation + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets indicates whether the operation is a data action + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { get; set; } + + /// + /// Gets or sets display of the operation + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + /// + /// Gets or sets origin of the operation + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/OperationDisplay.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..aec82513e256 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,79 @@ +// +// 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; + + /// + /// The display information for a Microsoft.Authorization operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// The resource provider name: + /// Microsoft.Authorization. + /// The resource on which the operation is + /// performed. + /// The operation that users can + /// perform. + /// The description for the + /// operation. + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the resource provider name: Microsoft.Authorization. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; private set; } + + /// + /// Gets the resource on which the operation is performed. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; private set; } + + /// + /// Gets the operation that users can perform. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; private set; } + + /// + /// Gets the description for the operation. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private 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/PrincipalType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PrincipalType.cs deleted file mode 100644 index 7c3471cf80d5..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PrincipalType.cs +++ /dev/null @@ -1,30 +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 -{ - - /// - /// Defines values for PrincipalType. - /// - public static class PrincipalType - { - public const string User = "User"; - public const string Group = "Group"; - public const string ServicePrincipal = "ServicePrincipal"; - public const string Unknown = "Unknown"; - public const string DirectoryRoleTemplate = "DirectoryRoleTemplate"; - public const string ForeignGroup = "ForeignGroup"; - public const string Application = "Application"; - public const string MSI = "MSI"; - public const string DirectoryObjectOrGroup = "DirectoryObjectOrGroup"; - public const string Everyone = "Everyone"; - } -} 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 deleted file mode 100644 index 057818fd2851..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignment.cs +++ /dev/null @@ -1,202 +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.Azure; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Role Assignments - /// - [Rest.Serialization.JsonTransformation] - public partial class RoleAssignment : IResource - { - /// - /// Initializes a new instance of the RoleAssignment class. - /// - public RoleAssignment() - { - CustomInit(); - } - - /// - /// 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 principal type of the assigned - /// principal ID. Possible values include: 'User', 'Group', - /// 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', - /// 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', - /// 'Everyone' - /// Description of role assignment - /// 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 - /// Id of the user who updated the - /// 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)) - { - Id = id; - Name = name; - Type = type; - Scope = scope; - RoleDefinitionId = roleDefinitionId; - PrincipalId = principalId; - PrincipalType = principalType; - Description = description; - Condition = condition; - ConditionVersion = conditionVersion; - CreatedOn = createdOn; - UpdatedOn = updatedOn; - CreatedBy = createdBy; - UpdatedBy = updatedBy; - DelegatedManagedIdentityResourceId = delegatedManagedIdentityResourceId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the role assignment ID. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets the role assignment name. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets the role assignment type. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets the role assignment scope. - /// - [JsonProperty(PropertyName = "properties.scope")] - public string Scope { get; private set; } - - /// - /// Gets or sets the role definition ID. - /// - [JsonProperty(PropertyName = "properties.roleDefinitionId")] - public string RoleDefinitionId { get; set; } - - /// - /// Gets or sets the principal ID. - /// - [JsonProperty(PropertyName = "properties.principalId")] - public string PrincipalId { get; set; } - - /// - /// Gets or sets the principal type of the assigned principal ID. - /// Possible values include: 'User', 'Group', 'ServicePrincipal', - /// 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', - /// 'MSI', 'DirectoryObjectOrGroup', 'Everyone' - /// - [JsonProperty(PropertyName = "properties.principalType")] - public string PrincipalType { get; set; } - - /// - /// Gets or sets description of role assignment - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// 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. Currently accepted value is - /// '2.0' - /// - [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 - /// - [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 deleted file mode 100644 index 61d6d8f5cb3e..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentCreateParameters.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.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Role assignment create parameters. - /// - [Rest.Serialization.JsonTransformation] - public partial class RoleAssignmentCreateParameters - { - /// - /// Initializes a new instance of the RoleAssignmentCreateParameters - /// class. - /// - public RoleAssignmentCreateParameters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RoleAssignmentCreateParameters - /// class. - /// - /// The role definition ID. - /// The principal ID. - /// The role assignment scope. - /// The principal type of the assigned - /// principal ID. Possible values include: 'User', 'Group', - /// 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', - /// 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', - /// 'Everyone' - /// Description of role assignment - /// 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 - /// 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)) - { - Scope = scope; - RoleDefinitionId = roleDefinitionId; - PrincipalId = principalId; - PrincipalType = principalType; - Description = description; - Condition = condition; - ConditionVersion = conditionVersion; - CreatedOn = createdOn; - UpdatedOn = updatedOn; - CreatedBy = createdBy; - UpdatedBy = updatedBy; - DelegatedManagedIdentityResourceId = delegatedManagedIdentityResourceId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - 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. - /// - [JsonProperty(PropertyName = "properties.roleDefinitionId")] - public string RoleDefinitionId { get; set; } - - /// - /// Gets or sets the principal ID. - /// - [JsonProperty(PropertyName = "properties.principalId")] - public string PrincipalId { get; set; } - - /// - /// Gets or sets the principal type of the assigned principal ID. - /// Possible values include: 'User', 'Group', 'ServicePrincipal', - /// 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', - /// 'MSI', 'DirectoryObjectOrGroup', 'Everyone' - /// - [JsonProperty(PropertyName = "properties.principalType")] - public string PrincipalType { get; set; } - - /// - /// Gets or sets description of role assignment - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// 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. Currently accepted value is - /// '2.0' - /// - [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 - /// - [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/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/ClassicAdministratorsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Operations.cs similarity index 83% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperations.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Operations.cs index dda58ecb8687..9dce00955bb5 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Operations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Authorization using System.Threading.Tasks; /// - /// ClassicAdministratorsOperations operations. + /// Operations operations. /// - internal partial class ClassicAdministratorsOperations : IServiceOperations, IClassicAdministratorsOperations + internal partial class Operations : IServiceOperations, IOperations { /// - /// Initializes a new instance of the ClassicAdministratorsOperations class. + /// Initializes a new instance of the Operations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class ClassicAdministratorsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ClassicAdministratorsOperations(AuthorizationManagementClient client) + internal Operations(AuthorizationManagementClient client) { if (client == null) { @@ -51,8 +51,7 @@ internal ClassicAdministratorsOperations(AuthorizationManagementClient client) public AuthorizationManagementClient Client { get; private set; } /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. + /// Lists the operations available from this provider. /// /// /// Headers that will be added to request. @@ -60,7 +59,7 @@ internal ClassicAdministratorsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -75,20 +74,12 @@ internal ClassicAdministratorsOperations(AuthorizationManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.SubscriptionId == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - 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; @@ -96,18 +87,16 @@ internal ClassicAdministratorsOperations(AuthorizationManagementClient client) { _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)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Authorization/operations").ToString(); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -169,11 +158,11 @@ internal ClassicAdministratorsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -197,7 +186,7 @@ internal ClassicAdministratorsOperations(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")) @@ -210,7 +199,7 @@ internal ClassicAdministratorsOperations(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) { @@ -230,8 +219,7 @@ internal ClassicAdministratorsOperations(AuthorizationManagementClient client) } /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. + /// Lists the operations available from this provider. /// /// /// The NextLink from the previous successful call to List operation. @@ -242,7 +230,7 @@ internal ClassicAdministratorsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -257,7 +245,7 @@ internal ClassicAdministratorsOperations(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) { @@ -338,11 +326,11 @@ internal ClassicAdministratorsOperations(AuthorizationManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDefinitionException(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); + ErrorDefinition _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -366,7 +354,7 @@ internal ClassicAdministratorsOperations(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")) @@ -379,7 +367,7 @@ internal ClassicAdministratorsOperations(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) { diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/OperationsExtensions.cs similarity index 66% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperationsExtensions.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/OperationsExtensions.cs index 96543f2d5cef..8ee29a4cf57c 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperationsExtensions.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/OperationsExtensions.cs @@ -17,25 +17,23 @@ namespace Microsoft.Azure.Management.Authorization using System.Threading.Tasks; /// - /// Extension methods for ClassicAdministratorsOperations. + /// Extension methods for Operations. /// - public static partial class ClassicAdministratorsOperationsExtensions + public static partial class OperationsExtensions { /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. + /// Lists the operations available from this provider. /// /// /// The operations group for this extension method. /// - public static IPage List(this IClassicAdministratorsOperations operations) + public static IPage List(this IOperations operations) { return operations.ListAsync().GetAwaiter().GetResult(); } /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. + /// Lists the operations available from this provider. /// /// /// The operations group for this extension method. @@ -43,7 +41,7 @@ public static IPage List(this IClassicAdministratorsOperat /// /// The cancellation token. /// - public static async Task> ListAsync(this IClassicAdministratorsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { @@ -52,8 +50,7 @@ public static IPage List(this IClassicAdministratorsOperat } /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. + /// Lists the operations available from this provider. /// /// /// The operations group for this extension method. @@ -61,14 +58,13 @@ public static IPage List(this IClassicAdministratorsOperat /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListNext(this IClassicAdministratorsOperations operations, string nextPageLink) + public static IPage ListNext(this IOperations operations, string nextPageLink) { return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. + /// Lists the operations available from this provider. /// /// /// The operations group for this extension method. @@ -79,7 +75,7 @@ public static IPage ListNext(this IClassicAdministratorsOp /// /// The cancellation token. /// - public static async Task> ListNextAsync(this IClassicAdministratorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { 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/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 deleted file mode 100644 index bd39b807d647..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperations.cs +++ /dev/null @@ -1,3196 +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; - - /// - /// RoleAssignmentsOperations operations. - /// - internal partial class RoleAssignmentsOperations : IServiceOperations, IRoleAssignmentsOperations - { - /// - /// Initializes a new instance of the RoleAssignmentsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal RoleAssignmentsOperations(AuthorizationManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the AuthorizationManagementClient - /// - public AuthorizationManagementClient Client { get; private set; } - - /// - /// List all role assignments that apply to a subscription. - /// - /// - /// 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>> ListForSubscriptionWithHttpMessagesAsync(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) - { - _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; - } - - /// - /// 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"); - } - 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 = "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("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("tenantId", tenantId); - 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/roleAssignments").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 (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) - { - _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; - } - - /// - /// List all role assignments that apply to a resource. - /// - /// - /// 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 - /// - /// - /// 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 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); - } - } - 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 (resourceType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); - } - if (resourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); - } - 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("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); - } - // 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)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{resourceProviderNamespace}", resourceProviderNamespace); - _url = _url.Replace("{resourceType}", resourceType); - _url = _url.Replace("{resourceName}", 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 (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) - { - _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 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> GetWithHttpMessagesAsync(string scope, string roleAssignmentName, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - if (roleAssignmentName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentName"); - } - 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("apiVersion", apiVersion); - tracingParameters.Add("tenantId", tenantId); - 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/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 (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) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Create or update a 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. - /// - /// - /// Parameters for the role assignment. - /// - /// - /// 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> CreateWithHttpMessagesAsync(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - if (roleAssignmentName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - 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) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - if (roleAssignmentName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentName"); - } - 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("apiVersion", apiVersion); - tracingParameters.Add("tenantId", tenantId); - 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/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 (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("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; - } - - /// - /// 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. - /// - /// - /// 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> ValidateWithHttpMessagesAsync(string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - if (roleAssignmentName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - 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, "Validate", 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(); - _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("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; - 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) - { - 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; - } - - /// - /// List all role assignments that apply to a scope. - /// - /// - /// 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. - /// - /// - /// 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>> ListForScopeWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - string apiVersion = "2020-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("scope", scope); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("tenantId", tenantId); - 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/roleAssignments").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 (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) - { - _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 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> - /// - /// - /// 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> GetByIdWithHttpMessagesAsync(string roleAssignmentId, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (roleAssignmentId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentId"); - } - 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("roleAssignmentId", roleAssignmentId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("tenantId", tenantId); - 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("/") ? "" : "/")), "{roleAssignmentId}").ToString(); - _url = _url.Replace("{roleAssignmentId}", roleAssignmentId); - List _queryParameters = new List(); - 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) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Create or update a 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> - /// - /// - /// Parameters for the role assignment. - /// - /// - /// 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> CreateByIdWithHttpMessagesAsync(string roleAssignmentId, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (roleAssignmentId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentId"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - 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("roleAssignmentId", roleAssignmentId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - 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); - 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 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> - /// - /// - /// 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> DeleteByIdWithHttpMessagesAsync(string roleAssignmentId, string tenantId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (roleAssignmentId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentId"); - } - 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("roleAssignmentId", roleAssignmentId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("tenantId", tenantId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteById", 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); - List _queryParameters = new List(); - 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("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; - } - - /// - /// Validate a role assignment create or update operation 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> - /// - /// - /// Parameters for the role assignment. - /// - /// - /// 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> ValidateByIdWithHttpMessagesAsync(string roleAssignmentId, RoleAssignmentCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (roleAssignmentId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentId"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - 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("roleAssignmentId", roleAssignmentId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ValidateById", 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); - 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; - 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) - { - 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; - } - - /// - /// List all role assignments that apply to a 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>> ListForSubscriptionNextWithHttpMessagesAsync(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, "ListForSubscriptionNext", 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; - } - - /// - /// List all role assignments that apply to 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; - } - - /// - /// List all role assignments that apply to 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; - } - - /// - /// List all role assignments that apply to 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/RoleAssignmentsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperationsExtensions.cs deleted file mode 100644 index 65d8d7935dbc..000000000000 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperationsExtensions.cs +++ /dev/null @@ -1,776 +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 RoleAssignmentsOperations. - /// - public static partial class RoleAssignmentsOperationsExtensions - { - /// - /// List all role assignments that apply to a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// Tenant ID for cross-tenant request - /// - 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. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// 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)) - { - using (var _result = await operations.ListForSubscriptionWithHttpMessagesAsync(odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List all role assignments that apply to 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. - /// - /// - /// Tenant ID for cross-tenant request - /// - public static IPage ListForResourceGroup(this IRoleAssignmentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string)) - { - return operations.ListForResourceGroupAsync(resourceGroupName, odataQuery, tenantId).GetAwaiter().GetResult(); - } - - /// - /// List all role assignments that apply to 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. - /// - /// - /// Tenant ID for cross-tenant request - /// - /// - /// 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)) - { - using (var _result = await operations.ListForResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List all role assignments that apply to 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 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)) - { - return operations.ListForResourceAsync(resourceGroupName, resourceProviderNamespace, resourceType, resourceName, odataQuery, tenantId).GetAwaiter().GetResult(); - } - - /// - /// List all role assignments that apply to 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 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 - /// - /// - /// 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)) - { - using (var _result = await operations.ListForResourceWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, resourceType, resourceName, odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get a role assignment 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. - /// - /// - /// Tenant ID for cross-tenant request - /// - public static RoleAssignment Get(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, string tenantId = default(string)) - { - return operations.GetAsync(scope, roleAssignmentName, tenantId).GetAwaiter().GetResult(); - } - - /// - /// Get a role assignment 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. - /// - /// - /// Tenant ID for cross-tenant request - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, string tenantId = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(scope, roleAssignmentName, tenantId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or update a role assignment 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 RoleAssignment Create(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, RoleAssignmentCreateParameters parameters) - { - return operations.CreateAsync(scope, roleAssignmentName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Create or update a role assignment 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 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)) - { - return _result.Body; - } - } - - /// - /// Delete a role assignment 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. - /// - /// - /// Tenant ID for cross-tenant request - /// - public static RoleAssignment Delete(this IRoleAssignmentsOperations operations, string scope, string roleAssignmentName, string tenantId = default(string)) - { - return operations.DeleteAsync(scope, roleAssignmentName, tenantId).GetAwaiter().GetResult(); - } - - /// - /// Delete a role assignment 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. - /// - /// - /// Tenant ID for cross-tenant request - /// - /// - /// 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)) - { - using (var _result = await operations.ValidateWithHttpMessagesAsync(scope, roleAssignmentName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List all role assignments that apply to a scope. - /// - /// - /// 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. - /// - /// - /// Tenant ID for cross-tenant request - /// - public static IPage ListForScope(this IRoleAssignmentsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery), string tenantId = default(string)) - { - return operations.ListForScopeAsync(scope, odataQuery, tenantId).GetAwaiter().GetResult(); - } - - /// - /// List all role assignments that apply to a scope. - /// - /// - /// 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. - /// - /// - /// Tenant ID for cross-tenant request - /// - /// - /// 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)) - { - using (var _result = await operations.ListForScopeWithHttpMessagesAsync(scope, odataQuery, tenantId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get 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> - /// - /// - /// Tenant ID for cross-tenant request - /// - public static RoleAssignment GetById(this IRoleAssignmentsOperations operations, string roleAssignmentId, string tenantId = default(string)) - { - return operations.GetByIdAsync(roleAssignmentId, tenantId).GetAwaiter().GetResult(); - } - - /// - /// Get 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> - /// - /// - /// Tenant ID for cross-tenant request - /// - /// - /// The cancellation token. - /// - public static async Task GetByIdAsync(this IRoleAssignmentsOperations operations, string roleAssignmentId, string tenantId = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetByIdWithHttpMessagesAsync(roleAssignmentId, tenantId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or update 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> - /// - /// - /// Parameters for the role assignment. - /// - public static RoleAssignment CreateById(this IRoleAssignmentsOperations operations, string roleAssignmentId, RoleAssignmentCreateParameters parameters) - { - return operations.CreateByIdAsync(roleAssignmentId, parameters).GetAwaiter().GetResult(); - } - - /// - /// Create or update 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> - /// - /// - /// Parameters for the role assignment. - /// - /// - /// The cancellation token. - /// - public static async Task CreateByIdAsync(this IRoleAssignmentsOperations operations, string roleAssignmentId, RoleAssignmentCreateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateByIdWithHttpMessagesAsync(roleAssignmentId, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete 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> - /// - /// - /// Tenant ID for cross-tenant request - /// - public static RoleAssignment DeleteById(this IRoleAssignmentsOperations operations, string roleAssignmentId, string tenantId = default(string)) - { - return operations.DeleteByIdAsync(roleAssignmentId, tenantId).GetAwaiter().GetResult(); - } - - /// - /// Delete 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> - /// - /// - /// Tenant ID for cross-tenant request - /// - /// - /// The cancellation token. - /// - public static async Task DeleteByIdAsync(this IRoleAssignmentsOperations operations, string roleAssignmentId, string tenantId = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.DeleteByIdWithHttpMessagesAsync(roleAssignmentId, tenantId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Validate a role assignment create or update operation 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> - /// - /// - /// Parameters for the role assignment. - /// - public static ValidationResponse ValidateById(this IRoleAssignmentsOperations operations, string roleAssignmentId, RoleAssignmentCreateParameters parameters) - { - return operations.ValidateByIdAsync(roleAssignmentId, parameters).GetAwaiter().GetResult(); - } - - /// - /// Validate a role assignment create or update operation 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> - /// - /// - /// Parameters for the role assignment. - /// - /// - /// The cancellation token. - /// - public static async Task ValidateByIdAsync(this IRoleAssignmentsOperations operations, string roleAssignmentId, RoleAssignmentCreateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ValidateByIdWithHttpMessagesAsync(roleAssignmentId, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List all role assignments that apply to a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListForSubscriptionNext(this IRoleAssignmentsOperations operations, string nextPageLink) - { - return operations.ListForSubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List all role assignments that apply to a 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> ListForSubscriptionNextAsync(this IRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListForSubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List all role assignments that apply to 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 IRoleAssignmentsOperations operations, string nextPageLink) - { - return operations.ListForResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List all role assignments that apply to 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 IRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListForResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List all role assignments that apply to a resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListForResourceNext(this IRoleAssignmentsOperations operations, string nextPageLink) - { - return operations.ListForResourceNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List all role assignments that apply to 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 IRoleAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListForResourceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List all role assignments that apply to a scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListForScopeNext(this IRoleAssignmentsOperations operations, string nextPageLink) - { - return operations.ListForScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List all role assignments that apply to 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 IRoleAssignmentsOperations 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/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..e9c0bd00f9f5 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,23 @@ 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", "AccessReviewDefaultSettings", "2021-11-16-preview"), + new Tuple("Authorization", "AccessReviewHistoryDefinition", "2021-11-16-preview"), + new Tuple("Authorization", "AccessReviewHistoryDefinitionInstance", "2021-11-16-preview"), + new Tuple("Authorization", "AccessReviewHistoryDefinitionInstances", "2021-11-16-preview"), + new Tuple("Authorization", "AccessReviewHistoryDefinitions", "2021-11-16-preview"), + new Tuple("Authorization", "AccessReviewInstance", "2021-11-16-preview"), + new Tuple("Authorization", "AccessReviewInstanceContactedReviewers", "2021-11-16-preview"), + new Tuple("Authorization", "AccessReviewInstanceDecisions", "2021-11-16-preview"), + new Tuple("Authorization", "AccessReviewInstanceMyDecisions", "2021-11-16-preview"), + new Tuple("Authorization", "AccessReviewInstances", "2021-11-16-preview"), + new Tuple("Authorization", "AccessReviewInstancesAssignedForMyApproval", "2021-11-16-preview"), + new Tuple("Authorization", "AccessReviewScheduleDefinitions", "2021-11-16-preview"), + new Tuple("Authorization", "AccessReviewScheduleDefinitionsAssignedForMyApproval", "2021-11-16-preview"), + new Tuple("Authorization", "Operations", "2021-11-16-preview"), + new Tuple("Authorization", "TenantLevelAccessReviewInstanceContactedReviewers", "2021-11-16-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 } } - diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/TenantLevelAccessReviewInstanceContactedReviewersOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/TenantLevelAccessReviewInstanceContactedReviewersOperations.cs new file mode 100644 index 000000000000..69184e7bbff6 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/TenantLevelAccessReviewInstanceContactedReviewersOperations.cs @@ -0,0 +1,408 @@ +// +// 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; + + /// + /// TenantLevelAccessReviewInstanceContactedReviewersOperations operations. + /// + internal partial class TenantLevelAccessReviewInstanceContactedReviewersOperations : IServiceOperations, ITenantLevelAccessReviewInstanceContactedReviewersOperations + { + /// + /// Initializes a new instance of the TenantLevelAccessReviewInstanceContactedReviewersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal TenantLevelAccessReviewInstanceContactedReviewersOperations(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 access review instance contacted reviewers + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// 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 scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (id == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "id"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("id", id); + 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/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/contactedReviewers").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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 access review instance contacted reviewers + /// + /// + /// 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 ErrorDefinitionException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDefinition _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/TenantLevelAccessReviewInstanceContactedReviewersOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/TenantLevelAccessReviewInstanceContactedReviewersOperationsExtensions.cs new file mode 100644 index 000000000000..babcbec496fd --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/TenantLevelAccessReviewInstanceContactedReviewersOperationsExtensions.cs @@ -0,0 +1,99 @@ +// +// 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 TenantLevelAccessReviewInstanceContactedReviewersOperations. + /// + public static partial class TenantLevelAccessReviewInstanceContactedReviewersOperationsExtensions + { + /// + /// Get access review instance contacted reviewers + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + public static IPage List(this ITenantLevelAccessReviewInstanceContactedReviewersOperations operations, string scheduleDefinitionId, string id) + { + return operations.ListAsync(scheduleDefinitionId, id).GetAwaiter().GetResult(); + } + + /// + /// Get access review instance contacted reviewers + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The id of the access review instance. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ITenantLevelAccessReviewInstanceContactedReviewersOperations operations, string scheduleDefinitionId, string id, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scheduleDefinitionId, id, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get access review instance contacted reviewers + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ITenantLevelAccessReviewInstanceContactedReviewersOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get access review instance contacted reviewers + /// + /// + /// 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 ITenantLevelAccessReviewInstanceContactedReviewersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}