From cb46e773f0737132ad3538e3413a1d0e2ceb46b2 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 2 Nov 2021 23:44:36 +0000 Subject: [PATCH] CodeGen from PR 16639 in Azure/azure-rest-api-specs Merge cf848c9f570c1157bbad81e214f5bb2993e578bb into 0fba9ba4b78d20fc1a7ec251dab889b7a7eb8afd --- .../AccessReviewDefaultSettingsOperations.cs | 424 +++++++ ...viewDefaultSettingsOperationsExtensions.cs | 87 ++ ...ccessReviewInstanceDecisionsOperations.cs} | 60 +- ...ewInstanceDecisionsOperationsExtensions.cs | 99 ++ ...cessReviewInstanceMyDecisionsOperations.cs | 806 ++++++++++++ ...InstanceMyDecisionsOperationsExtensions.cs | 197 +++ .../AccessReviewInstanceOperations.cs | 918 ++++++++++++++ ...ccessReviewInstanceOperationsExtensions.cs | 212 ++++ ...nstancesAssignedForMyApprovalOperations.cs | 581 +++++++++ ...signedForMyApprovalOperationsExtensions.cs | 133 ++ .../AccessReviewInstancesOperations.cs | 605 +++++++++ ...cessReviewInstancesOperationsExtensions.cs | 133 ++ ...initionsAssignedForMyApprovalOperations.cs | 382 ++++++ ...ignedForMyApprovalOperationsExtensions.cs} | 24 +- ...cessReviewScheduleDefinitionsOperations.cs | 1120 +++++++++++++++++ ...ScheduleDefinitionsOperationsExtensions.cs | 223 ++++ .../AuthorizationManagementClient.cs | 128 +- .../EligibleChildResourcesOperations.cs | 419 ++++++ ...gibleChildResourcesOperationsExtensions.cs | 107 ++ .../GlobalAdministratorOperations.cs | 193 --- ...GlobalAdministratorOperationsExtensions.cs | 50 - .../IAccessReviewDefaultSettingsOperations.cs | 68 + ...ccessReviewInstanceDecisionsOperations.cs} | 24 +- ...cessReviewInstanceMyDecisionsOperations.cs | 133 ++ .../IAccessReviewInstanceOperations.cs | 138 ++ ...nstancesAssignedForMyApprovalOperations.cs | 96 ++ .../IAccessReviewInstancesOperations.cs | 96 ++ ...initionsAssignedForMyApprovalOperations.cs | 68 + ...cessReviewScheduleDefinitionsOperations.cs | 153 +++ .../IAuthorizationManagementClient.cs | 100 +- .../IEligibleChildResourcesOperations.cs | 80 ++ .../IGlobalAdministratorOperations.cs | 43 - .../src/Generated/IOperations.cs | 68 + ...leAssignmentScheduleInstancesOperations.cs | 103 ++ ...oleAssignmentScheduleRequestsOperations.cs | 158 +++ .../IRoleAssignmentSchedulesOperations.cs | 100 ++ ...eEligibilityScheduleInstancesOperations.cs | 103 ++ ...leEligibilityScheduleRequestsOperations.cs | 158 +++ .../IRoleEligibilitySchedulesOperations.cs | 100 ++ .../IRoleManagementPoliciesOperations.cs | 146 +++ ...leManagementPolicyAssignmentsOperations.cs | 150 +++ .../Models/AccessRecommendationType.cs | 23 + .../Models/AccessReviewActorIdentityType.cs | 22 + .../Models/AccessReviewApplyResult.cs | 26 + .../Generated/Models/AccessReviewDecision.cs | 209 +++ .../Models/AccessReviewDecisionProperties.cs | 137 ++ .../Models/AccessReviewDecisionTarget.cs | 35 + .../Models/AccessReviewDefaultSettings.cs | 229 ++++ .../Generated/Models/AccessReviewInstance.cs | 106 ++ .../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 | 373 ++++++ ...ccessReviewScheduleDefinitionProperties.cs | 155 +++ ...ssReviewScheduleDefinitionReviewersType.cs | 23 + .../AccessReviewScheduleDefinitionStatus.cs | 31 + .../Models/AccessReviewScheduleSettings.cs | 141 +++ .../Models/AccessReviewScopePrincipalType.cs | 22 + .../src/Generated/Models/ApprovalMode.cs | 24 + .../src/Generated/Models/ApprovalSettings.cs | 92 ++ .../src/Generated/Models/ApprovalStage.cs | 104 ++ .../src/Generated/Models/AssignmentType.cs | 22 + .../Generated/Models/ClassicAdministrator.cs | 87 -- .../Generated/Models/DefaultDecisionType.cs | 23 + .../Generated/Models/EligibleChildResource.cs | 67 + .../src/Generated/Models/EnablementRules.cs | 23 + .../src/Generated/Models/ErrorDefinition.cs | 54 + .../Models/ErrorDefinitionException.cs | 62 + .../Models/ErrorDefinitionProperties.cs | 62 + .../Generated/Models/ExpandedProperties.cs | 64 + .../Models/ExpandedPropertiesPrincipal.cs | 77 ++ .../ExpandedPropertiesRoleDefinition.cs | 70 ++ .../Models/ExpandedPropertiesScope.cs | 67 + .../src/Generated/Models/MemberType.cs | 23 + .../Models/NotificationDeliveryMechanism.cs | 21 + .../src/Generated/Models/NotificationLevel.cs | 23 + .../src/Generated/Models/Operation.cs | 76 ++ .../src/Generated/Models/OperationDisplay.cs | 79 ++ .../Models/PolicyAssignmentProperties.cs | 64 + .../PolicyAssignmentPropertiesPolicy.cs | 68 + ...olicyAssignmentPropertiesRoleDefinition.cs | 70 ++ .../Models/PolicyAssignmentPropertiesScope.cs | 69 + .../src/Generated/Models/PolicyProperties.cs | 48 + .../Generated/Models/PolicyPropertiesScope.cs | 67 + .../src/Generated/Models/Principal.cs | 50 +- .../src/Generated/Models/PrincipalType.cs | 7 +- .../src/Generated/Models/RecipientType.cs | 23 + .../src/Generated/Models/RequestType.cs | 29 + .../src/Generated/Models/RoleAssignment.cs | 7 +- .../Models/RoleAssignmentCreateParameters.cs | 7 +- .../Models/RoleAssignmentSchedule.cs | 243 ++++ .../Models/RoleAssignmentScheduleFilter.cs | 75 ++ .../Models/RoleAssignmentScheduleInstance.cs | 257 ++++ .../RoleAssignmentScheduleInstanceFilter.cs | 86 ++ .../Models/RoleAssignmentScheduleRequest.cs | 288 +++++ .../RoleAssignmentScheduleRequestFilter.cs | 84 ++ ...ntScheduleRequestPropertiesScheduleInfo.cs | 63 + ...RequestPropertiesScheduleInfoExpiration.cs | 77 ++ ...mentScheduleRequestPropertiesTicketInfo.cs | 63 + .../Models/RoleEligibilitySchedule.cs | 222 ++++ .../Models/RoleEligibilityScheduleFilter.cs | 75 ++ .../Models/RoleEligibilityScheduleInstance.cs | 218 ++++ .../RoleEligibilityScheduleInstanceFilter.cs | 86 ++ .../Models/RoleEligibilityScheduleRequest.cs | 280 +++++ .../RoleEligibilityScheduleRequestFilter.cs | 84 ++ ...tyScheduleRequestPropertiesScheduleInfo.cs | 63 + ...RequestPropertiesScheduleInfoExpiration.cs | 77 ++ ...lityScheduleRequestPropertiesTicketInfo.cs | 63 + .../Generated/Models/RoleManagementPolicy.cs | 148 +++ .../RoleManagementPolicyApprovalRule.cs | 56 + .../Models/RoleManagementPolicyAssignment.cs | 107 ++ ...nagementPolicyAuthenticationContextRule.cs | 65 + .../RoleManagementPolicyEnablementRule.cs | 58 + .../RoleManagementPolicyExpirationRule.cs | 66 + .../RoleManagementPolicyNotificationRule.cs | 100 ++ .../Models/RoleManagementPolicyRule.cs | 59 + .../Models/RoleManagementPolicyRuleTarget.cs | 98 ++ .../Models/RoleManagementPolicyRuleType.cs | 25 + .../Models/ServicePrincipalDecisionTarget.cs | 74 ++ .../src/Generated/Models/Status.cs | 42 + .../src/Generated/Models/Type.cs | 23 + .../Generated/Models/UserDecisionTarget.cs | 71 ++ .../src/Generated/Models/UserSet.cs | 79 ++ .../src/Generated/Models/UserType.cs | 22 + .../src/Generated/Operations.cs | 382 ++++++ .../src/Generated/OperationsExtensions.cs | 87 ++ ...leAssignmentScheduleInstancesOperations.cs | 610 +++++++++ ...ntScheduleInstancesOperationsExtensions.cs | 142 +++ ...oleAssignmentScheduleRequestsOperations.cs | 992 +++++++++++++++ ...entScheduleRequestsOperationsExtensions.cs | 239 ++++ .../RoleAssignmentSchedulesOperations.cs | 609 +++++++++ ...AssignmentSchedulesOperationsExtensions.cs | 140 +++ .../Generated/RoleAssignmentsOperations.cs | 24 +- ...eEligibilityScheduleInstancesOperations.cs | 610 +++++++++ ...tyScheduleInstancesOperationsExtensions.cs | 142 +++ ...leEligibilityScheduleRequestsOperations.cs | 991 +++++++++++++++ ...ityScheduleRequestsOperationsExtensions.cs | 237 ++++ .../RoleEligibilitySchedulesOperations.cs | 609 +++++++++ ...ligibilitySchedulesOperationsExtensions.cs | 140 +++ .../RoleManagementPoliciesOperations.cs | 967 ++++++++++++++ ...eManagementPoliciesOperationsExtensions.cs | 216 ++++ ...leManagementPolicyAssignmentsOperations.cs | 970 ++++++++++++++ ...ntPolicyAssignmentsOperationsExtensions.cs | 222 ++++ .../SdkInfo_AuthorizationManagementClient.cs | 35 +- 147 files changed, 23684 insertions(+), 510 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/{ClassicAdministratorsOperations.cs => AccessReviewInstanceDecisionsOperations.cs} (83%) 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 create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesAssignedForMyApprovalOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesAssignedForMyApprovalOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesOperations.cs 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 rename sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/{ClassicAdministratorsOperationsExtensions.cs => AccessReviewScheduleDefinitionsAssignedForMyApprovalOperationsExtensions.cs} (66%) create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/EligibleChildResourcesOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/EligibleChildResourcesOperationsExtensions.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/{IClassicAdministratorsOperations.cs => IAccessReviewInstanceDecisionsOperations.cs} (72%) 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 create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstancesOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewScheduleDefinitionsOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IEligibleChildResourcesOperations.cs delete mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IGlobalAdministratorOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentScheduleInstancesOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentScheduleRequestsOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentSchedulesOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleEligibilityScheduleInstancesOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleEligibilityScheduleRequestsOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleEligibilitySchedulesOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleManagementPoliciesOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleManagementPolicyAssignmentsOperations.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/AccessReviewDecision.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/AccessReviewDecisionTarget.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/AccessReviewInstance.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/AccessReviewScopePrincipalType.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ApprovalMode.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ApprovalSettings.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ApprovalStage.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AssignmentType.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 create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/EligibleChildResource.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/EnablementRules.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinition.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinitionException.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinitionProperties.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedProperties.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedPropertiesPrincipal.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedPropertiesRoleDefinition.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedPropertiesScope.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/MemberType.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/NotificationDeliveryMechanism.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/NotificationLevel.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 create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyAssignmentProperties.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyAssignmentPropertiesPolicy.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyAssignmentPropertiesRoleDefinition.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyAssignmentPropertiesScope.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyProperties.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyPropertiesScope.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RecipientType.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RequestType.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentSchedule.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleFilter.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleInstance.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceFilter.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequest.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestFilter.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestPropertiesScheduleInfo.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestPropertiesTicketInfo.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilitySchedule.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleFilter.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleInstance.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceFilter.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequest.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestFilter.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesScheduleInfo.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesTicketInfo.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicy.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyApprovalRule.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyAssignment.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyAuthenticationContextRule.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyEnablementRule.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyExpirationRule.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyNotificationRule.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyRule.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyRuleTarget.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyRuleType.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ServicePrincipalDecisionTarget.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Status.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Type.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/UserDecisionTarget.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/UserSet.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/UserType.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Operations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/OperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentScheduleInstancesOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentScheduleInstancesOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentScheduleRequestsOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentScheduleRequestsOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentSchedulesOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentSchedulesOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilityScheduleInstancesOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilityScheduleInstancesOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilityScheduleRequestsOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilityScheduleRequestsOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilitySchedulesOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilitySchedulesOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleManagementPoliciesOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleManagementPoliciesOperationsExtensions.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleManagementPolicyAssignmentsOperations.cs create mode 100644 sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleManagementPolicyAssignmentsOperationsExtensions.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..e99699f7ec7c --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewDefaultSettingsOperations.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; + + /// + /// 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.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-05-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "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 (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 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.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-05-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("properties", properties); + tracingParameters.Add("apiVersion", apiVersion); + 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 (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(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/ClassicAdministratorsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceDecisionsOperations.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/AccessReviewInstanceDecisionsOperations.cs index dda58ecb8687..fef3ccb907e8 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceDecisionsOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Authorization using System.Threading.Tasks; /// - /// ClassicAdministratorsOperations operations. + /// AccessReviewInstanceDecisionsOperations operations. /// - internal partial class ClassicAdministratorsOperations : IServiceOperations, IClassicAdministratorsOperations + internal partial class AccessReviewInstanceDecisionsOperations : IServiceOperations, IAccessReviewInstanceDecisionsOperations { /// - /// Initializes a new instance of the ClassicAdministratorsOperations class. + /// Initializes a new instance of the AccessReviewInstanceDecisionsOperations 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 AccessReviewInstanceDecisionsOperations(AuthorizationManagementClient client) { if (client == null) { @@ -51,16 +51,21 @@ internal ClassicAdministratorsOperations(AuthorizationManagementClient client) public AuthorizationManagementClient Client { get; private set; } /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. + /// Get access review instance decisions /// + /// + /// 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 /// /// @@ -75,8 +80,16 @@ 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(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.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -88,7 +101,7 @@ internal ClassicAdministratorsOperations(AuthorizationManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } - string apiVersion = "2015-06-01"; + string apiVersion = "2018-05-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -96,13 +109,17 @@ internal ClassicAdministratorsOperations(AuthorizationManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("id", id); 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(); + 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 (apiVersion != null) @@ -169,11 +186,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 +214,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 +227,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 +247,7 @@ internal ClassicAdministratorsOperations(AuthorizationManagementClient client) } /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. + /// Get access review instance decisions /// /// /// The NextLink from the previous successful call to List operation. @@ -242,7 +258,7 @@ internal ClassicAdministratorsOperations(AuthorizationManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -257,7 +273,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 +354,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 +382,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 +395,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/AccessReviewInstanceDecisionsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceDecisionsOperationsExtensions.cs new file mode 100644 index 000000000000..07bcc7f05815 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceDecisionsOperationsExtensions.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 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. + /// + public static IPage List(this IAccessReviewInstanceDecisionsOperations operations, string scheduleDefinitionId, string id) + { + return operations.ListAsync(scheduleDefinitionId, id).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 cancellation token. + /// + public static async Task> ListAsync(this IAccessReviewInstanceDecisionsOperations 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 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..65b09f351872 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceMyDecisionsOperations.cs @@ -0,0 +1,806 @@ +// +// 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. + /// + /// + /// 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"); + } + string apiVersion = "2018-05-01-preview"; + // 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("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("/") ? "" : "/")), "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 (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 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"); + } + string apiVersion = "2018-05-01-preview"; + // 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("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("/") ? "" : "/")), "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 (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 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"); + } + string apiVersion = "2018-05-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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("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..f03fcf4ba537 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceMyDecisionsOperationsExtensions.cs @@ -0,0 +1,197 @@ +// +// 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. + /// + public static IPage List(this IAccessReviewInstanceMyDecisionsOperations operations, string scheduleDefinitionId, string id) + { + return operations.ListAsync(scheduleDefinitionId, id).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 cancellation token. + /// + public static async Task> ListAsync(this IAccessReviewInstanceMyDecisionsOperations 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 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..647d72624539 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstanceOperations.cs @@ -0,0 +1,918 @@ +// +// 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.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-05-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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 != 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.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-05-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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 != 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.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-05-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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 != 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.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-05-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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 != 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"); + } + string apiVersion = "2018-05-01-preview"; + // 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("apiVersion", apiVersion); + 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 (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 != 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/AccessReviewInstancesAssignedForMyApprovalOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesAssignedForMyApprovalOperations.cs new file mode 100644 index 000000000000..ca5fde93c517 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesAssignedForMyApprovalOperations.cs @@ -0,0 +1,581 @@ +// +// 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; + + /// + /// AccessReviewInstancesAssignedForMyApprovalOperations operations. + /// + internal partial class AccessReviewInstancesAssignedForMyApprovalOperations : IServiceOperations, IAccessReviewInstancesAssignedForMyApprovalOperations + { + /// + /// Initializes a new instance of the AccessReviewInstancesAssignedForMyApprovalOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AccessReviewInstancesAssignedForMyApprovalOperations(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 id of the access review schedule 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 scheduleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + string apiVersion = "2018-05-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + 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("/") ? "" : "/")), "providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances").ToString(); + _url = _url.Replace("{scheduleDefinitionId}", System.Uri.EscapeDataString(scheduleDefinitionId)); + 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 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 single access review instance assigned for my approval. + /// + /// + /// 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> GetByIdWithHttpMessagesAsync(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"); + } + string apiVersion = "2018-05-01-preview"; + // 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("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("/") ? "" : "/")), "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 (_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/AccessReviewInstancesAssignedForMyApprovalOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesAssignedForMyApprovalOperationsExtensions.cs new file mode 100644 index 000000000000..f25255c00868 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesAssignedForMyApprovalOperationsExtensions.cs @@ -0,0 +1,133 @@ +// +// 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. + /// + public static IPage List(this IAccessReviewInstancesAssignedForMyApprovalOperations operations, string scheduleDefinitionId) + { + return operations.ListAsync(scheduleDefinitionId).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 cancellation token. + /// + public static async Task> ListAsync(this IAccessReviewInstancesAssignedForMyApprovalOperations operations, string scheduleDefinitionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scheduleDefinitionId, 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/AccessReviewInstancesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesOperations.cs new file mode 100644 index 000000000000..98a40e2850ad --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesOperations.cs @@ -0,0 +1,605 @@ +// +// 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; + + /// + /// AccessReviewInstancesOperations operations. + /// + internal partial class AccessReviewInstancesOperations : IServiceOperations, IAccessReviewInstancesOperations + { + /// + /// Initializes a new instance of the AccessReviewInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AccessReviewInstancesOperations(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 + /// + /// + /// The id of the access review schedule 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 scheduleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + 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-05-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + 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/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) + { + _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 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 + /// + /// + /// 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> GetByIdWithHttpMessagesAsync(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.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-05-01-preview"; + // 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("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("/") ? "" : "/")), "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) + { + _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 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 + /// + /// + /// 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/AccessReviewInstancesOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesOperationsExtensions.cs new file mode 100644 index 000000000000..d382662d926c --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewInstancesOperationsExtensions.cs @@ -0,0 +1,133 @@ +// +// 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. + /// + public static IPage List(this IAccessReviewInstancesOperations operations, string scheduleDefinitionId) + { + return operations.ListAsync(scheduleDefinitionId).GetAwaiter().GetResult(); + } + + /// + /// Get access review instances + /// + /// + /// The operations group for this extension method. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAccessReviewInstancesOperations operations, string scheduleDefinitionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scheduleDefinitionId, 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; + } + } + + /// + /// 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..582b0a76a3f9 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations.cs @@ -0,0 +1,382 @@ +// +// 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. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + string apiVersion = "2018-05-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "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 (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 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/ClassicAdministratorsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsAssignedForMyApprovalOperationsExtensions.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/AccessReviewScheduleDefinitionsAssignedForMyApprovalOperationsExtensions.cs index 96543f2d5cef..638255311bf6 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/ClassicAdministratorsOperationsExtensions.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsAssignedForMyApprovalOperationsExtensions.cs @@ -17,25 +17,23 @@ namespace Microsoft.Azure.Management.Authorization using System.Threading.Tasks; /// - /// Extension methods for ClassicAdministratorsOperations. + /// Extension methods for AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations. /// - public static partial class ClassicAdministratorsOperationsExtensions + public static partial class AccessReviewScheduleDefinitionsAssignedForMyApprovalOperationsExtensions { /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. + /// Get access review instances assigned for my approval. /// /// /// The operations group for this extension method. /// - public static IPage List(this IClassicAdministratorsOperations operations) + public static IPage List(this IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations operations) { return operations.ListAsync().GetAwaiter().GetResult(); } /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. + /// Get access review instances assigned for my approval. /// /// /// 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 IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations 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. + /// Get access review instances assigned for my approval. /// /// /// 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 IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations operations, string nextPageLink) { return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// - /// Gets service administrator, account administrator, and co-administrators - /// for the subscription. + /// Get access review instances assigned for my approval. /// /// /// 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 IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations 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/AccessReviewScheduleDefinitionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsOperations.cs new file mode 100644 index 000000000000..00645a6d983a --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsOperations.cs @@ -0,0 +1,1120 @@ +// +// 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; + + /// + /// AccessReviewScheduleDefinitionsOperations operations. + /// + internal partial class AccessReviewScheduleDefinitionsOperations : IServiceOperations, IAccessReviewScheduleDefinitionsOperations + { + /// + /// Initializes a new instance of the AccessReviewScheduleDefinitionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AccessReviewScheduleDefinitionsOperations(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 schedule definitions + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + string apiVersion = "2018-05-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "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").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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 single access review definition + /// + /// + /// The id of the access review schedule 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 scheduleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + 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-05-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + 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("/") ? "" : "/")), "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) + { + _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 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 access review schedule definition + /// + /// + /// The id of the access review schedule 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 scheduleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + 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-05-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("apiVersion", apiVersion); + 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/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) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new 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; + } + + /// + /// Create or Update access review schedule definition. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// Access review schedule 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> CreateOrUpdateByIdWithHttpMessagesAsync(string scheduleDefinitionId, AccessReviewScheduleDefinitionProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + if (properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + 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-05-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("properties", properties); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateById", 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}").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) + { + _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(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; + } + + /// + /// Stop access review definition + /// + /// + /// The id of the access review schedule 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 StopWithHttpMessagesAsync(string scheduleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scheduleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scheduleDefinitionId"); + } + 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-05-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scheduleDefinitionId", scheduleDefinitionId); + tracingParameters.Add("apiVersion", apiVersion); + 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}/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) + { + _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 != 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; + } + + /// + /// Get access review schedule definitions + /// + /// + /// 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/AccessReviewScheduleDefinitionsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsOperationsExtensions.cs new file mode 100644 index 000000000000..121f4a9568c4 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AccessReviewScheduleDefinitionsOperationsExtensions.cs @@ -0,0 +1,223 @@ +// +// 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. + /// + public static IPage List(this IAccessReviewScheduleDefinitionsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Get access review schedule definitions + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAccessReviewScheduleDefinitionsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(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..18ddad0cecc6 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AuthorizationManagementClient.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/AuthorizationManagementClient.cs @@ -67,20 +67,65 @@ public partial class AuthorizationManagementClient : ServiceClient - /// Gets the IClassicAdministratorsOperations. + /// Gets the IOperations. /// - public virtual IClassicAdministratorsOperations ClassicAdministrators { get; private set; } + public virtual IOperations Operations { get; private set; } /// - /// Gets the IGlobalAdministratorOperations. + /// Gets the IAccessReviewScheduleDefinitionsOperations. /// - public virtual IGlobalAdministratorOperations GlobalAdministrator { get; private set; } + public virtual IAccessReviewScheduleDefinitionsOperations AccessReviewScheduleDefinitions { get; private set; } + + /// + /// Gets the IAccessReviewInstancesOperations. + /// + public virtual IAccessReviewInstancesOperations AccessReviewInstances { get; private set; } + + /// + /// Gets the IAccessReviewInstanceOperations. + /// + public virtual IAccessReviewInstanceOperations AccessReviewInstance { get; private set; } + + /// + /// Gets the IAccessReviewInstanceDecisionsOperations. + /// + public virtual IAccessReviewInstanceDecisionsOperations AccessReviewInstanceDecisions { get; private set; } + + /// + /// Gets the IAccessReviewDefaultSettingsOperations. + /// + public virtual IAccessReviewDefaultSettingsOperations AccessReviewDefaultSettings { get; private set; } + + /// + /// Gets the IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations. + /// + public virtual IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations AccessReviewScheduleDefinitionsAssignedForMyApproval { get; private set; } + + /// + /// Gets the IAccessReviewInstancesAssignedForMyApprovalOperations. + /// + public virtual IAccessReviewInstancesAssignedForMyApprovalOperations AccessReviewInstancesAssignedForMyApproval { get; private set; } + + /// + /// Gets the IAccessReviewInstanceMyDecisionsOperations. + /// + public virtual IAccessReviewInstanceMyDecisionsOperations AccessReviewInstanceMyDecisions { get; private set; } + + /// + /// Gets the IDenyAssignmentsOperations. + /// + public virtual IDenyAssignmentsOperations DenyAssignments { get; private set; } /// /// Gets the IProviderOperationsMetadataOperations. /// public virtual IProviderOperationsMetadataOperations ProviderOperationsMetadata { get; private set; } + /// + /// Gets the IRoleAssignmentsOperations. + /// + public virtual IRoleAssignmentsOperations RoleAssignments { get; private set; } + /// /// Gets the IPermissionsOperations. /// @@ -92,19 +137,54 @@ public partial class AuthorizationManagementClient : ServiceClient - /// Gets the IDenyAssignmentsOperations. + /// Gets the IRoleAssignmentMetricsOperations. /// - public virtual IDenyAssignmentsOperations DenyAssignments { get; private set; } + public virtual IRoleAssignmentMetricsOperations RoleAssignmentMetrics { get; private set; } /// - /// Gets the IRoleAssignmentMetricsOperations. + /// Gets the IEligibleChildResourcesOperations. /// - public virtual IRoleAssignmentMetricsOperations RoleAssignmentMetrics { get; private set; } + public virtual IEligibleChildResourcesOperations EligibleChildResources { get; private set; } /// - /// Gets the IRoleAssignmentsOperations. + /// Gets the IRoleAssignmentSchedulesOperations. /// - public virtual IRoleAssignmentsOperations RoleAssignments { get; private set; } + public virtual IRoleAssignmentSchedulesOperations RoleAssignmentSchedules { get; private set; } + + /// + /// Gets the IRoleAssignmentScheduleInstancesOperations. + /// + public virtual IRoleAssignmentScheduleInstancesOperations RoleAssignmentScheduleInstances { get; private set; } + + /// + /// Gets the IRoleAssignmentScheduleRequestsOperations. + /// + public virtual IRoleAssignmentScheduleRequestsOperations RoleAssignmentScheduleRequests { get; private set; } + + /// + /// Gets the IRoleEligibilitySchedulesOperations. + /// + public virtual IRoleEligibilitySchedulesOperations RoleEligibilitySchedules { get; private set; } + + /// + /// Gets the IRoleEligibilityScheduleInstancesOperations. + /// + public virtual IRoleEligibilityScheduleInstancesOperations RoleEligibilityScheduleInstances { get; private set; } + + /// + /// Gets the IRoleEligibilityScheduleRequestsOperations. + /// + public virtual IRoleEligibilityScheduleRequestsOperations RoleEligibilityScheduleRequests { get; private set; } + + /// + /// Gets the IRoleManagementPoliciesOperations. + /// + public virtual IRoleManagementPoliciesOperations RoleManagementPolicies { get; private set; } + + /// + /// Gets the IRoleManagementPolicyAssignmentsOperations. + /// + public virtual IRoleManagementPolicyAssignmentsOperations RoleManagementPolicyAssignments { get; private set; } /// /// Initializes a new instance of the AuthorizationManagementClient class. @@ -347,14 +427,30 @@ public AuthorizationManagementClient(System.Uri baseUri, ServiceClientCredential /// private void Initialize() { - ClassicAdministrators = new ClassicAdministratorsOperations(this); - GlobalAdministrator = new GlobalAdministratorOperations(this); + Operations = new Operations(this); + AccessReviewScheduleDefinitions = new AccessReviewScheduleDefinitionsOperations(this); + AccessReviewInstances = new AccessReviewInstancesOperations(this); + AccessReviewInstance = new AccessReviewInstanceOperations(this); + AccessReviewInstanceDecisions = new AccessReviewInstanceDecisionsOperations(this); + AccessReviewDefaultSettings = new AccessReviewDefaultSettingsOperations(this); + AccessReviewScheduleDefinitionsAssignedForMyApproval = new AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations(this); + AccessReviewInstancesAssignedForMyApproval = new AccessReviewInstancesAssignedForMyApprovalOperations(this); + AccessReviewInstanceMyDecisions = new AccessReviewInstanceMyDecisionsOperations(this); + DenyAssignments = new DenyAssignmentsOperations(this); ProviderOperationsMetadata = new ProviderOperationsMetadataOperations(this); + RoleAssignments = new RoleAssignmentsOperations(this); Permissions = new PermissionsOperations(this); RoleDefinitions = new RoleDefinitionsOperations(this); - DenyAssignments = new DenyAssignmentsOperations(this); RoleAssignmentMetrics = new RoleAssignmentMetricsOperations(this); - RoleAssignments = new RoleAssignmentsOperations(this); + EligibleChildResources = new EligibleChildResourcesOperations(this); + RoleAssignmentSchedules = new RoleAssignmentSchedulesOperations(this); + RoleAssignmentScheduleInstances = new RoleAssignmentScheduleInstancesOperations(this); + RoleAssignmentScheduleRequests = new RoleAssignmentScheduleRequestsOperations(this); + RoleEligibilitySchedules = new RoleEligibilitySchedulesOperations(this); + RoleEligibilityScheduleInstances = new RoleEligibilityScheduleInstancesOperations(this); + RoleEligibilityScheduleRequests = new RoleEligibilityScheduleRequestsOperations(this); + RoleManagementPolicies = new RoleManagementPoliciesOperations(this); + RoleManagementPolicyAssignments = new RoleManagementPolicyAssignmentsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; @@ -385,6 +481,10 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("ruleType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("ruleType")); CustomInitialize(); DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/EligibleChildResourcesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/EligibleChildResourcesOperations.cs new file mode 100644 index 000000000000..211176fb0697 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/EligibleChildResourcesOperations.cs @@ -0,0 +1,419 @@ +// +// 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; + + /// + /// EligibleChildResourcesOperations operations. + /// + internal partial class EligibleChildResourcesOperations : IServiceOperations, IEligibleChildResourcesOperations + { + /// + /// Initializes a new instance of the EligibleChildResourcesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal EligibleChildResourcesOperations(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 the child resources of a resource on which user has eligible access + /// + /// + /// The scope of the role management policy. + /// + /// + /// The filter to apply on the operation. Use + /// $filter=resourceType+eq+'Subscription' to filter on only resource of type = + /// 'Subscription'. Use + /// $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' + /// to filter on resource of type = 'Subscription' or 'ResourceGroup' + /// + /// + /// 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 filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + string apiVersion = "2020-10-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("filter", filter); + 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/eligibleChildResources").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the child resources of a resource on which user has eligible access + /// + /// + /// 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>> GetNextWithHttpMessagesAsync(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, "GetNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/EligibleChildResourcesOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/EligibleChildResourcesOperationsExtensions.cs new file mode 100644 index 000000000000..39796095d640 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/EligibleChildResourcesOperationsExtensions.cs @@ -0,0 +1,107 @@ +// +// 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 EligibleChildResourcesOperations. + /// + public static partial class EligibleChildResourcesOperationsExtensions + { + /// + /// Get the child resources of a resource on which user has eligible access + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy. + /// + /// + /// The filter to apply on the operation. Use + /// $filter=resourceType+eq+'Subscription' to filter on only resource of type = + /// 'Subscription'. Use + /// $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' + /// to filter on resource of type = 'Subscription' or 'ResourceGroup' + /// + public static IPage Get(this IEligibleChildResourcesOperations operations, string scope, string filter = default(string)) + { + return operations.GetAsync(scope, filter).GetAwaiter().GetResult(); + } + + /// + /// Get the child resources of a resource on which user has eligible access + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy. + /// + /// + /// The filter to apply on the operation. Use + /// $filter=resourceType+eq+'Subscription' to filter on only resource of type = + /// 'Subscription'. Use + /// $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' + /// to filter on resource of type = 'Subscription' or 'ResourceGroup' + /// + /// + /// The cancellation token. + /// + public static async Task> GetAsync(this IEligibleChildResourcesOperations operations, string scope, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(scope, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the child resources of a resource on which user has eligible access + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage GetNext(this IEligibleChildResourcesOperations operations, string nextPageLink) + { + return operations.GetNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get the child resources of a resource on which user has eligible access + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> GetNextAsync(this IEligibleChildResourcesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetNextWithHttpMessagesAsync(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/IClassicAdministratorsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceDecisionsOperations.cs similarity index 72% rename from sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IClassicAdministratorsOperations.cs rename to sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceDecisionsOperations.cs index 11e82ae50a1f..20d41acca2e0 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IClassicAdministratorsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceDecisionsOperations.cs @@ -19,21 +19,26 @@ namespace Microsoft.Azure.Management.Authorization using System.Threading.Tasks; /// - /// ClassicAdministratorsOperations operations. + /// AccessReviewInstanceDecisionsOperations operations. /// - public partial interface IClassicAdministratorsOperations + public partial interface IAccessReviewInstanceDecisionsOperations { /// - /// Gets service administrator, account administrator, and - /// co-administrators for the subscription. + /// Get access review instance decisions /// + /// + /// 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 /// /// @@ -42,10 +47,9 @@ public partial interface IClassicAdministratorsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string scheduleDefinitionId, string id, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets service administrator, account administrator, and - /// co-administrators for the subscription. + /// Get access review instance decisions /// /// /// The NextLink from the previous successful call to List operation. @@ -56,7 +60,7 @@ public partial interface IClassicAdministratorsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -65,6 +69,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/IAccessReviewInstanceMyDecisionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceMyDecisionsOperations.cs new file mode 100644 index 000000000000..d49056de9914 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstanceMyDecisionsOperations.cs @@ -0,0 +1,133 @@ +// +// 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 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 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..9d4e401e31c9 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstancesAssignedForMyApprovalOperations.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.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 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, 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/IAccessReviewInstancesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstancesOperations.cs new file mode 100644 index 000000000000..dc86ef58544c --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewInstancesOperations.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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AccessReviewInstancesOperations operations. + /// + public partial interface IAccessReviewInstancesOperations + { + /// + /// Get access review instances + /// + /// + /// The id of the access review schedule 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 scheduleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get access review instances + /// + /// + /// 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 + /// + /// + /// 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/IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations.cs new file mode 100644 index 000000000000..48682e11a5dd --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations.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; + + /// + /// AccessReviewScheduleDefinitionsAssignedForMyApprovalOperations operations. + /// + public partial interface IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations + { + /// + /// Get access review instances assigned for my approval. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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/IAccessReviewScheduleDefinitionsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewScheduleDefinitionsOperations.cs new file mode 100644 index 000000000000..91d712ac9d53 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAccessReviewScheduleDefinitionsOperations.cs @@ -0,0 +1,153 @@ +// +// 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; + + /// + /// AccessReviewScheduleDefinitionsOperations operations. + /// + public partial interface IAccessReviewScheduleDefinitionsOperations + { + /// + /// Get access review schedule definitions + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get single access review definition + /// + /// + /// The id of the access review schedule 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> GetByIdWithHttpMessagesAsync(string scheduleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete access review schedule definition + /// + /// + /// The id of the access review schedule 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 scheduleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or Update access review schedule definition. + /// + /// + /// The id of the access review schedule definition. + /// + /// + /// Access review schedule 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> CreateOrUpdateByIdWithHttpMessagesAsync(string scheduleDefinitionId, AccessReviewScheduleDefinitionProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Stop access review definition + /// + /// + /// The id of the access review schedule 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 StopWithHttpMessagesAsync(string scheduleDefinitionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get access review schedule definitions + /// + /// + /// 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/IAuthorizationManagementClient.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAuthorizationManagementClient.cs index 8c63d3dac7c2..1ba11dcf85b4 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAuthorizationManagementClient.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IAuthorizationManagementClient.cs @@ -64,20 +64,65 @@ public partial interface IAuthorizationManagementClient : System.IDisposable /// - /// Gets the IClassicAdministratorsOperations. + /// Gets the IOperations. /// - IClassicAdministratorsOperations ClassicAdministrators { get; } + IOperations Operations { get; } /// - /// Gets the IGlobalAdministratorOperations. + /// Gets the IAccessReviewScheduleDefinitionsOperations. /// - IGlobalAdministratorOperations GlobalAdministrator { get; } + IAccessReviewScheduleDefinitionsOperations AccessReviewScheduleDefinitions { get; } + + /// + /// Gets the IAccessReviewInstancesOperations. + /// + IAccessReviewInstancesOperations AccessReviewInstances { get; } + + /// + /// Gets the IAccessReviewInstanceOperations. + /// + IAccessReviewInstanceOperations AccessReviewInstance { get; } + + /// + /// Gets the IAccessReviewInstanceDecisionsOperations. + /// + IAccessReviewInstanceDecisionsOperations AccessReviewInstanceDecisions { get; } + + /// + /// Gets the IAccessReviewDefaultSettingsOperations. + /// + IAccessReviewDefaultSettingsOperations AccessReviewDefaultSettings { get; } + + /// + /// Gets the IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations. + /// + IAccessReviewScheduleDefinitionsAssignedForMyApprovalOperations AccessReviewScheduleDefinitionsAssignedForMyApproval { get; } + + /// + /// Gets the IAccessReviewInstancesAssignedForMyApprovalOperations. + /// + IAccessReviewInstancesAssignedForMyApprovalOperations AccessReviewInstancesAssignedForMyApproval { get; } + + /// + /// Gets the IAccessReviewInstanceMyDecisionsOperations. + /// + IAccessReviewInstanceMyDecisionsOperations AccessReviewInstanceMyDecisions { get; } + + /// + /// Gets the IDenyAssignmentsOperations. + /// + IDenyAssignmentsOperations DenyAssignments { get; } /// /// Gets the IProviderOperationsMetadataOperations. /// IProviderOperationsMetadataOperations ProviderOperationsMetadata { get; } + /// + /// Gets the IRoleAssignmentsOperations. + /// + IRoleAssignmentsOperations RoleAssignments { get; } + /// /// Gets the IPermissionsOperations. /// @@ -89,19 +134,54 @@ public partial interface IAuthorizationManagementClient : System.IDisposable IRoleDefinitionsOperations RoleDefinitions { get; } /// - /// Gets the IDenyAssignmentsOperations. + /// Gets the IRoleAssignmentMetricsOperations. /// - IDenyAssignmentsOperations DenyAssignments { get; } + IRoleAssignmentMetricsOperations RoleAssignmentMetrics { get; } /// - /// Gets the IRoleAssignmentMetricsOperations. + /// Gets the IEligibleChildResourcesOperations. /// - IRoleAssignmentMetricsOperations RoleAssignmentMetrics { get; } + IEligibleChildResourcesOperations EligibleChildResources { get; } /// - /// Gets the IRoleAssignmentsOperations. + /// Gets the IRoleAssignmentSchedulesOperations. /// - IRoleAssignmentsOperations RoleAssignments { get; } + IRoleAssignmentSchedulesOperations RoleAssignmentSchedules { get; } + + /// + /// Gets the IRoleAssignmentScheduleInstancesOperations. + /// + IRoleAssignmentScheduleInstancesOperations RoleAssignmentScheduleInstances { get; } + + /// + /// Gets the IRoleAssignmentScheduleRequestsOperations. + /// + IRoleAssignmentScheduleRequestsOperations RoleAssignmentScheduleRequests { get; } + + /// + /// Gets the IRoleEligibilitySchedulesOperations. + /// + IRoleEligibilitySchedulesOperations RoleEligibilitySchedules { get; } + + /// + /// Gets the IRoleEligibilityScheduleInstancesOperations. + /// + IRoleEligibilityScheduleInstancesOperations RoleEligibilityScheduleInstances { get; } + + /// + /// Gets the IRoleEligibilityScheduleRequestsOperations. + /// + IRoleEligibilityScheduleRequestsOperations RoleEligibilityScheduleRequests { get; } + + /// + /// Gets the IRoleManagementPoliciesOperations. + /// + IRoleManagementPoliciesOperations RoleManagementPolicies { get; } + + /// + /// Gets the IRoleManagementPolicyAssignmentsOperations. + /// + IRoleManagementPolicyAssignmentsOperations RoleManagementPolicyAssignments { get; } } } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IEligibleChildResourcesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IEligibleChildResourcesOperations.cs new file mode 100644 index 000000000000..ed290d8f33b9 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IEligibleChildResourcesOperations.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; + + /// + /// EligibleChildResourcesOperations operations. + /// + public partial interface IEligibleChildResourcesOperations + { + /// + /// Get the child resources of a resource on which user has eligible + /// access + /// + /// + /// The scope of the role management policy. + /// + /// + /// The filter to apply on the operation. Use + /// $filter=resourceType+eq+'Subscription' to filter on only resource + /// of type = 'Subscription'. Use + /// $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' + /// to filter on resource of type = 'Subscription' or 'ResourceGroup' + /// + /// + /// 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 filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the child resources of a resource on which user has eligible + /// access + /// + /// + /// 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>> GetNextWithHttpMessagesAsync(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/IOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IOperations.cs new file mode 100644 index 000000000000..2b486b19a9b5 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IOperations.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; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists the operations available from this provider. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the operations available from this provider. + /// + /// + /// 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/IRoleAssignmentScheduleInstancesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentScheduleInstancesOperations.cs new file mode 100644 index 000000000000..a3f4115af7e9 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentScheduleInstancesOperations.cs @@ -0,0 +1,103 @@ +// +// 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; + + /// + /// RoleAssignmentScheduleInstancesOperations operations. + /// + public partial interface IRoleAssignmentScheduleInstancesOperations + { + /// + /// Gets role assignment schedule instances of a role assignment + /// schedule. + /// + /// + /// The scope of the role assignment schedule. + /// + /// + /// 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 the specified role assignment schedule instance. + /// + /// + /// The scope of the role assignments schedules. + /// + /// + /// The name (hash of schedule name + time) of the role assignment + /// schedule 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 roleAssignmentScheduleInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets role assignment schedule instances of a role assignment + /// schedule. + /// + /// + /// 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/IRoleAssignmentScheduleRequestsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentScheduleRequestsOperations.cs new file mode 100644 index 000000000000..eff5c1b16d11 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentScheduleRequestsOperations.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 +{ + 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; + + /// + /// RoleAssignmentScheduleRequestsOperations operations. + /// + public partial interface IRoleAssignmentScheduleRequestsOperations + { + /// + /// Creates a role assignment schedule request. + /// + /// + /// The scope of the role assignment schedule request to create. The + /// scope can be any REST resource instance. For example, use + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' + /// for a subscription, + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' + /// for a resource group, and + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + /// for a resource. + /// + /// + /// A GUID for the role assignment to create. The name must be unique + /// and different for each role assignment. + /// + /// + /// Parameters for the role assignment schedule 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> CreateWithHttpMessagesAsync(string scope, string roleAssignmentScheduleRequestName, RoleAssignmentScheduleRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the specified role assignment schedule request. + /// + /// + /// The scope of the role assignment schedule request. + /// + /// + /// The name (guid) of the role assignment schedule request 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 roleAssignmentScheduleRequestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets role assignment schedule requests for a scope. + /// + /// + /// The scope of the role assignments schedule requests. + /// + /// + /// 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)); + /// + /// Cancels a pending role assignment schedule request. + /// + /// + /// The scope of the role assignment request to cancel. + /// + /// + /// The name of the role assignment request to cancel. + /// + /// + /// 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 CancelWithHttpMessagesAsync(string scope, string roleAssignmentScheduleRequestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets role assignment schedule requests 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/IRoleAssignmentSchedulesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentSchedulesOperations.cs new file mode 100644 index 000000000000..c4ba5e8df584 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleAssignmentSchedulesOperations.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 +{ + 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; + + /// + /// RoleAssignmentSchedulesOperations operations. + /// + public partial interface IRoleAssignmentSchedulesOperations + { + /// + /// Get the specified role assignment schedule for a resource scope + /// + /// + /// The scope of the role assignment schedule. + /// + /// + /// The name (guid) of the role assignment schedule 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 roleAssignmentScheduleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets role assignment schedules for a resource scope. + /// + /// + /// The scope of the role assignments schedules. + /// + /// + /// 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 role assignment schedules for a resource 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/IRoleEligibilityScheduleInstancesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleEligibilityScheduleInstancesOperations.cs new file mode 100644 index 000000000000..31bb7da3acf7 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleEligibilityScheduleInstancesOperations.cs @@ -0,0 +1,103 @@ +// +// 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; + + /// + /// RoleEligibilityScheduleInstancesOperations operations. + /// + public partial interface IRoleEligibilityScheduleInstancesOperations + { + /// + /// Gets role eligibility schedule instances of a role eligibility + /// schedule. + /// + /// + /// The scope of the role eligibility schedule. + /// + /// + /// 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 the specified role eligibility schedule instance. + /// + /// + /// The scope of the role eligibility schedules. + /// + /// + /// The name (hash of schedule name + time) of the role eligibility + /// schedule 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 roleEligibilityScheduleInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets role eligibility schedule instances of a role eligibility + /// schedule. + /// + /// + /// 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/IRoleEligibilityScheduleRequestsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleEligibilityScheduleRequestsOperations.cs new file mode 100644 index 000000000000..8f72e6270a2a --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleEligibilityScheduleRequestsOperations.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 +{ + 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; + + /// + /// RoleEligibilityScheduleRequestsOperations operations. + /// + public partial interface IRoleEligibilityScheduleRequestsOperations + { + /// + /// Creates a role eligibility schedule request. + /// + /// + /// The scope of the role eligibility schedule request to create. The + /// scope can be any REST resource instance. For example, use + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' + /// for a subscription, + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' + /// for a resource group, and + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + /// for a resource. + /// + /// + /// The name of the role eligibility to create. It can be any valid + /// GUID. + /// + /// + /// Parameters for the role eligibility schedule 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> CreateWithHttpMessagesAsync(string scope, string roleEligibilityScheduleRequestName, RoleEligibilityScheduleRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the specified role eligibility schedule request. + /// + /// + /// The scope of the role eligibility schedule request. + /// + /// + /// The name (guid) of the role eligibility schedule request 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 roleEligibilityScheduleRequestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets role eligibility schedule requests for a scope. + /// + /// + /// The scope of the role eligibility schedule requests. + /// + /// + /// 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)); + /// + /// Cancels a pending role eligibility schedule request. + /// + /// + /// The scope of the role eligibility request to cancel. + /// + /// + /// The name of the role eligibility request to cancel. + /// + /// + /// 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 CancelWithHttpMessagesAsync(string scope, string roleEligibilityScheduleRequestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets role eligibility schedule requests 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/IRoleEligibilitySchedulesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleEligibilitySchedulesOperations.cs new file mode 100644 index 000000000000..91cbfd282c6a --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleEligibilitySchedulesOperations.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 +{ + 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; + + /// + /// RoleEligibilitySchedulesOperations operations. + /// + public partial interface IRoleEligibilitySchedulesOperations + { + /// + /// Get the specified role eligibility schedule for a resource scope + /// + /// + /// The scope of the role eligibility schedule. + /// + /// + /// The name (guid) of the role eligibility schedule 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 roleEligibilityScheduleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets role eligibility schedules for a resource scope. + /// + /// + /// The scope of the role eligibility schedules. + /// + /// + /// 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 role eligibility schedules for a resource 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/IRoleManagementPoliciesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleManagementPoliciesOperations.cs new file mode 100644 index 000000000000..96a65551a7dc --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleManagementPoliciesOperations.cs @@ -0,0 +1,146 @@ +// +// 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; + + /// + /// RoleManagementPoliciesOperations operations. + /// + public partial interface IRoleManagementPoliciesOperations + { + /// + /// Get the specified role management policy for a resource scope + /// + /// + /// The scope of the role management policy. + /// + /// + /// The name (guid) of the role management policy 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 roleManagementPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a role management policy + /// + /// + /// The scope of the role management policy to upsert. + /// + /// + /// The name (guid) of the role management policy to upsert. + /// + /// + /// Parameters for the role management policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string scope, string roleManagementPolicyName, RoleManagementPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a role management policy + /// + /// + /// The scope of the role management policy to upsert. + /// + /// + /// The name (guid) of the role management policy to upsert. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string scope, string roleManagementPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets role management policies for a resource scope. + /// + /// + /// The scope of the role management policy. + /// + /// + /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets role management policies for a resource 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/IRoleManagementPolicyAssignmentsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleManagementPolicyAssignmentsOperations.cs new file mode 100644 index 000000000000..cdb109969943 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/IRoleManagementPolicyAssignmentsOperations.cs @@ -0,0 +1,150 @@ +// +// 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; + + /// + /// RoleManagementPolicyAssignmentsOperations operations. + /// + public partial interface IRoleManagementPolicyAssignmentsOperations + { + /// + /// Get the specified role management policy assignment for a resource + /// scope + /// + /// + /// The scope of the role management policy. + /// + /// + /// The name of format {guid_guid} the role management policy + /// 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 roleManagementPolicyAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a role management policy assignment + /// + /// + /// The scope of the role management policy assignment to upsert. + /// + /// + /// The name of format {guid_guid} the role management policy + /// assignment to upsert. + /// + /// + /// Parameters for the role management policy 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 roleManagementPolicyAssignmentName, RoleManagementPolicyAssignment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a role management policy assignment + /// + /// + /// The scope of the role management policy assignment to delete. + /// + /// + /// The name of format {guid_guid} the role management policy + /// assignment to delete. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string scope, string roleManagementPolicyAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets role management assignment policies for a resource scope. + /// + /// + /// The scope of the role management policy. + /// + /// + /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets role management assignment policies for a resource 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/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/AccessReviewDecision.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecision.cs new file mode 100644 index 000000000000..6b2f9043e894 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecision.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.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 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 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; + 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 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/AccessReviewDecisionProperties.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionProperties.cs new file mode 100644 index 000000000000..9fd9bef4b57c --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionProperties.cs @@ -0,0 +1,137 @@ +// +// 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. + /// + /// Target of this decision record. Can be + /// UserDecisionTarget or ServicePrincipalDecisionTarget + /// 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 applier. + public AccessReviewDecisionProperties(AccessReviewDecisionTarget target = default(AccessReviewDecisionTarget), 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)) + { + Target = target; + 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 target of this decision record. Can be UserDecisionTarget or + /// ServicePrincipalDecisionTarget + /// + [JsonProperty(PropertyName = "target")] + public AccessReviewDecisionTarget Target { 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 applier. + /// + [JsonProperty(PropertyName = "appliedBy")] + public AccessReviewActorIdentity AppliedBy { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionTarget.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionTarget.cs new file mode 100644 index 000000000000..199e44cac324 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDecisionTarget.cs @@ -0,0 +1,35 @@ +// +// 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 System.Linq; + + /// + /// Target of the decision. + /// + public partial class AccessReviewDecisionTarget + { + /// + /// Initializes a new instance of the AccessReviewDecisionTarget class. + /// + public AccessReviewDecisionTarget() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} 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..dcbfa425a318 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewDefaultSettings.cs @@ -0,0 +1,229 @@ +// +// 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. + /// 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?), 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; + 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 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/AccessReviewInstance.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstance.cs new file mode 100644 index 000000000000..47fae424ea56 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewInstance.cs @@ -0,0 +1,106 @@ +// +// 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 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. + 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)) + { + Id = id; + Name = name; + Type = type; + Status = status; + StartDateTime = startDateTime; + EndDateTime = endDateTime; + 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; } + + } +} 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..005a3bb1ffa6 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinition.cs @@ -0,0 +1,373 @@ +// +// 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. + /// 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', + /// 'servicePrincipal' + /// This is the collection of + /// 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?), 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), IList reviewers = 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; + InstanceDurationInDays = instanceDurationInDays; + Type1 = type1; + Interval = interval; + Type2 = type2; + NumberOfOccurrences = numberOfOccurrences; + StartDate = startDate; + EndDate = endDate; + ResourceId = resourceId; + RoleDefinitionId = roleDefinitionId; + PrincipalType1 = principalType1; + Reviewers = reviewers; + 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 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', 'servicePrincipal' + /// + [JsonProperty(PropertyName = "properties.scope.principalType")] + public string PrincipalType1 { get; private set; } + + /// + /// Gets or sets this is the collection of reviewers. + /// + [JsonProperty(PropertyName = "properties.reviewers")] + public IList Reviewers { 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..b6a034e6e674 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleDefinitionProperties.cs @@ -0,0 +1,155 @@ +// +// 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 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), string reviewersType = default(string), IList instances = default(IList)) + { + DisplayName = displayName; + Status = status; + DescriptionForAdmins = descriptionForAdmins; + DescriptionForReviewers = descriptionForReviewers; + CreatedBy = createdBy; + Settings = settings; + Scope = scope; + Reviewers = reviewers; + 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 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..c3cb7bdd9b9c --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScheduleSettings.cs @@ -0,0 +1,141 @@ +// +// 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. + /// 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?), int? instanceDurationInDays = default(int?), AccessReviewRecurrenceSettings recurrence = default(AccessReviewRecurrenceSettings)) + { + MailNotificationsEnabled = mailNotificationsEnabled; + ReminderNotificationsEnabled = reminderNotificationsEnabled; + DefaultDecisionEnabled = defaultDecisionEnabled; + JustificationRequiredOnApproval = justificationRequiredOnApproval; + DefaultDecision = defaultDecision; + AutoApplyDecisionsEnabled = autoApplyDecisionsEnabled; + RecommendationsEnabled = recommendationsEnabled; + 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 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/AccessReviewScopePrincipalType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScopePrincipalType.cs new file mode 100644 index 000000000000..4462768e69a4 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AccessReviewScopePrincipalType.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 AccessReviewScopePrincipalType. + /// + public static class AccessReviewScopePrincipalType + { + public const string User = "user"; + public const string ServicePrincipal = "servicePrincipal"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ApprovalMode.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ApprovalMode.cs new file mode 100644 index 000000000000..9bb2b42898cb --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ApprovalMode.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 ApprovalMode. + /// + public static class ApprovalMode + { + public const string SingleStage = "SingleStage"; + public const string Serial = "Serial"; + public const string Parallel = "Parallel"; + public const string NoApproval = "NoApproval"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ApprovalSettings.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ApprovalSettings.cs new file mode 100644 index 000000000000..431eed9bf4d0 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ApprovalSettings.cs @@ -0,0 +1,92 @@ +// +// 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 approval settings. + /// + public partial class ApprovalSettings + { + /// + /// Initializes a new instance of the ApprovalSettings class. + /// + public ApprovalSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApprovalSettings class. + /// + /// Determine whether approval is + /// required or not. + /// Determine whether + /// approval is required for assignment extension. + /// Determine whether + /// requestor justification required. + /// The type of rule. Possible values + /// include: 'SingleStage', 'Serial', 'Parallel', 'NoApproval' + /// The approval stages of the + /// request. + public ApprovalSettings(bool? isApprovalRequired = default(bool?), bool? isApprovalRequiredForExtension = default(bool?), bool? isRequestorJustificationRequired = default(bool?), string approvalMode = default(string), IList approvalStages = default(IList)) + { + IsApprovalRequired = isApprovalRequired; + IsApprovalRequiredForExtension = isApprovalRequiredForExtension; + IsRequestorJustificationRequired = isRequestorJustificationRequired; + ApprovalMode = approvalMode; + ApprovalStages = approvalStages; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets determine whether approval is required or not. + /// + [JsonProperty(PropertyName = "isApprovalRequired")] + public bool? IsApprovalRequired { get; set; } + + /// + /// Gets or sets determine whether approval is required for assignment + /// extension. + /// + [JsonProperty(PropertyName = "isApprovalRequiredForExtension")] + public bool? IsApprovalRequiredForExtension { get; set; } + + /// + /// Gets or sets determine whether requestor justification required. + /// + [JsonProperty(PropertyName = "isRequestorJustificationRequired")] + public bool? IsRequestorJustificationRequired { get; set; } + + /// + /// Gets or sets the type of rule. Possible values include: + /// 'SingleStage', 'Serial', 'Parallel', 'NoApproval' + /// + [JsonProperty(PropertyName = "approvalMode")] + public string ApprovalMode { get; set; } + + /// + /// Gets or sets the approval stages of the request. + /// + [JsonProperty(PropertyName = "approvalStages")] + public IList ApprovalStages { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ApprovalStage.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ApprovalStage.cs new file mode 100644 index 000000000000..1683d7769ed4 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ApprovalStage.cs @@ -0,0 +1,104 @@ +// +// 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 approval stage. + /// + public partial class ApprovalStage + { + /// + /// Initializes a new instance of the ApprovalStage class. + /// + public ApprovalStage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApprovalStage class. + /// + /// The time in days when + /// approval request would be timed out. + /// Determine whether + /// approver need to provide justification for his decision. + /// The time in minutes when the + /// approval request would be escalated if the primary approver does + /// not approves. + /// The primary approver of the + /// request. + /// The value determine whether + /// escalation feature is enabled. + /// The escalation approver of the + /// request. + public ApprovalStage(int? approvalStageTimeOutInDays = default(int?), bool? isApproverJustificationRequired = default(bool?), int? escalationTimeInMinutes = default(int?), IList primaryApprovers = default(IList), bool? isEscalationEnabled = default(bool?), IList escalationApprovers = default(IList)) + { + ApprovalStageTimeOutInDays = approvalStageTimeOutInDays; + IsApproverJustificationRequired = isApproverJustificationRequired; + EscalationTimeInMinutes = escalationTimeInMinutes; + PrimaryApprovers = primaryApprovers; + IsEscalationEnabled = isEscalationEnabled; + EscalationApprovers = escalationApprovers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the time in days when approval request would be timed + /// out. + /// + [JsonProperty(PropertyName = "approvalStageTimeOutInDays")] + public int? ApprovalStageTimeOutInDays { get; set; } + + /// + /// Gets or sets determine whether approver need to provide + /// justification for his decision. + /// + [JsonProperty(PropertyName = "isApproverJustificationRequired")] + public bool? IsApproverJustificationRequired { get; set; } + + /// + /// Gets or sets the time in minutes when the approval request would be + /// escalated if the primary approver does not approves. + /// + [JsonProperty(PropertyName = "escalationTimeInMinutes")] + public int? EscalationTimeInMinutes { get; set; } + + /// + /// Gets or sets the primary approver of the request. + /// + [JsonProperty(PropertyName = "primaryApprovers")] + public IList PrimaryApprovers { get; set; } + + /// + /// Gets or sets the value determine whether escalation feature is + /// enabled. + /// + [JsonProperty(PropertyName = "isEscalationEnabled")] + public bool? IsEscalationEnabled { get; set; } + + /// + /// Gets or sets the escalation approver of the request. + /// + [JsonProperty(PropertyName = "escalationApprovers")] + public IList EscalationApprovers { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AssignmentType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AssignmentType.cs new file mode 100644 index 000000000000..2478835ba01b --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/AssignmentType.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 AssignmentType. + /// + public static class AssignmentType + { + public const string Activated = "Activated"; + public const string Assigned = "Assigned"; + } +} 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/EligibleChildResource.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/EligibleChildResource.cs new file mode 100644 index 000000000000..ff403fed6eff --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/EligibleChildResource.cs @@ -0,0 +1,67 @@ +// +// 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; + + /// + /// Eligible child resource + /// + public partial class EligibleChildResource + { + /// + /// Initializes a new instance of the EligibleChildResource class. + /// + public EligibleChildResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EligibleChildResource class. + /// + /// The resource scope Id. + /// The resource name. + /// The resource type. + public EligibleChildResource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the resource scope Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/EnablementRules.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/EnablementRules.cs new file mode 100644 index 000000000000..31ea91c9a629 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/EnablementRules.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 EnablementRules. + /// + public static class EnablementRules + { + public const string MultiFactorAuthentication = "MultiFactorAuthentication"; + public const string Justification = "Justification"; + public const string Ticketing = "Ticketing"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinition.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinition.cs new file mode 100644 index 000000000000..6db4194cd4b9 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinition.cs @@ -0,0 +1,54 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Authorization.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error + /// + /// + /// Error description and code explaining why an operation failed. + /// + public partial class ErrorDefinition + { + /// + /// Initializes a new instance of the ErrorDefinition class. + /// + public ErrorDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDefinition class. + /// + /// Error of the list gateway status. + public ErrorDefinition(ErrorDefinitionProperties error = default(ErrorDefinitionProperties)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error of the list gateway status. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDefinitionProperties Error { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinitionException.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinitionException.cs new file mode 100644 index 000000000000..f83c8edbbb2e --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinitionException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Authorization.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorDefinition + /// information. + /// + public partial class ErrorDefinitionException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorDefinition Body { get; set; } + + /// + /// Initializes a new instance of the ErrorDefinitionException class. + /// + public ErrorDefinitionException() + { + } + + /// + /// Initializes a new instance of the ErrorDefinitionException class. + /// + /// The exception message. + public ErrorDefinitionException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorDefinitionException class. + /// + /// The exception message. + /// Inner exception. + public ErrorDefinitionException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinitionProperties.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinitionProperties.cs new file mode 100644 index 000000000000..3a0052cf6c9b --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ErrorDefinitionProperties.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Authorization.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error + /// + /// + /// Error description and code explaining why an operation failed. + /// + public partial class ErrorDefinitionProperties + { + /// + /// Initializes a new instance of the ErrorDefinitionProperties class. + /// + public ErrorDefinitionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDefinitionProperties class. + /// + /// Description of the error. + /// Error code of list gateway. + public ErrorDefinitionProperties(string message = default(string), string code = default(string)) + { + Message = message; + Code = code; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets description of the error. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets or sets error code of list gateway. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedProperties.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedProperties.cs new file mode 100644 index 000000000000..39c42ecd3695 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedProperties.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; + + public partial class ExpandedProperties + { + /// + /// Initializes a new instance of the ExpandedProperties class. + /// + public ExpandedProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExpandedProperties class. + /// + /// Details of the resource scope + /// Details of role definition + /// Details of the principal + public ExpandedProperties(ExpandedPropertiesScope scope = default(ExpandedPropertiesScope), ExpandedPropertiesRoleDefinition roleDefinition = default(ExpandedPropertiesRoleDefinition), ExpandedPropertiesPrincipal principal = default(ExpandedPropertiesPrincipal)) + { + Scope = scope; + RoleDefinition = roleDefinition; + Principal = principal; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets details of the resource scope + /// + [JsonProperty(PropertyName = "scope")] + public ExpandedPropertiesScope Scope { get; set; } + + /// + /// Gets or sets details of role definition + /// + [JsonProperty(PropertyName = "roleDefinition")] + public ExpandedPropertiesRoleDefinition RoleDefinition { get; set; } + + /// + /// Gets or sets details of the principal + /// + [JsonProperty(PropertyName = "principal")] + public ExpandedPropertiesPrincipal Principal { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedPropertiesPrincipal.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedPropertiesPrincipal.cs new file mode 100644 index 000000000000..9d120d5a38c8 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedPropertiesPrincipal.cs @@ -0,0 +1,77 @@ +// +// 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; + + /// + /// Details of the principal + /// + public partial class ExpandedPropertiesPrincipal + { + /// + /// Initializes a new instance of the ExpandedPropertiesPrincipal + /// class. + /// + public ExpandedPropertiesPrincipal() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExpandedPropertiesPrincipal + /// class. + /// + /// Id of the principal + /// Display name of the principal + /// Email id of the principal + /// Type of the principal + public ExpandedPropertiesPrincipal(string id = default(string), string displayName = default(string), string email = default(string), string type = default(string)) + { + Id = id; + DisplayName = displayName; + Email = email; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets id of the principal + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets display name of the principal + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets email id of the principal + /// + [JsonProperty(PropertyName = "email")] + public string Email { get; set; } + + /// + /// Gets or sets type of the principal + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedPropertiesRoleDefinition.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedPropertiesRoleDefinition.cs new file mode 100644 index 000000000000..a068105f847e --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedPropertiesRoleDefinition.cs @@ -0,0 +1,70 @@ +// +// 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; + + /// + /// Details of role definition + /// + public partial class ExpandedPropertiesRoleDefinition + { + /// + /// Initializes a new instance of the ExpandedPropertiesRoleDefinition + /// class. + /// + public ExpandedPropertiesRoleDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExpandedPropertiesRoleDefinition + /// class. + /// + /// Id of the role definition + /// Display name of the role + /// definition + /// Type of the role definition + public ExpandedPropertiesRoleDefinition(string id = default(string), string displayName = default(string), string type = default(string)) + { + Id = id; + DisplayName = displayName; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets id of the role definition + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets display name of the role definition + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets type of the role definition + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedPropertiesScope.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedPropertiesScope.cs new file mode 100644 index 000000000000..6fb323006a1f --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ExpandedPropertiesScope.cs @@ -0,0 +1,67 @@ +// +// 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; + + /// + /// Details of the resource scope + /// + public partial class ExpandedPropertiesScope + { + /// + /// Initializes a new instance of the ExpandedPropertiesScope class. + /// + public ExpandedPropertiesScope() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExpandedPropertiesScope class. + /// + /// Scope id of the resource + /// Display name of the resource + /// Type of the resource + public ExpandedPropertiesScope(string id = default(string), string displayName = default(string), string type = default(string)) + { + Id = id; + DisplayName = displayName; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets scope id of the resource + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets display name of the resource + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets type of the resource + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/MemberType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/MemberType.cs new file mode 100644 index 000000000000..051b567aa274 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/MemberType.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 MemberType. + /// + public static class MemberType + { + public const string Inherited = "Inherited"; + public const string Direct = "Direct"; + public const string Group = "Group"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/NotificationDeliveryMechanism.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/NotificationDeliveryMechanism.cs new file mode 100644 index 000000000000..b894d0ed263c --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/NotificationDeliveryMechanism.cs @@ -0,0 +1,21 @@ +// +// 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 NotificationDeliveryMechanism. + /// + public static class NotificationDeliveryMechanism + { + public const string Email = "Email"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/NotificationLevel.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/NotificationLevel.cs new file mode 100644 index 000000000000..79d081ec2ce9 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/NotificationLevel.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 NotificationLevel. + /// + public static class NotificationLevel + { + public const string None = "None"; + public const string Critical = "Critical"; + public const string All = "All"; + } +} 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/PolicyAssignmentProperties.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyAssignmentProperties.cs new file mode 100644 index 000000000000..5f35cdbff7f6 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyAssignmentProperties.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; + + public partial class PolicyAssignmentProperties + { + /// + /// Initializes a new instance of the PolicyAssignmentProperties class. + /// + public PolicyAssignmentProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyAssignmentProperties class. + /// + /// Details of the resource scope + /// Details of role definition + /// Details of the policy + public PolicyAssignmentProperties(PolicyAssignmentPropertiesScope scope = default(PolicyAssignmentPropertiesScope), PolicyAssignmentPropertiesRoleDefinition roleDefinition = default(PolicyAssignmentPropertiesRoleDefinition), PolicyAssignmentPropertiesPolicy policy = default(PolicyAssignmentPropertiesPolicy)) + { + Scope = scope; + RoleDefinition = roleDefinition; + Policy = policy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets details of the resource scope + /// + [JsonProperty(PropertyName = "scope")] + public PolicyAssignmentPropertiesScope Scope { get; set; } + + /// + /// Gets or sets details of role definition + /// + [JsonProperty(PropertyName = "roleDefinition")] + public PolicyAssignmentPropertiesRoleDefinition RoleDefinition { get; set; } + + /// + /// Gets or sets details of the policy + /// + [JsonProperty(PropertyName = "policy")] + public PolicyAssignmentPropertiesPolicy Policy { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyAssignmentPropertiesPolicy.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyAssignmentPropertiesPolicy.cs new file mode 100644 index 000000000000..1e3c9bd1b305 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyAssignmentPropertiesPolicy.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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Details of the policy + /// + public partial class PolicyAssignmentPropertiesPolicy + { + /// + /// Initializes a new instance of the PolicyAssignmentPropertiesPolicy + /// class. + /// + public PolicyAssignmentPropertiesPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyAssignmentPropertiesPolicy + /// class. + /// + /// Id of the policy + /// The last modified date + /// time. + public PolicyAssignmentPropertiesPolicy(string id = default(string), Principal lastModifiedBy = default(Principal), System.DateTime? lastModifiedDateTime = default(System.DateTime?)) + { + Id = id; + LastModifiedBy = lastModifiedBy; + LastModifiedDateTime = lastModifiedDateTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets id of the policy + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public Principal LastModifiedBy { get; set; } + + /// + /// Gets or sets the last modified date time. + /// + [JsonProperty(PropertyName = "lastModifiedDateTime")] + public System.DateTime? LastModifiedDateTime { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyAssignmentPropertiesRoleDefinition.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyAssignmentPropertiesRoleDefinition.cs new file mode 100644 index 000000000000..bb702aeeb29b --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyAssignmentPropertiesRoleDefinition.cs @@ -0,0 +1,70 @@ +// +// 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; + + /// + /// Details of role definition + /// + public partial class PolicyAssignmentPropertiesRoleDefinition + { + /// + /// Initializes a new instance of the + /// PolicyAssignmentPropertiesRoleDefinition class. + /// + public PolicyAssignmentPropertiesRoleDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PolicyAssignmentPropertiesRoleDefinition class. + /// + /// Id of the role definition + /// Display name of the role + /// definition + /// Type of the role definition + public PolicyAssignmentPropertiesRoleDefinition(string id = default(string), string displayName = default(string), string type = default(string)) + { + Id = id; + DisplayName = displayName; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets id of the role definition + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets display name of the role definition + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets type of the role definition + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyAssignmentPropertiesScope.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyAssignmentPropertiesScope.cs new file mode 100644 index 000000000000..fd65349aa0ba --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyAssignmentPropertiesScope.cs @@ -0,0 +1,69 @@ +// +// 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; + + /// + /// Details of the resource scope + /// + public partial class PolicyAssignmentPropertiesScope + { + /// + /// Initializes a new instance of the PolicyAssignmentPropertiesScope + /// class. + /// + public PolicyAssignmentPropertiesScope() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyAssignmentPropertiesScope + /// class. + /// + /// Scope id of the resource + /// Display name of the resource + /// Type of the resource + public PolicyAssignmentPropertiesScope(string id = default(string), string displayName = default(string), string type = default(string)) + { + Id = id; + DisplayName = displayName; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets scope id of the resource + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets display name of the resource + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets type of the resource + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyProperties.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyProperties.cs new file mode 100644 index 000000000000..9de77c883322 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyProperties.cs @@ -0,0 +1,48 @@ +// +// 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; + + public partial class PolicyProperties + { + /// + /// Initializes a new instance of the PolicyProperties class. + /// + public PolicyProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyProperties class. + /// + /// Details of the resource scope + public PolicyProperties(PolicyPropertiesScope scope = default(PolicyPropertiesScope)) + { + Scope = scope; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets details of the resource scope + /// + [JsonProperty(PropertyName = "scope")] + public PolicyPropertiesScope Scope { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyPropertiesScope.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyPropertiesScope.cs new file mode 100644 index 000000000000..62e7e6f5053b --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PolicyPropertiesScope.cs @@ -0,0 +1,67 @@ +// +// 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; + + /// + /// Details of the resource scope + /// + public partial class PolicyPropertiesScope + { + /// + /// Initializes a new instance of the PolicyPropertiesScope class. + /// + public PolicyPropertiesScope() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyPropertiesScope class. + /// + /// Scope id of the resource + /// Display name of the resource + /// Type of the resource + public PolicyPropertiesScope(string id = default(string), string displayName = default(string), string type = default(string)) + { + Id = id; + DisplayName = displayName; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets scope id of the resource + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets display name of the resource + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets type of the resource + /// + [JsonProperty(PropertyName = "type")] + public string Type { 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 index 8eb0229796e0..b6a47e0eda7b 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Principal.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Principal.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.Management.Authorization.Models using System.Linq; /// - /// Deny assignment principal. + /// The name of the entity last modified it /// public partial class Principal { @@ -29,20 +29,18 @@ public Principal() /// /// 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)) + /// The id of the principal made changes + /// The name of the principal made + /// changes + /// Type of principal such as user , group + /// etc + /// Email of principal + public Principal(string id = default(string), string displayName = default(string), string type = default(string), string email = default(string)) { Id = id; + DisplayName = displayName; Type = type; + Email = email; CustomInit(); } @@ -52,24 +50,28 @@ public Principal() 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. + /// Gets or sets the id of the principal made changes /// [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } + public string Id { get; 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. + /// Gets or sets the name of the principal made changes + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets type of principal such as user , group etc /// [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } + public string Type { get; set; } + + /// + /// Gets or sets email of principal + /// + [JsonProperty(PropertyName = "email")] + public string Email { get; 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 index 7c3471cf80d5..98533fd6dd76 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PrincipalType.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/PrincipalType.cs @@ -19,12 +19,7 @@ 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"; + public const string Device = "Device"; } } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RecipientType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RecipientType.cs new file mode 100644 index 000000000000..96c82b2bee56 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RecipientType.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 RecipientType. + /// + public static class RecipientType + { + public const string Requestor = "Requestor"; + public const string Approver = "Approver"; + public const string Admin = "Admin"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RequestType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RequestType.cs new file mode 100644 index 000000000000..0368a2ea1182 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RequestType.cs @@ -0,0 +1,29 @@ +// +// 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 RequestType. + /// + public static class RequestType + { + public const string AdminAssign = "AdminAssign"; + public const string AdminRemove = "AdminRemove"; + public const string AdminUpdate = "AdminUpdate"; + public const string AdminExtend = "AdminExtend"; + public const string AdminRenew = "AdminRenew"; + public const string SelfActivate = "SelfActivate"; + public const string SelfDeactivate = "SelfDeactivate"; + public const string SelfExtend = "SelfExtend"; + public const string SelfRenew = "SelfRenew"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignment.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignment.cs index 057818fd2851..872d2f81229f 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignment.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignment.cs @@ -41,9 +41,7 @@ public RoleAssignment() /// 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' + /// 'ServicePrincipal', 'ForeignGroup', 'Device' /// Description of role assignment /// The conditions on the role assignment. This /// limits the resources it can be assigned to. e.g.: @@ -123,8 +121,7 @@ public RoleAssignment() /// /// Gets or sets the principal type of the assigned principal ID. /// Possible values include: 'User', 'Group', 'ServicePrincipal', - /// 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', - /// 'MSI', 'DirectoryObjectOrGroup', 'Everyone' + /// 'ForeignGroup', 'Device' /// [JsonProperty(PropertyName = "properties.principalType")] public string PrincipalType { get; set; } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentCreateParameters.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentCreateParameters.cs index 61d6d8f5cb3e..4631c9510f44 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentCreateParameters.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentCreateParameters.cs @@ -39,9 +39,7 @@ public RoleAssignmentCreateParameters() /// 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' + /// 'ServicePrincipal', 'ForeignGroup', 'Device' /// Description of role assignment /// The conditions on the role assignment. This /// limits the resources it can be assigned to. e.g.: @@ -100,8 +98,7 @@ public RoleAssignmentCreateParameters() /// /// Gets or sets the principal type of the assigned principal ID. /// Possible values include: 'User', 'Group', 'ServicePrincipal', - /// 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', - /// 'MSI', 'DirectoryObjectOrGroup', 'Everyone' + /// 'ForeignGroup', 'Device' /// [JsonProperty(PropertyName = "properties.principalType")] public string PrincipalType { get; set; } diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentSchedule.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentSchedule.cs new file mode 100644 index 000000000000..acd0c31ea1c0 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentSchedule.cs @@ -0,0 +1,243 @@ +// +// 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 schedule + /// + [Rest.Serialization.JsonTransformation] + public partial class RoleAssignmentSchedule + { + /// + /// Initializes a new instance of the RoleAssignmentSchedule class. + /// + public RoleAssignmentSchedule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleAssignmentSchedule class. + /// + /// The role assignment schedule Id. + /// The role assignment schedule name. + /// The role assignment schedule type. + /// The role assignment schedule scope. + /// The role definition ID. + /// The principal ID. + /// The principal type of the assigned + /// principal ID. Possible values include: 'User', 'Group', + /// 'ServicePrincipal', 'ForeignGroup', 'Device' + /// The id of + /// roleAssignmentScheduleRequest used to create this + /// roleAssignmentSchedule + /// The id of + /// roleEligibilitySchedule used to activated this + /// roleAssignmentSchedule + /// Assignment type of the role assignment + /// schedule. Possible values include: 'Activated', 'Assigned' + /// Membership type of the role assignment + /// schedule. Possible values include: 'Inherited', 'Direct', + /// 'Group' + /// The status of the role assignment schedule. + /// Possible values include: 'Accepted', 'PendingEvaluation', + /// 'Granted', 'Denied', 'PendingProvisioning', 'Provisioned', + /// 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', + /// 'PendingApprovalProvisioning', 'PendingApproval', + /// 'FailedAsResourceIsLocked', 'PendingAdminDecision', + /// 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', + /// 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', + /// 'PendingExternalProvisioning' + /// Start DateTime when role assignment + /// schedule + /// End DateTime when role assignment + /// schedule + /// 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' + /// DateTime when role assignment schedule was + /// created + /// DateTime when role assignment schedule was + /// modified + /// Additional properties of + /// principal, scope and role definition + public RoleAssignmentSchedule(string id = default(string), string name = default(string), string type = default(string), string scope = default(string), string roleDefinitionId = default(string), string principalId = default(string), string principalType = default(string), string roleAssignmentScheduleRequestId = default(string), string linkedRoleEligibilityScheduleId = default(string), string assignmentType = default(string), string memberType = default(string), string status = default(string), System.DateTime? startDateTime = default(System.DateTime?), System.DateTime? endDateTime = default(System.DateTime?), string condition = default(string), string conditionVersion = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? updatedOn = default(System.DateTime?), ExpandedProperties expandedProperties = default(ExpandedProperties)) + { + Id = id; + Name = name; + Type = type; + Scope = scope; + RoleDefinitionId = roleDefinitionId; + PrincipalId = principalId; + PrincipalType = principalType; + RoleAssignmentScheduleRequestId = roleAssignmentScheduleRequestId; + LinkedRoleEligibilityScheduleId = linkedRoleEligibilityScheduleId; + AssignmentType = assignmentType; + MemberType = memberType; + Status = status; + StartDateTime = startDateTime; + EndDateTime = endDateTime; + Condition = condition; + ConditionVersion = conditionVersion; + CreatedOn = createdOn; + UpdatedOn = updatedOn; + ExpandedProperties = expandedProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the role assignment schedule Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the role assignment schedule name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the role assignment schedule type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the role assignment schedule scope. + /// + [JsonProperty(PropertyName = "properties.scope")] + public string Scope { get; 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', + /// 'ForeignGroup', 'Device' + /// + [JsonProperty(PropertyName = "properties.principalType")] + public string PrincipalType { get; set; } + + /// + /// Gets or sets the id of roleAssignmentScheduleRequest used to create + /// this roleAssignmentSchedule + /// + [JsonProperty(PropertyName = "properties.roleAssignmentScheduleRequestId")] + public string RoleAssignmentScheduleRequestId { get; set; } + + /// + /// Gets or sets the id of roleEligibilitySchedule used to activated + /// this roleAssignmentSchedule + /// + [JsonProperty(PropertyName = "properties.linkedRoleEligibilityScheduleId")] + public string LinkedRoleEligibilityScheduleId { get; set; } + + /// + /// Gets or sets assignment type of the role assignment schedule. + /// Possible values include: 'Activated', 'Assigned' + /// + [JsonProperty(PropertyName = "properties.assignmentType")] + public string AssignmentType { get; set; } + + /// + /// Gets or sets membership type of the role assignment schedule. + /// Possible values include: 'Inherited', 'Direct', 'Group' + /// + [JsonProperty(PropertyName = "properties.memberType")] + public string MemberType { get; set; } + + /// + /// Gets or sets the status of the role assignment schedule. Possible + /// values include: 'Accepted', 'PendingEvaluation', 'Granted', + /// 'Denied', 'PendingProvisioning', 'Provisioned', + /// 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', + /// 'PendingApprovalProvisioning', 'PendingApproval', + /// 'FailedAsResourceIsLocked', 'PendingAdminDecision', + /// 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', + /// 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', + /// 'PendingExternalProvisioning' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets start DateTime when role assignment schedule + /// + [JsonProperty(PropertyName = "properties.startDateTime")] + public System.DateTime? StartDateTime { get; set; } + + /// + /// Gets or sets end DateTime when role assignment schedule + /// + [JsonProperty(PropertyName = "properties.endDateTime")] + public System.DateTime? EndDateTime { 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 or sets dateTime when role assignment schedule was created + /// + [JsonProperty(PropertyName = "properties.createdOn")] + public System.DateTime? CreatedOn { get; set; } + + /// + /// Gets or sets dateTime when role assignment schedule was modified + /// + [JsonProperty(PropertyName = "properties.updatedOn")] + public System.DateTime? UpdatedOn { get; set; } + + /// + /// Gets or sets additional properties of principal, scope and role + /// definition + /// + [JsonProperty(PropertyName = "properties.expandedProperties")] + public ExpandedProperties ExpandedProperties { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleFilter.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleFilter.cs new file mode 100644 index 000000000000..a67b874f5ff6 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleFilter.cs @@ -0,0 +1,75 @@ +// +// 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 schedule filter + /// + public partial class RoleAssignmentScheduleFilter + { + /// + /// Initializes a new instance of the RoleAssignmentScheduleFilter + /// class. + /// + public RoleAssignmentScheduleFilter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleAssignmentScheduleFilter + /// class. + /// + /// Returns role assignment schedule of the + /// specific principal. + /// Returns role assignment schedule of + /// the specific role definition. + /// Returns role assignment schedule instances of + /// the specific status. + public RoleAssignmentScheduleFilter(string principalId = default(string), string roleDefinitionId = default(string), string status = default(string)) + { + PrincipalId = principalId; + RoleDefinitionId = roleDefinitionId; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets returns role assignment schedule of the specific + /// principal. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets returns role assignment schedule of the specific role + /// definition. + /// + [JsonProperty(PropertyName = "roleDefinitionId")] + public string RoleDefinitionId { get; set; } + + /// + /// Gets or sets returns role assignment schedule instances of the + /// specific status. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleInstance.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleInstance.cs new file mode 100644 index 000000000000..78cafd9836f0 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleInstance.cs @@ -0,0 +1,257 @@ +// +// 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; + + /// + /// Information about current or upcoming role assignment schedule instance + /// + [Rest.Serialization.JsonTransformation] + public partial class RoleAssignmentScheduleInstance + { + /// + /// Initializes a new instance of the RoleAssignmentScheduleInstance + /// class. + /// + public RoleAssignmentScheduleInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleAssignmentScheduleInstance + /// class. + /// + /// The role assignment schedule instance ID. + /// The role assignment schedule instance + /// name. + /// The role assignment schedule instance + /// type. + /// The role assignment schedule scope. + /// The role definition ID. + /// The principal ID. + /// The principal type of the assigned + /// principal ID. Possible values include: 'User', 'Group', + /// 'ServicePrincipal', 'ForeignGroup', 'Device' + /// Id of the master role + /// assignment schedule + /// Role Assignment Id in external + /// system + /// The status of the role assignment schedule + /// instance. Possible values include: 'Accepted', 'PendingEvaluation', + /// 'Granted', 'Denied', 'PendingProvisioning', 'Provisioned', + /// 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', + /// 'PendingApprovalProvisioning', 'PendingApproval', + /// 'FailedAsResourceIsLocked', 'PendingAdminDecision', + /// 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', + /// 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', + /// 'PendingExternalProvisioning' + /// The startDateTime of the role + /// assignment schedule instance + /// The endDateTime of the role assignment + /// schedule instance + /// roleEligibilityScheduleId + /// used to activate + /// roleEligibilityScheduleInstanceId + /// linked to this roleAssignmentScheduleInstance + /// Assignment type of the role assignment + /// schedule. Possible values include: 'Activated', 'Assigned' + /// Membership type of the role assignment + /// schedule. Possible values include: 'Inherited', 'Direct', + /// 'Group' + /// 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' + /// DateTime when role assignment schedule was + /// created + /// Additional properties of + /// principal, scope and role definition + public RoleAssignmentScheduleInstance(string id = default(string), string name = default(string), string type = default(string), string scope = default(string), string roleDefinitionId = default(string), string principalId = default(string), string principalType = default(string), string roleAssignmentScheduleId = default(string), string originRoleAssignmentId = default(string), string status = default(string), System.DateTime? startDateTime = default(System.DateTime?), System.DateTime? endDateTime = default(System.DateTime?), string linkedRoleEligibilityScheduleId = default(string), string linkedRoleEligibilityScheduleInstanceId = default(string), string assignmentType = default(string), string memberType = default(string), string condition = default(string), string conditionVersion = default(string), System.DateTime? createdOn = default(System.DateTime?), ExpandedProperties expandedProperties = default(ExpandedProperties)) + { + Id = id; + Name = name; + Type = type; + Scope = scope; + RoleDefinitionId = roleDefinitionId; + PrincipalId = principalId; + PrincipalType = principalType; + RoleAssignmentScheduleId = roleAssignmentScheduleId; + OriginRoleAssignmentId = originRoleAssignmentId; + Status = status; + StartDateTime = startDateTime; + EndDateTime = endDateTime; + LinkedRoleEligibilityScheduleId = linkedRoleEligibilityScheduleId; + LinkedRoleEligibilityScheduleInstanceId = linkedRoleEligibilityScheduleInstanceId; + AssignmentType = assignmentType; + MemberType = memberType; + Condition = condition; + ConditionVersion = conditionVersion; + CreatedOn = createdOn; + ExpandedProperties = expandedProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the role assignment schedule instance ID. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the role assignment schedule instance name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the role assignment schedule instance type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the role assignment schedule scope. + /// + [JsonProperty(PropertyName = "properties.scope")] + public string Scope { get; 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', + /// 'ForeignGroup', 'Device' + /// + [JsonProperty(PropertyName = "properties.principalType")] + public string PrincipalType { get; set; } + + /// + /// Gets or sets id of the master role assignment schedule + /// + [JsonProperty(PropertyName = "properties.roleAssignmentScheduleId")] + public string RoleAssignmentScheduleId { get; set; } + + /// + /// Gets or sets role Assignment Id in external system + /// + [JsonProperty(PropertyName = "properties.originRoleAssignmentId")] + public string OriginRoleAssignmentId { get; set; } + + /// + /// Gets or sets the status of the role assignment schedule instance. + /// Possible values include: 'Accepted', 'PendingEvaluation', + /// 'Granted', 'Denied', 'PendingProvisioning', 'Provisioned', + /// 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', + /// 'PendingApprovalProvisioning', 'PendingApproval', + /// 'FailedAsResourceIsLocked', 'PendingAdminDecision', + /// 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', + /// 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', + /// 'PendingExternalProvisioning' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the startDateTime of the role assignment schedule + /// instance + /// + [JsonProperty(PropertyName = "properties.startDateTime")] + public System.DateTime? StartDateTime { get; set; } + + /// + /// Gets or sets the endDateTime of the role assignment schedule + /// instance + /// + [JsonProperty(PropertyName = "properties.endDateTime")] + public System.DateTime? EndDateTime { get; set; } + + /// + /// Gets or sets roleEligibilityScheduleId used to activate + /// + [JsonProperty(PropertyName = "properties.linkedRoleEligibilityScheduleId")] + public string LinkedRoleEligibilityScheduleId { get; set; } + + /// + /// Gets or sets roleEligibilityScheduleInstanceId linked to this + /// roleAssignmentScheduleInstance + /// + [JsonProperty(PropertyName = "properties.linkedRoleEligibilityScheduleInstanceId")] + public string LinkedRoleEligibilityScheduleInstanceId { get; set; } + + /// + /// Gets or sets assignment type of the role assignment schedule. + /// Possible values include: 'Activated', 'Assigned' + /// + [JsonProperty(PropertyName = "properties.assignmentType")] + public string AssignmentType { get; set; } + + /// + /// Gets or sets membership type of the role assignment schedule. + /// Possible values include: 'Inherited', 'Direct', 'Group' + /// + [JsonProperty(PropertyName = "properties.memberType")] + public string MemberType { 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 or sets dateTime when role assignment schedule was created + /// + [JsonProperty(PropertyName = "properties.createdOn")] + public System.DateTime? CreatedOn { get; set; } + + /// + /// Gets or sets additional properties of principal, scope and role + /// definition + /// + [JsonProperty(PropertyName = "properties.expandedProperties")] + public ExpandedProperties ExpandedProperties { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceFilter.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceFilter.cs new file mode 100644 index 000000000000..afc38d4264bd --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleInstanceFilter.cs @@ -0,0 +1,86 @@ +// +// 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 schedule instance filter + /// + public partial class RoleAssignmentScheduleInstanceFilter + { + /// + /// Initializes a new instance of the + /// RoleAssignmentScheduleInstanceFilter class. + /// + public RoleAssignmentScheduleInstanceFilter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RoleAssignmentScheduleInstanceFilter class. + /// + /// Returns role assignment schedule + /// instances of the specific principal. + /// Returns role assignment schedule + /// instances of the specific role definition. + /// Returns role assignment schedule instances of + /// the specific status. + /// Returns role assignment + /// schedule instances belonging to a specific role assignment + /// schedule. + public RoleAssignmentScheduleInstanceFilter(string principalId = default(string), string roleDefinitionId = default(string), string status = default(string), string roleAssignmentScheduleId = default(string)) + { + PrincipalId = principalId; + RoleDefinitionId = roleDefinitionId; + Status = status; + RoleAssignmentScheduleId = roleAssignmentScheduleId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets returns role assignment schedule instances of the + /// specific principal. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets returns role assignment schedule instances of the + /// specific role definition. + /// + [JsonProperty(PropertyName = "roleDefinitionId")] + public string RoleDefinitionId { get; set; } + + /// + /// Gets or sets returns role assignment schedule instances of the + /// specific status. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets returns role assignment schedule instances belonging + /// to a specific role assignment schedule. + /// + [JsonProperty(PropertyName = "roleAssignmentScheduleId")] + public string RoleAssignmentScheduleId { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequest.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequest.cs new file mode 100644 index 000000000000..9c8e075521ce --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequest.cs @@ -0,0 +1,288 @@ +// +// 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 schedule request + /// + [Rest.Serialization.JsonTransformation] + public partial class RoleAssignmentScheduleRequest + { + /// + /// Initializes a new instance of the RoleAssignmentScheduleRequest + /// class. + /// + public RoleAssignmentScheduleRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleAssignmentScheduleRequest + /// class. + /// + /// The role definition ID. + /// The principal ID. + /// The type of the role assignment schedule + /// request. Eg: SelfActivate, AdminAssign etc. Possible values + /// include: 'AdminAssign', 'AdminRemove', 'AdminUpdate', + /// 'AdminExtend', 'AdminRenew', 'SelfActivate', 'SelfDeactivate', + /// 'SelfExtend', 'SelfRenew' + /// The role assignment schedule request ID. + /// The role assignment schedule request + /// name. + /// The role assignment schedule request + /// type. + /// The role assignment schedule request + /// scope. + /// The principal type of the assigned + /// principal ID. Possible values include: 'User', 'Group', + /// 'ServicePrincipal', 'ForeignGroup', 'Device' + /// The status of the role assignment schedule + /// request. Possible values include: 'Accepted', 'PendingEvaluation', + /// 'Granted', 'Denied', 'PendingProvisioning', 'Provisioned', + /// 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', + /// 'PendingApprovalProvisioning', 'PendingApproval', + /// 'FailedAsResourceIsLocked', 'PendingAdminDecision', + /// 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', + /// 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', + /// 'PendingExternalProvisioning' + /// The approvalId of the role assignment + /// schedule request. + /// The resultant role + /// assignment schedule id or the role assignment schedule id being + /// updated + /// The role + /// assignment schedule instance id being updated + /// Schedule info of the role assignment + /// schedule + /// The linked role + /// eligibility schedule id - to activate an eligibility. + /// Justification for the role + /// assignment + /// Ticket Info of the 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' + /// DateTime when role assignment schedule + /// request was created + /// Id of the user who created this + /// request + /// Additional properties of + /// principal, scope and role definition + public RoleAssignmentScheduleRequest(string roleDefinitionId, string principalId, string requestType, string id = default(string), string name = default(string), string type = default(string), string scope = default(string), string principalType = default(string), string status = default(string), string approvalId = default(string), string targetRoleAssignmentScheduleId = default(string), string targetRoleAssignmentScheduleInstanceId = default(string), RoleAssignmentScheduleRequestPropertiesScheduleInfo scheduleInfo = default(RoleAssignmentScheduleRequestPropertiesScheduleInfo), string linkedRoleEligibilityScheduleId = default(string), string justification = default(string), RoleAssignmentScheduleRequestPropertiesTicketInfo ticketInfo = default(RoleAssignmentScheduleRequestPropertiesTicketInfo), string condition = default(string), string conditionVersion = default(string), System.DateTime? createdOn = default(System.DateTime?), string requestorId = default(string), ExpandedProperties expandedProperties = default(ExpandedProperties)) + { + Id = id; + Name = name; + Type = type; + Scope = scope; + RoleDefinitionId = roleDefinitionId; + PrincipalId = principalId; + PrincipalType = principalType; + RequestType = requestType; + Status = status; + ApprovalId = approvalId; + TargetRoleAssignmentScheduleId = targetRoleAssignmentScheduleId; + TargetRoleAssignmentScheduleInstanceId = targetRoleAssignmentScheduleInstanceId; + ScheduleInfo = scheduleInfo; + LinkedRoleEligibilityScheduleId = linkedRoleEligibilityScheduleId; + Justification = justification; + TicketInfo = ticketInfo; + Condition = condition; + ConditionVersion = conditionVersion; + CreatedOn = createdOn; + RequestorId = requestorId; + ExpandedProperties = expandedProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the role assignment schedule request ID. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the role assignment schedule request name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the role assignment schedule request type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the role assignment schedule request 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 the principal type of the assigned principal ID. Possible + /// values include: 'User', 'Group', 'ServicePrincipal', + /// 'ForeignGroup', 'Device' + /// + [JsonProperty(PropertyName = "properties.principalType")] + public string PrincipalType { get; private set; } + + /// + /// Gets or sets the type of the role assignment schedule request. Eg: + /// SelfActivate, AdminAssign etc. Possible values include: + /// 'AdminAssign', 'AdminRemove', 'AdminUpdate', 'AdminExtend', + /// 'AdminRenew', 'SelfActivate', 'SelfDeactivate', 'SelfExtend', + /// 'SelfRenew' + /// + [JsonProperty(PropertyName = "properties.requestType")] + public string RequestType { get; set; } + + /// + /// Gets the status of the role assignment schedule request. Possible + /// values include: 'Accepted', 'PendingEvaluation', 'Granted', + /// 'Denied', 'PendingProvisioning', 'Provisioned', + /// 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', + /// 'PendingApprovalProvisioning', 'PendingApproval', + /// 'FailedAsResourceIsLocked', 'PendingAdminDecision', + /// 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', + /// 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', + /// 'PendingExternalProvisioning' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets the approvalId of the role assignment schedule request. + /// + [JsonProperty(PropertyName = "properties.approvalId")] + public string ApprovalId { get; private set; } + + /// + /// Gets or sets the resultant role assignment schedule id or the role + /// assignment schedule id being updated + /// + [JsonProperty(PropertyName = "properties.targetRoleAssignmentScheduleId")] + public string TargetRoleAssignmentScheduleId { get; set; } + + /// + /// Gets or sets the role assignment schedule instance id being updated + /// + [JsonProperty(PropertyName = "properties.targetRoleAssignmentScheduleInstanceId")] + public string TargetRoleAssignmentScheduleInstanceId { get; set; } + + /// + /// Gets or sets schedule info of the role assignment schedule + /// + [JsonProperty(PropertyName = "properties.scheduleInfo")] + public RoleAssignmentScheduleRequestPropertiesScheduleInfo ScheduleInfo { get; set; } + + /// + /// Gets or sets the linked role eligibility schedule id - to activate + /// an eligibility. + /// + [JsonProperty(PropertyName = "properties.linkedRoleEligibilityScheduleId")] + public string LinkedRoleEligibilityScheduleId { get; set; } + + /// + /// Gets or sets justification for the role assignment + /// + [JsonProperty(PropertyName = "properties.justification")] + public string Justification { get; set; } + + /// + /// Gets or sets ticket Info of the role assignment + /// + [JsonProperty(PropertyName = "properties.ticketInfo")] + public RoleAssignmentScheduleRequestPropertiesTicketInfo TicketInfo { 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 dateTime when role assignment schedule request was created + /// + [JsonProperty(PropertyName = "properties.createdOn")] + public System.DateTime? CreatedOn { get; private set; } + + /// + /// Gets id of the user who created this request + /// + [JsonProperty(PropertyName = "properties.requestorId")] + public string RequestorId { get; private set; } + + /// + /// Gets additional properties of principal, scope and role definition + /// + [JsonProperty(PropertyName = "properties.expandedProperties")] + public ExpandedProperties ExpandedProperties { get; private 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"); + } + if (RequestType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RequestType"); + } + } + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestFilter.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestFilter.cs new file mode 100644 index 000000000000..5865939ca6b6 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestFilter.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Authorization.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Role assignment schedule request filter + /// + public partial class RoleAssignmentScheduleRequestFilter + { + /// + /// Initializes a new instance of the + /// RoleAssignmentScheduleRequestFilter class. + /// + public RoleAssignmentScheduleRequestFilter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RoleAssignmentScheduleRequestFilter class. + /// + /// Returns role assignment requests of the + /// specific principal. + /// Returns role assignment requests of + /// the specific role definition. + /// Returns role assignment requests created + /// by specific principal. + /// Returns role assignment requests of specific + /// status. + public RoleAssignmentScheduleRequestFilter(string principalId = default(string), string roleDefinitionId = default(string), string requestorId = default(string), string status = default(string)) + { + PrincipalId = principalId; + RoleDefinitionId = roleDefinitionId; + RequestorId = requestorId; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets returns role assignment requests of the specific + /// principal. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets returns role assignment requests of the specific role + /// definition. + /// + [JsonProperty(PropertyName = "roleDefinitionId")] + public string RoleDefinitionId { get; set; } + + /// + /// Gets or sets returns role assignment requests created by specific + /// principal. + /// + [JsonProperty(PropertyName = "requestorId")] + public string RequestorId { get; set; } + + /// + /// Gets or sets returns role assignment requests of specific status. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestPropertiesScheduleInfo.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestPropertiesScheduleInfo.cs new file mode 100644 index 000000000000..87ea6f68dad6 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestPropertiesScheduleInfo.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; + + /// + /// Schedule info of the role assignment schedule + /// + public partial class RoleAssignmentScheduleRequestPropertiesScheduleInfo + { + /// + /// Initializes a new instance of the + /// RoleAssignmentScheduleRequestPropertiesScheduleInfo class. + /// + public RoleAssignmentScheduleRequestPropertiesScheduleInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RoleAssignmentScheduleRequestPropertiesScheduleInfo class. + /// + /// Start DateTime of the role assignment + /// schedule. + /// Expiration of the role assignment + /// schedule + public RoleAssignmentScheduleRequestPropertiesScheduleInfo(System.DateTime? startDateTime = default(System.DateTime?), RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration expiration = default(RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration)) + { + StartDateTime = startDateTime; + Expiration = expiration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets start DateTime of the role assignment schedule. + /// + [JsonProperty(PropertyName = "startDateTime")] + public System.DateTime? StartDateTime { get; set; } + + /// + /// Gets or sets expiration of the role assignment schedule + /// + [JsonProperty(PropertyName = "expiration")] + public RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration Expiration { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration.cs new file mode 100644 index 000000000000..38aedf360f0f --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration.cs @@ -0,0 +1,77 @@ +// +// 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; + + /// + /// Expiration of the role assignment schedule + /// + public partial class RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration + { + /// + /// Initializes a new instance of the + /// RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration + /// class. + /// + public RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration + /// class. + /// + /// Type of the role assignment schedule expiration. + /// Possible values include: 'AfterDuration', 'AfterDateTime', + /// 'NoExpiration' + /// End DateTime of the role assignment + /// schedule. + /// Duration of the role assignment schedule in + /// TimeSpan. + public RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration(string type = default(string), System.DateTime? endDateTime = default(System.DateTime?), string duration = default(string)) + { + Type = type; + EndDateTime = endDateTime; + Duration = duration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of the role assignment schedule expiration. + /// Possible values include: 'AfterDuration', 'AfterDateTime', + /// 'NoExpiration' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets end DateTime of the role assignment schedule. + /// + [JsonProperty(PropertyName = "endDateTime")] + public System.DateTime? EndDateTime { get; set; } + + /// + /// Gets or sets duration of the role assignment schedule in TimeSpan. + /// + [JsonProperty(PropertyName = "duration")] + public string Duration { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestPropertiesTicketInfo.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestPropertiesTicketInfo.cs new file mode 100644 index 000000000000..57d5d3effe14 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleAssignmentScheduleRequestPropertiesTicketInfo.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; + + /// + /// Ticket Info of the role assignment + /// + public partial class RoleAssignmentScheduleRequestPropertiesTicketInfo + { + /// + /// Initializes a new instance of the + /// RoleAssignmentScheduleRequestPropertiesTicketInfo class. + /// + public RoleAssignmentScheduleRequestPropertiesTicketInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RoleAssignmentScheduleRequestPropertiesTicketInfo class. + /// + /// Ticket number for the role + /// assignment + /// Ticket system name for the role + /// assignment + public RoleAssignmentScheduleRequestPropertiesTicketInfo(string ticketNumber = default(string), string ticketSystem = default(string)) + { + TicketNumber = ticketNumber; + TicketSystem = ticketSystem; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ticket number for the role assignment + /// + [JsonProperty(PropertyName = "ticketNumber")] + public string TicketNumber { get; set; } + + /// + /// Gets or sets ticket system name for the role assignment + /// + [JsonProperty(PropertyName = "ticketSystem")] + public string TicketSystem { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilitySchedule.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilitySchedule.cs new file mode 100644 index 000000000000..1ec93831af33 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilitySchedule.cs @@ -0,0 +1,222 @@ +// +// 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 eligibility schedule + /// + [Rest.Serialization.JsonTransformation] + public partial class RoleEligibilitySchedule + { + /// + /// Initializes a new instance of the RoleEligibilitySchedule class. + /// + public RoleEligibilitySchedule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleEligibilitySchedule class. + /// + /// The role eligibility schedule Id. + /// The role eligibility schedule name. + /// The role eligibility schedule type. + /// The role eligibility schedule scope. + /// The role definition ID. + /// The principal ID. + /// The principal type of the assigned + /// principal ID. Possible values include: 'User', 'Group', + /// 'ServicePrincipal', 'ForeignGroup', 'Device' + /// The id of + /// roleEligibilityScheduleRequest used to create this + /// roleAssignmentSchedule + /// Membership type of the role eligibility + /// schedule. Possible values include: 'Inherited', 'Direct', + /// 'Group' + /// The status of the role eligibility schedule. + /// Possible values include: 'Accepted', 'PendingEvaluation', + /// 'Granted', 'Denied', 'PendingProvisioning', 'Provisioned', + /// 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', + /// 'PendingApprovalProvisioning', 'PendingApproval', + /// 'FailedAsResourceIsLocked', 'PendingAdminDecision', + /// 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', + /// 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', + /// 'PendingExternalProvisioning' + /// Start DateTime when role eligibility + /// schedule + /// End DateTime when role eligibility + /// schedule + /// 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' + /// DateTime when role eligibility schedule was + /// created + /// DateTime when role eligibility schedule was + /// modified + /// Additional properties of + /// principal, scope and role definition + public RoleEligibilitySchedule(string id = default(string), string name = default(string), string type = default(string), string scope = default(string), string roleDefinitionId = default(string), string principalId = default(string), string principalType = default(string), string roleEligibilityScheduleRequestId = default(string), string memberType = default(string), string status = default(string), System.DateTime? startDateTime = default(System.DateTime?), System.DateTime? endDateTime = default(System.DateTime?), string condition = default(string), string conditionVersion = default(string), System.DateTime? createdOn = default(System.DateTime?), System.DateTime? updatedOn = default(System.DateTime?), ExpandedProperties expandedProperties = default(ExpandedProperties)) + { + Id = id; + Name = name; + Type = type; + Scope = scope; + RoleDefinitionId = roleDefinitionId; + PrincipalId = principalId; + PrincipalType = principalType; + RoleEligibilityScheduleRequestId = roleEligibilityScheduleRequestId; + MemberType = memberType; + Status = status; + StartDateTime = startDateTime; + EndDateTime = endDateTime; + Condition = condition; + ConditionVersion = conditionVersion; + CreatedOn = createdOn; + UpdatedOn = updatedOn; + ExpandedProperties = expandedProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the role eligibility schedule Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the role eligibility schedule name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the role eligibility schedule type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the role eligibility schedule scope. + /// + [JsonProperty(PropertyName = "properties.scope")] + public string Scope { get; 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', + /// 'ForeignGroup', 'Device' + /// + [JsonProperty(PropertyName = "properties.principalType")] + public string PrincipalType { get; set; } + + /// + /// Gets or sets the id of roleEligibilityScheduleRequest used to + /// create this roleAssignmentSchedule + /// + [JsonProperty(PropertyName = "properties.roleEligibilityScheduleRequestId")] + public string RoleEligibilityScheduleRequestId { get; set; } + + /// + /// Gets or sets membership type of the role eligibility schedule. + /// Possible values include: 'Inherited', 'Direct', 'Group' + /// + [JsonProperty(PropertyName = "properties.memberType")] + public string MemberType { get; set; } + + /// + /// Gets or sets the status of the role eligibility schedule. Possible + /// values include: 'Accepted', 'PendingEvaluation', 'Granted', + /// 'Denied', 'PendingProvisioning', 'Provisioned', + /// 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', + /// 'PendingApprovalProvisioning', 'PendingApproval', + /// 'FailedAsResourceIsLocked', 'PendingAdminDecision', + /// 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', + /// 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', + /// 'PendingExternalProvisioning' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets start DateTime when role eligibility schedule + /// + [JsonProperty(PropertyName = "properties.startDateTime")] + public System.DateTime? StartDateTime { get; set; } + + /// + /// Gets or sets end DateTime when role eligibility schedule + /// + [JsonProperty(PropertyName = "properties.endDateTime")] + public System.DateTime? EndDateTime { 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 or sets dateTime when role eligibility schedule was created + /// + [JsonProperty(PropertyName = "properties.createdOn")] + public System.DateTime? CreatedOn { get; set; } + + /// + /// Gets or sets dateTime when role eligibility schedule was modified + /// + [JsonProperty(PropertyName = "properties.updatedOn")] + public System.DateTime? UpdatedOn { get; set; } + + /// + /// Gets or sets additional properties of principal, scope and role + /// definition + /// + [JsonProperty(PropertyName = "properties.expandedProperties")] + public ExpandedProperties ExpandedProperties { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleFilter.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleFilter.cs new file mode 100644 index 000000000000..f42afbddfe58 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleFilter.cs @@ -0,0 +1,75 @@ +// +// 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 eligibility schedule filter + /// + public partial class RoleEligibilityScheduleFilter + { + /// + /// Initializes a new instance of the RoleEligibilityScheduleFilter + /// class. + /// + public RoleEligibilityScheduleFilter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleEligibilityScheduleFilter + /// class. + /// + /// Returns role eligibility schedule of the + /// specific principal. + /// Returns role eligibility schedule of + /// the specific role definition. + /// Returns role eligibility schedule of the + /// specific status. + public RoleEligibilityScheduleFilter(string principalId = default(string), string roleDefinitionId = default(string), string status = default(string)) + { + PrincipalId = principalId; + RoleDefinitionId = roleDefinitionId; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets returns role eligibility schedule of the specific + /// principal. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets returns role eligibility schedule of the specific role + /// definition. + /// + [JsonProperty(PropertyName = "roleDefinitionId")] + public string RoleDefinitionId { get; set; } + + /// + /// Gets or sets returns role eligibility schedule of the specific + /// status. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleInstance.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleInstance.cs new file mode 100644 index 000000000000..7969c18ca081 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleInstance.cs @@ -0,0 +1,218 @@ +// +// 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; + + /// + /// Information about current or upcoming role eligibility schedule + /// instance + /// + [Rest.Serialization.JsonTransformation] + public partial class RoleEligibilityScheduleInstance + { + /// + /// Initializes a new instance of the RoleEligibilityScheduleInstance + /// class. + /// + public RoleEligibilityScheduleInstance() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleEligibilityScheduleInstance + /// class. + /// + /// The role eligibility schedule instance ID. + /// The role eligibility schedule instance + /// name. + /// The role eligibility schedule instance + /// type. + /// The role eligibility schedule scope. + /// The role definition ID. + /// The principal ID. + /// The principal type of the assigned + /// principal ID. Possible values include: 'User', 'Group', + /// 'ServicePrincipal', 'ForeignGroup', 'Device' + /// Id of the master role + /// eligibility schedule + /// The status of the role eligibility schedule + /// instance. Possible values include: 'Accepted', 'PendingEvaluation', + /// 'Granted', 'Denied', 'PendingProvisioning', 'Provisioned', + /// 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', + /// 'PendingApprovalProvisioning', 'PendingApproval', + /// 'FailedAsResourceIsLocked', 'PendingAdminDecision', + /// 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', + /// 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', + /// 'PendingExternalProvisioning' + /// The startDateTime of the role + /// eligibility schedule instance + /// The endDateTime of the role eligibility + /// schedule instance + /// Membership type of the role eligibility + /// schedule. Possible values include: 'Inherited', 'Direct', + /// 'Group' + /// 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' + /// DateTime when role eligibility schedule was + /// created + /// Additional properties of + /// principal, scope and role definition + public RoleEligibilityScheduleInstance(string id = default(string), string name = default(string), string type = default(string), string scope = default(string), string roleDefinitionId = default(string), string principalId = default(string), string principalType = default(string), string roleEligibilityScheduleId = default(string), string status = default(string), System.DateTime? startDateTime = default(System.DateTime?), System.DateTime? endDateTime = default(System.DateTime?), string memberType = default(string), string condition = default(string), string conditionVersion = default(string), System.DateTime? createdOn = default(System.DateTime?), ExpandedProperties expandedProperties = default(ExpandedProperties)) + { + Id = id; + Name = name; + Type = type; + Scope = scope; + RoleDefinitionId = roleDefinitionId; + PrincipalId = principalId; + PrincipalType = principalType; + RoleEligibilityScheduleId = roleEligibilityScheduleId; + Status = status; + StartDateTime = startDateTime; + EndDateTime = endDateTime; + MemberType = memberType; + Condition = condition; + ConditionVersion = conditionVersion; + CreatedOn = createdOn; + ExpandedProperties = expandedProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the role eligibility schedule instance ID. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the role eligibility schedule instance name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the role eligibility schedule instance type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the role eligibility schedule scope. + /// + [JsonProperty(PropertyName = "properties.scope")] + public string Scope { get; 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', + /// 'ForeignGroup', 'Device' + /// + [JsonProperty(PropertyName = "properties.principalType")] + public string PrincipalType { get; set; } + + /// + /// Gets or sets id of the master role eligibility schedule + /// + [JsonProperty(PropertyName = "properties.roleEligibilityScheduleId")] + public string RoleEligibilityScheduleId { get; set; } + + /// + /// Gets or sets the status of the role eligibility schedule instance. + /// Possible values include: 'Accepted', 'PendingEvaluation', + /// 'Granted', 'Denied', 'PendingProvisioning', 'Provisioned', + /// 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', + /// 'PendingApprovalProvisioning', 'PendingApproval', + /// 'FailedAsResourceIsLocked', 'PendingAdminDecision', + /// 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', + /// 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', + /// 'PendingExternalProvisioning' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the startDateTime of the role eligibility schedule + /// instance + /// + [JsonProperty(PropertyName = "properties.startDateTime")] + public System.DateTime? StartDateTime { get; set; } + + /// + /// Gets or sets the endDateTime of the role eligibility schedule + /// instance + /// + [JsonProperty(PropertyName = "properties.endDateTime")] + public System.DateTime? EndDateTime { get; set; } + + /// + /// Gets or sets membership type of the role eligibility schedule. + /// Possible values include: 'Inherited', 'Direct', 'Group' + /// + [JsonProperty(PropertyName = "properties.memberType")] + public string MemberType { 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 or sets dateTime when role eligibility schedule was created + /// + [JsonProperty(PropertyName = "properties.createdOn")] + public System.DateTime? CreatedOn { get; set; } + + /// + /// Gets or sets additional properties of principal, scope and role + /// definition + /// + [JsonProperty(PropertyName = "properties.expandedProperties")] + public ExpandedProperties ExpandedProperties { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceFilter.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceFilter.cs new file mode 100644 index 000000000000..d3bd25892659 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleInstanceFilter.cs @@ -0,0 +1,86 @@ +// +// 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 eligibility schedule instance filter + /// + public partial class RoleEligibilityScheduleInstanceFilter + { + /// + /// Initializes a new instance of the + /// RoleEligibilityScheduleInstanceFilter class. + /// + public RoleEligibilityScheduleInstanceFilter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RoleEligibilityScheduleInstanceFilter class. + /// + /// Returns role eligibility schedule + /// instances of the specific principal. + /// Returns role eligibility schedule + /// instances of the specific role definition. + /// Returns role eligibility schedule instances of + /// the specific status. + /// Returns role eligibility + /// schedule instances belonging to a specific role eligibility + /// schedule. + public RoleEligibilityScheduleInstanceFilter(string principalId = default(string), string roleDefinitionId = default(string), string status = default(string), string roleEligibilityScheduleId = default(string)) + { + PrincipalId = principalId; + RoleDefinitionId = roleDefinitionId; + Status = status; + RoleEligibilityScheduleId = roleEligibilityScheduleId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets returns role eligibility schedule instances of the + /// specific principal. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets returns role eligibility schedule instances of the + /// specific role definition. + /// + [JsonProperty(PropertyName = "roleDefinitionId")] + public string RoleDefinitionId { get; set; } + + /// + /// Gets or sets returns role eligibility schedule instances of the + /// specific status. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets returns role eligibility schedule instances belonging + /// to a specific role eligibility schedule. + /// + [JsonProperty(PropertyName = "roleEligibilityScheduleId")] + public string RoleEligibilityScheduleId { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequest.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequest.cs new file mode 100644 index 000000000000..5d01e43c205c --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequest.cs @@ -0,0 +1,280 @@ +// +// 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 Eligibility schedule request + /// + [Rest.Serialization.JsonTransformation] + public partial class RoleEligibilityScheduleRequest + { + /// + /// Initializes a new instance of the RoleEligibilityScheduleRequest + /// class. + /// + public RoleEligibilityScheduleRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleEligibilityScheduleRequest + /// class. + /// + /// The role definition ID. + /// The principal ID. + /// The type of the role assignment schedule + /// request. Eg: SelfActivate, AdminAssign etc. Possible values + /// include: 'AdminAssign', 'AdminRemove', 'AdminUpdate', + /// 'AdminExtend', 'AdminRenew', 'SelfActivate', 'SelfDeactivate', + /// 'SelfExtend', 'SelfRenew' + /// The role eligibility schedule request ID. + /// The role eligibility schedule request + /// name. + /// The role eligibility schedule request + /// type. + /// The role eligibility schedule request + /// scope. + /// The principal type of the assigned + /// principal ID. Possible values include: 'User', 'Group', + /// 'ServicePrincipal', 'ForeignGroup', 'Device' + /// The status of the role eligibility schedule + /// request. Possible values include: 'Accepted', 'PendingEvaluation', + /// 'Granted', 'Denied', 'PendingProvisioning', 'Provisioned', + /// 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', + /// 'PendingApprovalProvisioning', 'PendingApproval', + /// 'FailedAsResourceIsLocked', 'PendingAdminDecision', + /// 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', + /// 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', + /// 'PendingExternalProvisioning' + /// The approvalId of the role eligibility + /// schedule request. + /// Schedule info of the role eligibility + /// schedule + /// The resultant role + /// eligibility schedule id or the role eligibility schedule id being + /// updated + /// The role + /// eligibility schedule instance id being updated + /// Justification for the role + /// eligibility + /// Ticket Info of the role + /// eligibility + /// 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' + /// DateTime when role eligibility schedule + /// request was created + /// Id of the user who created this + /// request + /// Additional properties of + /// principal, scope and role definition + public RoleEligibilityScheduleRequest(string roleDefinitionId, string principalId, string requestType, string id = default(string), string name = default(string), string type = default(string), string scope = default(string), string principalType = default(string), string status = default(string), string approvalId = default(string), RoleEligibilityScheduleRequestPropertiesScheduleInfo scheduleInfo = default(RoleEligibilityScheduleRequestPropertiesScheduleInfo), string targetRoleEligibilityScheduleId = default(string), string targetRoleEligibilityScheduleInstanceId = default(string), string justification = default(string), RoleEligibilityScheduleRequestPropertiesTicketInfo ticketInfo = default(RoleEligibilityScheduleRequestPropertiesTicketInfo), string condition = default(string), string conditionVersion = default(string), System.DateTime? createdOn = default(System.DateTime?), string requestorId = default(string), ExpandedProperties expandedProperties = default(ExpandedProperties)) + { + Id = id; + Name = name; + Type = type; + Scope = scope; + RoleDefinitionId = roleDefinitionId; + PrincipalId = principalId; + PrincipalType = principalType; + RequestType = requestType; + Status = status; + ApprovalId = approvalId; + ScheduleInfo = scheduleInfo; + TargetRoleEligibilityScheduleId = targetRoleEligibilityScheduleId; + TargetRoleEligibilityScheduleInstanceId = targetRoleEligibilityScheduleInstanceId; + Justification = justification; + TicketInfo = ticketInfo; + Condition = condition; + ConditionVersion = conditionVersion; + CreatedOn = createdOn; + RequestorId = requestorId; + ExpandedProperties = expandedProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the role eligibility schedule request ID. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the role eligibility schedule request name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the role eligibility schedule request type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the role eligibility schedule request 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 the principal type of the assigned principal ID. Possible + /// values include: 'User', 'Group', 'ServicePrincipal', + /// 'ForeignGroup', 'Device' + /// + [JsonProperty(PropertyName = "properties.principalType")] + public string PrincipalType { get; private set; } + + /// + /// Gets or sets the type of the role assignment schedule request. Eg: + /// SelfActivate, AdminAssign etc. Possible values include: + /// 'AdminAssign', 'AdminRemove', 'AdminUpdate', 'AdminExtend', + /// 'AdminRenew', 'SelfActivate', 'SelfDeactivate', 'SelfExtend', + /// 'SelfRenew' + /// + [JsonProperty(PropertyName = "properties.requestType")] + public string RequestType { get; set; } + + /// + /// Gets the status of the role eligibility schedule request. Possible + /// values include: 'Accepted', 'PendingEvaluation', 'Granted', + /// 'Denied', 'PendingProvisioning', 'Provisioned', + /// 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', + /// 'PendingApprovalProvisioning', 'PendingApproval', + /// 'FailedAsResourceIsLocked', 'PendingAdminDecision', + /// 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', + /// 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', + /// 'PendingExternalProvisioning' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets the approvalId of the role eligibility schedule request. + /// + [JsonProperty(PropertyName = "properties.approvalId")] + public string ApprovalId { get; private set; } + + /// + /// Gets or sets schedule info of the role eligibility schedule + /// + [JsonProperty(PropertyName = "properties.scheduleInfo")] + public RoleEligibilityScheduleRequestPropertiesScheduleInfo ScheduleInfo { get; set; } + + /// + /// Gets or sets the resultant role eligibility schedule id or the role + /// eligibility schedule id being updated + /// + [JsonProperty(PropertyName = "properties.targetRoleEligibilityScheduleId")] + public string TargetRoleEligibilityScheduleId { get; set; } + + /// + /// Gets or sets the role eligibility schedule instance id being + /// updated + /// + [JsonProperty(PropertyName = "properties.targetRoleEligibilityScheduleInstanceId")] + public string TargetRoleEligibilityScheduleInstanceId { get; set; } + + /// + /// Gets or sets justification for the role eligibility + /// + [JsonProperty(PropertyName = "properties.justification")] + public string Justification { get; set; } + + /// + /// Gets or sets ticket Info of the role eligibility + /// + [JsonProperty(PropertyName = "properties.ticketInfo")] + public RoleEligibilityScheduleRequestPropertiesTicketInfo TicketInfo { 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 dateTime when role eligibility schedule request was created + /// + [JsonProperty(PropertyName = "properties.createdOn")] + public System.DateTime? CreatedOn { get; private set; } + + /// + /// Gets id of the user who created this request + /// + [JsonProperty(PropertyName = "properties.requestorId")] + public string RequestorId { get; private set; } + + /// + /// Gets additional properties of principal, scope and role definition + /// + [JsonProperty(PropertyName = "properties.expandedProperties")] + public ExpandedProperties ExpandedProperties { get; private 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"); + } + if (RequestType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RequestType"); + } + } + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestFilter.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestFilter.cs new file mode 100644 index 000000000000..2522423993d5 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestFilter.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Authorization.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Role eligibility schedule request filter + /// + public partial class RoleEligibilityScheduleRequestFilter + { + /// + /// Initializes a new instance of the + /// RoleEligibilityScheduleRequestFilter class. + /// + public RoleEligibilityScheduleRequestFilter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RoleEligibilityScheduleRequestFilter class. + /// + /// Returns role eligibility requests of the + /// specific principal. + /// Returns role eligibility requests of + /// the specific role definition. + /// Returns role eligibility requests created + /// by specific principal. + /// Returns role eligibility requests of specific + /// status. + public RoleEligibilityScheduleRequestFilter(string principalId = default(string), string roleDefinitionId = default(string), string requestorId = default(string), string status = default(string)) + { + PrincipalId = principalId; + RoleDefinitionId = roleDefinitionId; + RequestorId = requestorId; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets returns role eligibility requests of the specific + /// principal. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets returns role eligibility requests of the specific role + /// definition. + /// + [JsonProperty(PropertyName = "roleDefinitionId")] + public string RoleDefinitionId { get; set; } + + /// + /// Gets or sets returns role eligibility requests created by specific + /// principal. + /// + [JsonProperty(PropertyName = "requestorId")] + public string RequestorId { get; set; } + + /// + /// Gets or sets returns role eligibility requests of specific status. + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesScheduleInfo.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesScheduleInfo.cs new file mode 100644 index 000000000000..22b5b62adc63 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesScheduleInfo.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; + + /// + /// Schedule info of the role eligibility schedule + /// + public partial class RoleEligibilityScheduleRequestPropertiesScheduleInfo + { + /// + /// Initializes a new instance of the + /// RoleEligibilityScheduleRequestPropertiesScheduleInfo class. + /// + public RoleEligibilityScheduleRequestPropertiesScheduleInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RoleEligibilityScheduleRequestPropertiesScheduleInfo class. + /// + /// Start DateTime of the role eligibility + /// schedule. + /// Expiration of the role eligibility + /// schedule + public RoleEligibilityScheduleRequestPropertiesScheduleInfo(System.DateTime? startDateTime = default(System.DateTime?), RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration expiration = default(RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration)) + { + StartDateTime = startDateTime; + Expiration = expiration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets start DateTime of the role eligibility schedule. + /// + [JsonProperty(PropertyName = "startDateTime")] + public System.DateTime? StartDateTime { get; set; } + + /// + /// Gets or sets expiration of the role eligibility schedule + /// + [JsonProperty(PropertyName = "expiration")] + public RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration Expiration { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration.cs new file mode 100644 index 000000000000..a71cd0abf60a --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration.cs @@ -0,0 +1,77 @@ +// +// 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; + + /// + /// Expiration of the role eligibility schedule + /// + public partial class RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration + { + /// + /// Initializes a new instance of the + /// RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration + /// class. + /// + public RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration + /// class. + /// + /// Type of the role eligibility schedule + /// expiration. Possible values include: 'AfterDuration', + /// 'AfterDateTime', 'NoExpiration' + /// End DateTime of the role eligibility + /// schedule. + /// Duration of the role eligibility schedule in + /// TimeSpan. + public RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration(string type = default(string), System.DateTime? endDateTime = default(System.DateTime?), string duration = default(string)) + { + Type = type; + EndDateTime = endDateTime; + Duration = duration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of the role eligibility schedule expiration. + /// Possible values include: 'AfterDuration', 'AfterDateTime', + /// 'NoExpiration' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets end DateTime of the role eligibility schedule. + /// + [JsonProperty(PropertyName = "endDateTime")] + public System.DateTime? EndDateTime { get; set; } + + /// + /// Gets or sets duration of the role eligibility schedule in TimeSpan. + /// + [JsonProperty(PropertyName = "duration")] + public string Duration { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesTicketInfo.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesTicketInfo.cs new file mode 100644 index 000000000000..ee45b297639a --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleEligibilityScheduleRequestPropertiesTicketInfo.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; + + /// + /// Ticket Info of the role eligibility + /// + public partial class RoleEligibilityScheduleRequestPropertiesTicketInfo + { + /// + /// Initializes a new instance of the + /// RoleEligibilityScheduleRequestPropertiesTicketInfo class. + /// + public RoleEligibilityScheduleRequestPropertiesTicketInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RoleEligibilityScheduleRequestPropertiesTicketInfo class. + /// + /// Ticket number for the role + /// eligibility + /// Ticket system name for the role + /// eligibility + public RoleEligibilityScheduleRequestPropertiesTicketInfo(string ticketNumber = default(string), string ticketSystem = default(string)) + { + TicketNumber = ticketNumber; + TicketSystem = ticketSystem; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ticket number for the role eligibility + /// + [JsonProperty(PropertyName = "ticketNumber")] + public string TicketNumber { get; set; } + + /// + /// Gets or sets ticket system name for the role eligibility + /// + [JsonProperty(PropertyName = "ticketSystem")] + public string TicketSystem { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicy.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicy.cs new file mode 100644 index 000000000000..28178775aa86 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicy.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 Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Role management policy + /// + [Rest.Serialization.JsonTransformation] + public partial class RoleManagementPolicy + { + /// + /// Initializes a new instance of the RoleManagementPolicy class. + /// + public RoleManagementPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleManagementPolicy class. + /// + /// The role management policy Id. + /// The role management policy name. + /// The role management policy type. + /// The role management policy scope. + /// The role management policy display + /// name. + /// The role management policy + /// description. + /// The role management policy is + /// default policy. + /// The last modified date + /// time. + /// The rule applied to the policy. + /// The readonly computed rule applied to + /// the policy. + /// Additional properties of + /// scope + public RoleManagementPolicy(string id = default(string), string name = default(string), string type = default(string), string scope = default(string), string displayName = default(string), string description = default(string), bool? isOrganizationDefault = default(bool?), Principal lastModifiedBy = default(Principal), System.DateTime? lastModifiedDateTime = default(System.DateTime?), IList rules = default(IList), IList effectiveRules = default(IList), PolicyProperties policyProperties = default(PolicyProperties)) + { + Id = id; + Name = name; + Type = type; + Scope = scope; + DisplayName = displayName; + Description = description; + IsOrganizationDefault = isOrganizationDefault; + LastModifiedBy = lastModifiedBy; + LastModifiedDateTime = lastModifiedDateTime; + Rules = rules; + EffectiveRules = effectiveRules; + PolicyProperties = policyProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the role management policy Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the role management policy name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the role management policy type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the role management policy scope. + /// + [JsonProperty(PropertyName = "properties.scope")] + public string Scope { get; set; } + + /// + /// Gets or sets the role management policy display name. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the role management policy description. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the role management policy is default policy. + /// + [JsonProperty(PropertyName = "properties.isOrganizationDefault")] + public bool? IsOrganizationDefault { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.lastModifiedBy")] + public Principal LastModifiedBy { get; set; } + + /// + /// Gets the last modified date time. + /// + [JsonProperty(PropertyName = "properties.lastModifiedDateTime")] + public System.DateTime? LastModifiedDateTime { get; private set; } + + /// + /// Gets or sets the rule applied to the policy. + /// + [JsonProperty(PropertyName = "properties.rules")] + public IList Rules { get; set; } + + /// + /// Gets the readonly computed rule applied to the policy. + /// + [JsonProperty(PropertyName = "properties.effectiveRules")] + public IList EffectiveRules { get; private set; } + + /// + /// Gets additional properties of scope + /// + [JsonProperty(PropertyName = "properties.policyProperties")] + public PolicyProperties PolicyProperties { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyApprovalRule.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyApprovalRule.cs new file mode 100644 index 000000000000..57373bb16fee --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyApprovalRule.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Authorization.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The role management policy rule. + /// + public partial class RoleManagementPolicyApprovalRule : RoleManagementPolicyRule + { + /// + /// Initializes a new instance of the RoleManagementPolicyApprovalRule + /// class. + /// + public RoleManagementPolicyApprovalRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleManagementPolicyApprovalRule + /// class. + /// + /// The id of the rule. + /// The target of the current rule. + /// The approval setting + public RoleManagementPolicyApprovalRule(string id = default(string), RoleManagementPolicyRuleTarget target = default(RoleManagementPolicyRuleTarget), ApprovalSettings setting = default(ApprovalSettings)) + : base(id, target) + { + Setting = setting; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the approval setting + /// + [JsonProperty(PropertyName = "setting")] + public ApprovalSettings Setting { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyAssignment.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyAssignment.cs new file mode 100644 index 000000000000..bc961441f1c6 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyAssignment.cs @@ -0,0 +1,107 @@ +// +// 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 management policy + /// + [Rest.Serialization.JsonTransformation] + public partial class RoleManagementPolicyAssignment + { + /// + /// Initializes a new instance of the RoleManagementPolicyAssignment + /// class. + /// + public RoleManagementPolicyAssignment() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleManagementPolicyAssignment + /// class. + /// + /// The role management policy Id. + /// The role management policy name. + /// The role management policy type. + /// The role management policy scope. + /// The role definition of management + /// policy assignment. + /// The policy id role management policy + /// assignment. + /// Additional properties of + /// scope, role definition and policy + public RoleManagementPolicyAssignment(string id = default(string), string name = default(string), string type = default(string), string scope = default(string), string roleDefinitionId = default(string), string policyId = default(string), PolicyAssignmentProperties policyAssignmentProperties = default(PolicyAssignmentProperties)) + { + Id = id; + Name = name; + Type = type; + Scope = scope; + RoleDefinitionId = roleDefinitionId; + PolicyId = policyId; + PolicyAssignmentProperties = policyAssignmentProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the role management policy Id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the role management policy name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the role management policy type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets the role management policy scope. + /// + [JsonProperty(PropertyName = "properties.scope")] + public string Scope { get; set; } + + /// + /// Gets or sets the role definition of management policy assignment. + /// + [JsonProperty(PropertyName = "properties.roleDefinitionId")] + public string RoleDefinitionId { get; set; } + + /// + /// Gets or sets the policy id role management policy assignment. + /// + [JsonProperty(PropertyName = "properties.policyId")] + public string PolicyId { get; set; } + + /// + /// Gets additional properties of scope, role definition and policy + /// + [JsonProperty(PropertyName = "properties.policyAssignmentProperties")] + public PolicyAssignmentProperties PolicyAssignmentProperties { get; private set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyAuthenticationContextRule.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyAuthenticationContextRule.cs new file mode 100644 index 000000000000..87c2568cec64 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyAuthenticationContextRule.cs @@ -0,0 +1,65 @@ +// +// 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 role management policy rule. + /// + public partial class RoleManagementPolicyAuthenticationContextRule : RoleManagementPolicyRule + { + /// + /// Initializes a new instance of the + /// RoleManagementPolicyAuthenticationContextRule class. + /// + public RoleManagementPolicyAuthenticationContextRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RoleManagementPolicyAuthenticationContextRule class. + /// + /// The id of the rule. + /// The target of the current rule. + /// The value indicating if rule is + /// enabled. + /// The claim value. + public RoleManagementPolicyAuthenticationContextRule(string id = default(string), RoleManagementPolicyRuleTarget target = default(RoleManagementPolicyRuleTarget), bool? isEnabled = default(bool?), string claimValue = default(string)) + : base(id, target) + { + IsEnabled = isEnabled; + ClaimValue = claimValue; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the value indicating if rule is enabled. + /// + [JsonProperty(PropertyName = "isEnabled")] + public bool? IsEnabled { get; set; } + + /// + /// Gets or sets the claim value. + /// + [JsonProperty(PropertyName = "claimValue")] + public string ClaimValue { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyEnablementRule.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyEnablementRule.cs new file mode 100644 index 000000000000..7967a2eddeff --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyEnablementRule.cs @@ -0,0 +1,58 @@ +// +// 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 role management policy rule. + /// + public partial class RoleManagementPolicyEnablementRule : RoleManagementPolicyRule + { + /// + /// Initializes a new instance of the + /// RoleManagementPolicyEnablementRule class. + /// + public RoleManagementPolicyEnablementRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RoleManagementPolicyEnablementRule class. + /// + /// The id of the rule. + /// The target of the current rule. + /// The list of enabled rules. + public RoleManagementPolicyEnablementRule(string id = default(string), RoleManagementPolicyRuleTarget target = default(RoleManagementPolicyRuleTarget), IList enabledRules = default(IList)) + : base(id, target) + { + EnabledRules = enabledRules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of enabled rules. + /// + [JsonProperty(PropertyName = "enabledRules")] + public IList EnabledRules { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyExpirationRule.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyExpirationRule.cs new file mode 100644 index 000000000000..6d32ee424ea0 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyExpirationRule.cs @@ -0,0 +1,66 @@ +// +// 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 role management policy rule. + /// + public partial class RoleManagementPolicyExpirationRule : RoleManagementPolicyRule + { + /// + /// Initializes a new instance of the + /// RoleManagementPolicyExpirationRule class. + /// + public RoleManagementPolicyExpirationRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RoleManagementPolicyExpirationRule class. + /// + /// The id of the rule. + /// The target of the current rule. + /// The value indicating whether + /// expiration is required. + /// The maximum duration of expiration in + /// timespan. + public RoleManagementPolicyExpirationRule(string id = default(string), RoleManagementPolicyRuleTarget target = default(RoleManagementPolicyRuleTarget), bool? isExpirationRequired = default(bool?), string maximumDuration = default(string)) + : base(id, target) + { + IsExpirationRequired = isExpirationRequired; + MaximumDuration = maximumDuration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the value indicating whether expiration is required. + /// + [JsonProperty(PropertyName = "isExpirationRequired")] + public bool? IsExpirationRequired { get; set; } + + /// + /// Gets or sets the maximum duration of expiration in timespan. + /// + [JsonProperty(PropertyName = "maximumDuration")] + public string MaximumDuration { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyNotificationRule.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyNotificationRule.cs new file mode 100644 index 000000000000..97682b74e074 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyNotificationRule.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 Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The role management policy rule. + /// + public partial class RoleManagementPolicyNotificationRule : RoleManagementPolicyRule + { + /// + /// Initializes a new instance of the + /// RoleManagementPolicyNotificationRule class. + /// + public RoleManagementPolicyNotificationRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// RoleManagementPolicyNotificationRule class. + /// + /// The id of the rule. + /// The target of the current rule. + /// The type of notification. Possible + /// values include: 'Email' + /// The notification level. Possible + /// values include: 'None', 'Critical', 'All' + /// The recipient type. Possible values + /// include: 'Requestor', 'Approver', 'Admin' + /// The list notification + /// recipients. + /// Its value determine if the + /// notification need to be sent to the recipient type specified in + /// policy rule. + public RoleManagementPolicyNotificationRule(string id = default(string), RoleManagementPolicyRuleTarget target = default(RoleManagementPolicyRuleTarget), string notificationType = default(string), string notificationLevel = default(string), string recipientType = default(string), IList notificationRecipients = default(IList), bool? isDefaultRecipientsEnabled = default(bool?)) + : base(id, target) + { + NotificationType = notificationType; + NotificationLevel = notificationLevel; + RecipientType = recipientType; + NotificationRecipients = notificationRecipients; + IsDefaultRecipientsEnabled = isDefaultRecipientsEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of notification. Possible values include: + /// 'Email' + /// + [JsonProperty(PropertyName = "notificationType")] + public string NotificationType { get; set; } + + /// + /// Gets or sets the notification level. Possible values include: + /// 'None', 'Critical', 'All' + /// + [JsonProperty(PropertyName = "notificationLevel")] + public string NotificationLevel { get; set; } + + /// + /// Gets or sets the recipient type. Possible values include: + /// 'Requestor', 'Approver', 'Admin' + /// + [JsonProperty(PropertyName = "recipientType")] + public string RecipientType { get; set; } + + /// + /// Gets or sets the list notification recipients. + /// + [JsonProperty(PropertyName = "notificationRecipients")] + public IList NotificationRecipients { get; set; } + + /// + /// Gets or sets its value determine if the notification need to be + /// sent to the recipient type specified in policy rule. + /// + [JsonProperty(PropertyName = "isDefaultRecipientsEnabled")] + public bool? IsDefaultRecipientsEnabled { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyRule.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyRule.cs new file mode 100644 index 000000000000..39d5dc3f8176 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyRule.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Authorization.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The role management policy rule. + /// + public partial class RoleManagementPolicyRule + { + /// + /// Initializes a new instance of the RoleManagementPolicyRule class. + /// + public RoleManagementPolicyRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleManagementPolicyRule class. + /// + /// The id of the rule. + /// The target of the current rule. + public RoleManagementPolicyRule(string id = default(string), RoleManagementPolicyRuleTarget target = default(RoleManagementPolicyRuleTarget)) + { + Id = id; + Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the id of the rule. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the target of the current rule. + /// + [JsonProperty(PropertyName = "target")] + public RoleManagementPolicyRuleTarget Target { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyRuleTarget.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyRuleTarget.cs new file mode 100644 index 000000000000..d5ce2ed78479 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyRuleTarget.cs @@ -0,0 +1,98 @@ +// +// 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 role management policy rule target. + /// + public partial class RoleManagementPolicyRuleTarget + { + /// + /// Initializes a new instance of the RoleManagementPolicyRuleTarget + /// class. + /// + public RoleManagementPolicyRuleTarget() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RoleManagementPolicyRuleTarget + /// class. + /// + /// The caller of the setting. + /// The type of operation. + /// The assignment level to which it is + /// applied. + /// The list of target objects. + /// The list of inheritable + /// settings. + /// The list of enforced + /// settings. + public RoleManagementPolicyRuleTarget(string caller = default(string), IList operations = default(IList), string level = default(string), IList targetObjects = default(IList), IList inheritableSettings = default(IList), IList enforcedSettings = default(IList)) + { + Caller = caller; + Operations = operations; + Level = level; + TargetObjects = targetObjects; + InheritableSettings = inheritableSettings; + EnforcedSettings = enforcedSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the caller of the setting. + /// + [JsonProperty(PropertyName = "caller")] + public string Caller { get; set; } + + /// + /// Gets or sets the type of operation. + /// + [JsonProperty(PropertyName = "operations")] + public IList Operations { get; set; } + + /// + /// Gets or sets the assignment level to which it is applied. + /// + [JsonProperty(PropertyName = "level")] + public string Level { get; set; } + + /// + /// Gets or sets the list of target objects. + /// + [JsonProperty(PropertyName = "targetObjects")] + public IList TargetObjects { get; set; } + + /// + /// Gets or sets the list of inheritable settings. + /// + [JsonProperty(PropertyName = "inheritableSettings")] + public IList InheritableSettings { get; set; } + + /// + /// Gets or sets the list of enforced settings. + /// + [JsonProperty(PropertyName = "enforcedSettings")] + public IList EnforcedSettings { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyRuleType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyRuleType.cs new file mode 100644 index 000000000000..a26dd459ded7 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/RoleManagementPolicyRuleType.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 RoleManagementPolicyRuleType. + /// + public static class RoleManagementPolicyRuleType + { + public const string RoleManagementPolicyApprovalRule = "RoleManagementPolicyApprovalRule"; + public const string RoleManagementPolicyAuthenticationContextRule = "RoleManagementPolicyAuthenticationContextRule"; + public const string RoleManagementPolicyEnablementRule = "RoleManagementPolicyEnablementRule"; + public const string RoleManagementPolicyExpirationRule = "RoleManagementPolicyExpirationRule"; + public const string RoleManagementPolicyNotificationRule = "RoleManagementPolicyNotificationRule"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ServicePrincipalDecisionTarget.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ServicePrincipalDecisionTarget.cs new file mode 100644 index 000000000000..3a0b84e9a66a --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/ServicePrincipalDecisionTarget.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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Service Principal Decision Target + /// + [Newtonsoft.Json.JsonObject("servicePrincipal")] + public partial class ServicePrincipalDecisionTarget : AccessReviewDecisionTarget + { + /// + /// Initializes a new instance of the ServicePrincipalDecisionTarget + /// class. + /// + public ServicePrincipalDecisionTarget() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServicePrincipalDecisionTarget + /// class. + /// + /// The id of service principal whose access + /// is reviewed. + /// The display name of the service + /// principal whose access was reviewed. + /// The appId for the service principal entity + /// being reviewed + public ServicePrincipalDecisionTarget(string principalId = default(string), string principalName = default(string), string appId = default(string)) + { + PrincipalId = principalId; + PrincipalName = principalName; + AppId = appId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the id of service principal whose access is reviewed. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the display name of the service principal whose access was + /// reviewed. + /// + [JsonProperty(PropertyName = "principalName")] + public string PrincipalName { get; private set; } + + /// + /// 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/Status.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Status.cs new file mode 100644 index 000000000000..061800e8dcbb --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Status.cs @@ -0,0 +1,42 @@ +// +// 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 Status. + /// + public static class Status + { + public const string Accepted = "Accepted"; + public const string PendingEvaluation = "PendingEvaluation"; + public const string Granted = "Granted"; + public const string Denied = "Denied"; + public const string PendingProvisioning = "PendingProvisioning"; + public const string Provisioned = "Provisioned"; + public const string PendingRevocation = "PendingRevocation"; + public const string Revoked = "Revoked"; + public const string Canceled = "Canceled"; + public const string Failed = "Failed"; + public const string PendingApprovalProvisioning = "PendingApprovalProvisioning"; + public const string PendingApproval = "PendingApproval"; + public const string FailedAsResourceIsLocked = "FailedAsResourceIsLocked"; + public const string PendingAdminDecision = "PendingAdminDecision"; + public const string AdminApproved = "AdminApproved"; + public const string AdminDenied = "AdminDenied"; + public const string TimedOut = "TimedOut"; + public const string ProvisioningStarted = "ProvisioningStarted"; + public const string Invalid = "Invalid"; + public const string PendingScheduleCreation = "PendingScheduleCreation"; + public const string ScheduleCreated = "ScheduleCreated"; + public const string PendingExternalProvisioning = "PendingExternalProvisioning"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Type.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Type.cs new file mode 100644 index 000000000000..f718a2f1824f --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/Type.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 Type. + /// + public static class Type + { + public const string AfterDuration = "AfterDuration"; + public const string AfterDateTime = "AfterDateTime"; + public const string NoExpiration = "NoExpiration"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/UserDecisionTarget.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/UserDecisionTarget.cs new file mode 100644 index 000000000000..8f23ed29f9c6 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/UserDecisionTarget.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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// User Decision Target + /// + [Newtonsoft.Json.JsonObject("user")] + public partial class UserDecisionTarget : AccessReviewDecisionTarget + { + /// + /// Initializes a new instance of the UserDecisionTarget class. + /// + public UserDecisionTarget() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserDecisionTarget class. + /// + /// The id of user 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 UserDecisionTarget(string principalId = default(string), string principalName = default(string), string userPrincipalName = default(string)) + { + PrincipalId = principalId; + PrincipalName = principalName; + UserPrincipalName = userPrincipalName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the id of user whose access was reviewed. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; private set; } + + /// + /// Gets the display name of the user whose access was reviewed. + /// + [JsonProperty(PropertyName = "principalName")] + public string PrincipalName { get; private set; } + + /// + /// 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/UserSet.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/UserSet.cs new file mode 100644 index 000000000000..5f81bf83c40c --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/UserSet.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 detail of a user. + /// + public partial class UserSet + { + /// + /// Initializes a new instance of the UserSet class. + /// + public UserSet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserSet class. + /// + /// The type of user. Possible values include: + /// 'User', 'Group' + /// The value indicating whether the user is a + /// backup fallback approver + /// The object id of the user. + /// The description of the user. + public UserSet(string userType = default(string), bool? isBackup = default(bool?), string id = default(string), string description = default(string)) + { + UserType = userType; + IsBackup = isBackup; + Id = id; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of user. Possible values include: 'User', + /// 'Group' + /// + [JsonProperty(PropertyName = "userType")] + public string UserType { get; set; } + + /// + /// Gets or sets the value indicating whether the user is a backup + /// fallback approver + /// + [JsonProperty(PropertyName = "isBackup")] + public bool? IsBackup { get; set; } + + /// + /// Gets or sets the object id of the user. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets the description of the user. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/UserType.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/UserType.cs new file mode 100644 index 000000000000..a0331320dab7 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Models/UserType.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 UserType. + /// + public static class UserType + { + public const string User = "User"; + public const string Group = "Group"; + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Operations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Operations.cs new file mode 100644 index 000000000000..189275304e78 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/Operations.cs @@ -0,0 +1,382 @@ +// +// 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; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(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 operations available from this provider. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + string apiVersion = "2018-05-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Authorization/operations").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("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 operations available from this provider. + /// + /// + /// 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/OperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..8ee29a4cf57c --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/OperationsExtensions.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 Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Lists the operations available from this provider. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists the operations available from this provider. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the operations available from this provider. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the operations available from this provider. + /// + /// + /// 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 IOperations 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/RoleAssignmentScheduleInstancesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentScheduleInstancesOperations.cs new file mode 100644 index 000000000000..4971370f5ded --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentScheduleInstancesOperations.cs @@ -0,0 +1,610 @@ +// +// 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; + + /// + /// RoleAssignmentScheduleInstancesOperations operations. + /// + internal partial class RoleAssignmentScheduleInstancesOperations : IServiceOperations, IRoleAssignmentScheduleInstancesOperations + { + /// + /// Initializes a new instance of the RoleAssignmentScheduleInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal RoleAssignmentScheduleInstancesOperations(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 role assignment schedule instances of a role assignment schedule. + /// + /// + /// The scope of the role assignment schedule. + /// + /// + /// 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 = "2020-10-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/roleAssignmentScheduleInstances").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the specified role assignment schedule instance. + /// + /// + /// The scope of the role assignments schedules. + /// + /// + /// The name (hash of schedule name + time) of the role assignment schedule 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 roleAssignmentScheduleInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleAssignmentScheduleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentScheduleInstanceName"); + } + string apiVersion = "2020-10-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("roleAssignmentScheduleInstanceName", roleAssignmentScheduleInstanceName); + 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/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleAssignmentScheduleInstanceName}", System.Uri.EscapeDataString(roleAssignmentScheduleInstanceName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets role assignment schedule instances of a role assignment schedule. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListForScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListForScopeNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentScheduleInstancesOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentScheduleInstancesOperationsExtensions.cs new file mode 100644 index 000000000000..a1089645a1bd --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentScheduleInstancesOperationsExtensions.cs @@ -0,0 +1,142 @@ +// +// 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 RoleAssignmentScheduleInstancesOperations. + /// + public static partial class RoleAssignmentScheduleInstancesOperationsExtensions + { + /// + /// Gets role assignment schedule instances of a role assignment schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignment schedule. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListForScope(this IRoleAssignmentScheduleInstancesOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListForScopeAsync(scope, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Gets role assignment schedule instances of a role assignment schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignment schedule. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListForScopeAsync(this IRoleAssignmentScheduleInstancesOperations 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 the specified role assignment schedule instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignments schedules. + /// + /// + /// The name (hash of schedule name + time) of the role assignment schedule to + /// get. + /// + public static RoleAssignmentScheduleInstance Get(this IRoleAssignmentScheduleInstancesOperations operations, string scope, string roleAssignmentScheduleInstanceName) + { + return operations.GetAsync(scope, roleAssignmentScheduleInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified role assignment schedule instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignments schedules. + /// + /// + /// The name (hash of schedule name + time) of the role assignment schedule to + /// get. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IRoleAssignmentScheduleInstancesOperations operations, string scope, string roleAssignmentScheduleInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(scope, roleAssignmentScheduleInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets role assignment schedule instances of a role assignment schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListForScopeNext(this IRoleAssignmentScheduleInstancesOperations operations, string nextPageLink) + { + return operations.ListForScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets role assignment schedule instances of a role assignment schedule. + /// + /// + /// 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 IRoleAssignmentScheduleInstancesOperations 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/RoleAssignmentScheduleRequestsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentScheduleRequestsOperations.cs new file mode 100644 index 000000000000..129a03431f42 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentScheduleRequestsOperations.cs @@ -0,0 +1,992 @@ +// +// 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; + + /// + /// RoleAssignmentScheduleRequestsOperations operations. + /// + internal partial class RoleAssignmentScheduleRequestsOperations : IServiceOperations, IRoleAssignmentScheduleRequestsOperations + { + /// + /// Initializes a new instance of the RoleAssignmentScheduleRequestsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal RoleAssignmentScheduleRequestsOperations(AuthorizationManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AuthorizationManagementClient + /// + public AuthorizationManagementClient Client { get; private set; } + + /// + /// Creates a role assignment schedule request. + /// + /// + /// The scope of the role assignment schedule request to create. The scope can + /// be any REST resource instance. For example, use + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a + /// subscription, + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' + /// for a resource group, and + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + /// for a resource. + /// + /// + /// A GUID for the role assignment to create. The name must be unique and + /// different for each role assignment. + /// + /// + /// Parameters for the role assignment schedule 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> CreateWithHttpMessagesAsync(string scope, string roleAssignmentScheduleRequestName, RoleAssignmentScheduleRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleAssignmentScheduleRequestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentScheduleRequestName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + string apiVersion = "2020-10-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("roleAssignmentScheduleRequestName", roleAssignmentScheduleRequestName); + 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/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleAssignmentScheduleRequestName}", System.Uri.EscapeDataString(roleAssignmentScheduleRequestName)); + 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 != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the specified role assignment schedule request. + /// + /// + /// The scope of the role assignment schedule request. + /// + /// + /// The name (guid) of the role assignment schedule request 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 roleAssignmentScheduleRequestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleAssignmentScheduleRequestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentScheduleRequestName"); + } + string apiVersion = "2020-10-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("roleAssignmentScheduleRequestName", roleAssignmentScheduleRequestName); + 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/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleAssignmentScheduleRequestName}", System.Uri.EscapeDataString(roleAssignmentScheduleRequestName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets role assignment schedule requests for a scope. + /// + /// + /// The scope of the role assignments schedule requests. + /// + /// + /// 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 = "2020-10-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/roleAssignmentScheduleRequests").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Cancels a pending role assignment schedule request. + /// + /// + /// The scope of the role assignment request to cancel. + /// + /// + /// The name of the role assignment request to cancel. + /// + /// + /// 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 CancelWithHttpMessagesAsync(string scope, string roleAssignmentScheduleRequestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleAssignmentScheduleRequestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentScheduleRequestName"); + } + string apiVersion = "2020-10-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("roleAssignmentScheduleRequestName", roleAssignmentScheduleRequestName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Cancel", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleAssignmentScheduleRequestName}", System.Uri.EscapeDataString(roleAssignmentScheduleRequestName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets role assignment schedule requests for a scope. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListForScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListForScopeNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentScheduleRequestsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentScheduleRequestsOperationsExtensions.cs new file mode 100644 index 000000000000..387369e6df2e --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentScheduleRequestsOperationsExtensions.cs @@ -0,0 +1,239 @@ +// +// 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 RoleAssignmentScheduleRequestsOperations. + /// + public static partial class RoleAssignmentScheduleRequestsOperationsExtensions + { + /// + /// Creates a role assignment schedule request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignment schedule request to create. The scope can + /// be any REST resource instance. For example, use + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a + /// subscription, + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' + /// for a resource group, and + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + /// for a resource. + /// + /// + /// A GUID for the role assignment to create. The name must be unique and + /// different for each role assignment. + /// + /// + /// Parameters for the role assignment schedule request. + /// + public static RoleAssignmentScheduleRequest Create(this IRoleAssignmentScheduleRequestsOperations operations, string scope, string roleAssignmentScheduleRequestName, RoleAssignmentScheduleRequest parameters) + { + return operations.CreateAsync(scope, roleAssignmentScheduleRequestName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a role assignment schedule request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignment schedule request to create. The scope can + /// be any REST resource instance. For example, use + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a + /// subscription, + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' + /// for a resource group, and + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + /// for a resource. + /// + /// + /// A GUID for the role assignment to create. The name must be unique and + /// different for each role assignment. + /// + /// + /// Parameters for the role assignment schedule request. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IRoleAssignmentScheduleRequestsOperations operations, string scope, string roleAssignmentScheduleRequestName, RoleAssignmentScheduleRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(scope, roleAssignmentScheduleRequestName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the specified role assignment schedule request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignment schedule request. + /// + /// + /// The name (guid) of the role assignment schedule request to get. + /// + public static RoleAssignmentScheduleRequest Get(this IRoleAssignmentScheduleRequestsOperations operations, string scope, string roleAssignmentScheduleRequestName) + { + return operations.GetAsync(scope, roleAssignmentScheduleRequestName).GetAwaiter().GetResult(); + } + + /// + /// Get the specified role assignment schedule request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignment schedule request. + /// + /// + /// The name (guid) of the role assignment schedule request to get. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IRoleAssignmentScheduleRequestsOperations operations, string scope, string roleAssignmentScheduleRequestName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(scope, roleAssignmentScheduleRequestName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets role assignment schedule requests for a scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignments schedule requests. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListForScope(this IRoleAssignmentScheduleRequestsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListForScopeAsync(scope, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Gets role assignment schedule requests for a scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignments schedule requests. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListForScopeAsync(this IRoleAssignmentScheduleRequestsOperations 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; + } + } + + /// + /// Cancels a pending role assignment schedule request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignment request to cancel. + /// + /// + /// The name of the role assignment request to cancel. + /// + public static void Cancel(this IRoleAssignmentScheduleRequestsOperations operations, string scope, string roleAssignmentScheduleRequestName) + { + operations.CancelAsync(scope, roleAssignmentScheduleRequestName).GetAwaiter().GetResult(); + } + + /// + /// Cancels a pending role assignment schedule request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignment request to cancel. + /// + /// + /// The name of the role assignment request to cancel. + /// + /// + /// The cancellation token. + /// + public static async Task CancelAsync(this IRoleAssignmentScheduleRequestsOperations operations, string scope, string roleAssignmentScheduleRequestName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.CancelWithHttpMessagesAsync(scope, roleAssignmentScheduleRequestName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets role assignment schedule requests 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 IRoleAssignmentScheduleRequestsOperations operations, string nextPageLink) + { + return operations.ListForScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets role assignment schedule requests 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 IRoleAssignmentScheduleRequestsOperations 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/RoleAssignmentSchedulesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentSchedulesOperations.cs new file mode 100644 index 000000000000..19abf43f6d66 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentSchedulesOperations.cs @@ -0,0 +1,609 @@ +// +// 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; + + /// + /// RoleAssignmentSchedulesOperations operations. + /// + internal partial class RoleAssignmentSchedulesOperations : IServiceOperations, IRoleAssignmentSchedulesOperations + { + /// + /// Initializes a new instance of the RoleAssignmentSchedulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal RoleAssignmentSchedulesOperations(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 the specified role assignment schedule for a resource scope + /// + /// + /// The scope of the role assignment schedule. + /// + /// + /// The name (guid) of the role assignment schedule 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 roleAssignmentScheduleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleAssignmentScheduleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentScheduleName"); + } + string apiVersion = "2020-10-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("roleAssignmentScheduleName", roleAssignmentScheduleName); + 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/roleAssignmentSchedules/{roleAssignmentScheduleName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleAssignmentScheduleName}", System.Uri.EscapeDataString(roleAssignmentScheduleName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets role assignment schedules for a resource scope. + /// + /// + /// The scope of the role assignments schedules. + /// + /// + /// 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 = "2020-10-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/roleAssignmentSchedules").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets role assignment schedules for a resource scope. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListForScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListForScopeNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentSchedulesOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentSchedulesOperationsExtensions.cs new file mode 100644 index 000000000000..5e11c61acf66 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentSchedulesOperationsExtensions.cs @@ -0,0 +1,140 @@ +// +// 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 RoleAssignmentSchedulesOperations. + /// + public static partial class RoleAssignmentSchedulesOperationsExtensions + { + /// + /// Get the specified role assignment schedule for a resource scope + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignment schedule. + /// + /// + /// The name (guid) of the role assignment schedule to get. + /// + public static RoleAssignmentSchedule Get(this IRoleAssignmentSchedulesOperations operations, string scope, string roleAssignmentScheduleName) + { + return operations.GetAsync(scope, roleAssignmentScheduleName).GetAwaiter().GetResult(); + } + + /// + /// Get the specified role assignment schedule for a resource scope + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignment schedule. + /// + /// + /// The name (guid) of the role assignment schedule to get. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IRoleAssignmentSchedulesOperations operations, string scope, string roleAssignmentScheduleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(scope, roleAssignmentScheduleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets role assignment schedules for a resource scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignments schedules. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListForScope(this IRoleAssignmentSchedulesOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListForScopeAsync(scope, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Gets role assignment schedules for a resource scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role assignments schedules. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListForScopeAsync(this IRoleAssignmentSchedulesOperations 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 role assignment schedules for a resource scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListForScopeNext(this IRoleAssignmentSchedulesOperations operations, string nextPageLink) + { + return operations.ListForScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets role assignment schedules for a resource 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 IRoleAssignmentSchedulesOperations 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/RoleAssignmentsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperations.cs index bd39b807d647..b84632f83218 100644 --- a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperations.cs +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleAssignmentsOperations.cs @@ -94,7 +94,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -310,7 +310,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -550,7 +550,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -760,7 +760,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentName"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -964,7 +964,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { parameters.Validate(); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1180,7 +1180,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentName"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1384,7 +1384,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { parameters.Validate(); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1578,7 +1578,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "scope"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1774,7 +1774,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1969,7 +1969,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { parameters.Validate(); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2176,7 +2176,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "roleAssignmentId"); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2371,7 +2371,7 @@ internal RoleAssignmentsOperations(AuthorizationManagementClient client) { parameters.Validate(); } - string apiVersion = "2020-08-01-preview"; + string apiVersion = "2020-10-01-preview"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilityScheduleInstancesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilityScheduleInstancesOperations.cs new file mode 100644 index 000000000000..75a4df19dc7f --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilityScheduleInstancesOperations.cs @@ -0,0 +1,610 @@ +// +// 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; + + /// + /// RoleEligibilityScheduleInstancesOperations operations. + /// + internal partial class RoleEligibilityScheduleInstancesOperations : IServiceOperations, IRoleEligibilityScheduleInstancesOperations + { + /// + /// Initializes a new instance of the RoleEligibilityScheduleInstancesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal RoleEligibilityScheduleInstancesOperations(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 role eligibility schedule instances of a role eligibility schedule. + /// + /// + /// The scope of the role eligibility schedule. + /// + /// + /// 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 = "2020-10-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/roleEligibilityScheduleInstances").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the specified role eligibility schedule instance. + /// + /// + /// The scope of the role eligibility schedules. + /// + /// + /// The name (hash of schedule name + time) of the role eligibility schedule 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 roleEligibilityScheduleInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleEligibilityScheduleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleEligibilityScheduleInstanceName"); + } + string apiVersion = "2020-10-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("roleEligibilityScheduleInstanceName", roleEligibilityScheduleInstanceName); + 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/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleEligibilityScheduleInstanceName}", System.Uri.EscapeDataString(roleEligibilityScheduleInstanceName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets role eligibility schedule instances of a role eligibility schedule. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListForScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListForScopeNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilityScheduleInstancesOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilityScheduleInstancesOperationsExtensions.cs new file mode 100644 index 000000000000..ebcd7b20c0a0 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilityScheduleInstancesOperationsExtensions.cs @@ -0,0 +1,142 @@ +// +// 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 RoleEligibilityScheduleInstancesOperations. + /// + public static partial class RoleEligibilityScheduleInstancesOperationsExtensions + { + /// + /// Gets role eligibility schedule instances of a role eligibility schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility schedule. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListForScope(this IRoleEligibilityScheduleInstancesOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListForScopeAsync(scope, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Gets role eligibility schedule instances of a role eligibility schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility schedule. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListForScopeAsync(this IRoleEligibilityScheduleInstancesOperations 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 the specified role eligibility schedule instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility schedules. + /// + /// + /// The name (hash of schedule name + time) of the role eligibility schedule to + /// get. + /// + public static RoleEligibilityScheduleInstance Get(this IRoleEligibilityScheduleInstancesOperations operations, string scope, string roleEligibilityScheduleInstanceName) + { + return operations.GetAsync(scope, roleEligibilityScheduleInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified role eligibility schedule instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility schedules. + /// + /// + /// The name (hash of schedule name + time) of the role eligibility schedule to + /// get. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IRoleEligibilityScheduleInstancesOperations operations, string scope, string roleEligibilityScheduleInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(scope, roleEligibilityScheduleInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets role eligibility schedule instances of a role eligibility schedule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListForScopeNext(this IRoleEligibilityScheduleInstancesOperations operations, string nextPageLink) + { + return operations.ListForScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets role eligibility schedule instances of a role eligibility schedule. + /// + /// + /// 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 IRoleEligibilityScheduleInstancesOperations 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/RoleEligibilityScheduleRequestsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilityScheduleRequestsOperations.cs new file mode 100644 index 000000000000..8d4f6ed67463 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilityScheduleRequestsOperations.cs @@ -0,0 +1,991 @@ +// +// 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; + + /// + /// RoleEligibilityScheduleRequestsOperations operations. + /// + internal partial class RoleEligibilityScheduleRequestsOperations : IServiceOperations, IRoleEligibilityScheduleRequestsOperations + { + /// + /// Initializes a new instance of the RoleEligibilityScheduleRequestsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal RoleEligibilityScheduleRequestsOperations(AuthorizationManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AuthorizationManagementClient + /// + public AuthorizationManagementClient Client { get; private set; } + + /// + /// Creates a role eligibility schedule request. + /// + /// + /// The scope of the role eligibility schedule request to create. The scope can + /// be any REST resource instance. For example, use + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a + /// subscription, + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' + /// for a resource group, and + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + /// for a resource. + /// + /// + /// The name of the role eligibility to create. It can be any valid GUID. + /// + /// + /// Parameters for the role eligibility schedule 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> CreateWithHttpMessagesAsync(string scope, string roleEligibilityScheduleRequestName, RoleEligibilityScheduleRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleEligibilityScheduleRequestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleEligibilityScheduleRequestName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + string apiVersion = "2020-10-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("roleEligibilityScheduleRequestName", roleEligibilityScheduleRequestName); + 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/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleEligibilityScheduleRequestName}", System.Uri.EscapeDataString(roleEligibilityScheduleRequestName)); + 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 != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the specified role eligibility schedule request. + /// + /// + /// The scope of the role eligibility schedule request. + /// + /// + /// The name (guid) of the role eligibility schedule request 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 roleEligibilityScheduleRequestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleEligibilityScheduleRequestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleEligibilityScheduleRequestName"); + } + string apiVersion = "2020-10-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("roleEligibilityScheduleRequestName", roleEligibilityScheduleRequestName); + 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/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleEligibilityScheduleRequestName}", System.Uri.EscapeDataString(roleEligibilityScheduleRequestName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets role eligibility schedule requests for a scope. + /// + /// + /// The scope of the role eligibility schedule requests. + /// + /// + /// 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 = "2020-10-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/roleEligibilityScheduleRequests").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Cancels a pending role eligibility schedule request. + /// + /// + /// The scope of the role eligibility request to cancel. + /// + /// + /// The name of the role eligibility request to cancel. + /// + /// + /// 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 CancelWithHttpMessagesAsync(string scope, string roleEligibilityScheduleRequestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleEligibilityScheduleRequestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleEligibilityScheduleRequestName"); + } + string apiVersion = "2020-10-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("roleEligibilityScheduleRequestName", roleEligibilityScheduleRequestName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Cancel", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleEligibilityScheduleRequestName}", System.Uri.EscapeDataString(roleEligibilityScheduleRequestName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets role eligibility schedule requests for a scope. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListForScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListForScopeNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilityScheduleRequestsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilityScheduleRequestsOperationsExtensions.cs new file mode 100644 index 000000000000..9a545ab62c1c --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilityScheduleRequestsOperationsExtensions.cs @@ -0,0 +1,237 @@ +// +// 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 RoleEligibilityScheduleRequestsOperations. + /// + public static partial class RoleEligibilityScheduleRequestsOperationsExtensions + { + /// + /// Creates a role eligibility schedule request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility schedule request to create. The scope can + /// be any REST resource instance. For example, use + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a + /// subscription, + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' + /// for a resource group, and + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + /// for a resource. + /// + /// + /// The name of the role eligibility to create. It can be any valid GUID. + /// + /// + /// Parameters for the role eligibility schedule request. + /// + public static RoleEligibilityScheduleRequest Create(this IRoleEligibilityScheduleRequestsOperations operations, string scope, string roleEligibilityScheduleRequestName, RoleEligibilityScheduleRequest parameters) + { + return operations.CreateAsync(scope, roleEligibilityScheduleRequestName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a role eligibility schedule request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility schedule request to create. The scope can + /// be any REST resource instance. For example, use + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a + /// subscription, + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' + /// for a resource group, and + /// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + /// for a resource. + /// + /// + /// The name of the role eligibility to create. It can be any valid GUID. + /// + /// + /// Parameters for the role eligibility schedule request. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IRoleEligibilityScheduleRequestsOperations operations, string scope, string roleEligibilityScheduleRequestName, RoleEligibilityScheduleRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(scope, roleEligibilityScheduleRequestName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the specified role eligibility schedule request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility schedule request. + /// + /// + /// The name (guid) of the role eligibility schedule request to get. + /// + public static RoleEligibilityScheduleRequest Get(this IRoleEligibilityScheduleRequestsOperations operations, string scope, string roleEligibilityScheduleRequestName) + { + return operations.GetAsync(scope, roleEligibilityScheduleRequestName).GetAwaiter().GetResult(); + } + + /// + /// Get the specified role eligibility schedule request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility schedule request. + /// + /// + /// The name (guid) of the role eligibility schedule request to get. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IRoleEligibilityScheduleRequestsOperations operations, string scope, string roleEligibilityScheduleRequestName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(scope, roleEligibilityScheduleRequestName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets role eligibility schedule requests for a scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility schedule requests. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListForScope(this IRoleEligibilityScheduleRequestsOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListForScopeAsync(scope, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Gets role eligibility schedule requests for a scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility schedule requests. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListForScopeAsync(this IRoleEligibilityScheduleRequestsOperations 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; + } + } + + /// + /// Cancels a pending role eligibility schedule request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility request to cancel. + /// + /// + /// The name of the role eligibility request to cancel. + /// + public static void Cancel(this IRoleEligibilityScheduleRequestsOperations operations, string scope, string roleEligibilityScheduleRequestName) + { + operations.CancelAsync(scope, roleEligibilityScheduleRequestName).GetAwaiter().GetResult(); + } + + /// + /// Cancels a pending role eligibility schedule request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility request to cancel. + /// + /// + /// The name of the role eligibility request to cancel. + /// + /// + /// The cancellation token. + /// + public static async Task CancelAsync(this IRoleEligibilityScheduleRequestsOperations operations, string scope, string roleEligibilityScheduleRequestName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.CancelWithHttpMessagesAsync(scope, roleEligibilityScheduleRequestName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets role eligibility schedule requests 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 IRoleEligibilityScheduleRequestsOperations operations, string nextPageLink) + { + return operations.ListForScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets role eligibility schedule requests 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 IRoleEligibilityScheduleRequestsOperations 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/RoleEligibilitySchedulesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilitySchedulesOperations.cs new file mode 100644 index 000000000000..152f97d14a04 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilitySchedulesOperations.cs @@ -0,0 +1,609 @@ +// +// 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; + + /// + /// RoleEligibilitySchedulesOperations operations. + /// + internal partial class RoleEligibilitySchedulesOperations : IServiceOperations, IRoleEligibilitySchedulesOperations + { + /// + /// Initializes a new instance of the RoleEligibilitySchedulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal RoleEligibilitySchedulesOperations(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 the specified role eligibility schedule for a resource scope + /// + /// + /// The scope of the role eligibility schedule. + /// + /// + /// The name (guid) of the role eligibility schedule 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 roleEligibilityScheduleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleEligibilityScheduleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleEligibilityScheduleName"); + } + string apiVersion = "2020-10-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("roleEligibilityScheduleName", roleEligibilityScheduleName); + 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/roleEligibilitySchedules/{roleEligibilityScheduleName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleEligibilityScheduleName}", System.Uri.EscapeDataString(roleEligibilityScheduleName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets role eligibility schedules for a resource scope. + /// + /// + /// The scope of the role eligibility schedules. + /// + /// + /// 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 = "2020-10-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/roleEligibilitySchedules").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets role eligibility schedules for a resource scope. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListForScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListForScopeNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilitySchedulesOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilitySchedulesOperationsExtensions.cs new file mode 100644 index 000000000000..ecc06681c1ad --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleEligibilitySchedulesOperationsExtensions.cs @@ -0,0 +1,140 @@ +// +// 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 RoleEligibilitySchedulesOperations. + /// + public static partial class RoleEligibilitySchedulesOperationsExtensions + { + /// + /// Get the specified role eligibility schedule for a resource scope + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility schedule. + /// + /// + /// The name (guid) of the role eligibility schedule to get. + /// + public static RoleEligibilitySchedule Get(this IRoleEligibilitySchedulesOperations operations, string scope, string roleEligibilityScheduleName) + { + return operations.GetAsync(scope, roleEligibilityScheduleName).GetAwaiter().GetResult(); + } + + /// + /// Get the specified role eligibility schedule for a resource scope + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility schedule. + /// + /// + /// The name (guid) of the role eligibility schedule to get. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IRoleEligibilitySchedulesOperations operations, string scope, string roleEligibilityScheduleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(scope, roleEligibilityScheduleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets role eligibility schedules for a resource scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility schedules. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListForScope(this IRoleEligibilitySchedulesOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListForScopeAsync(scope, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Gets role eligibility schedules for a resource scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role eligibility schedules. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListForScopeAsync(this IRoleEligibilitySchedulesOperations 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 role eligibility schedules for a resource scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListForScopeNext(this IRoleEligibilitySchedulesOperations operations, string nextPageLink) + { + return operations.ListForScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets role eligibility schedules for a resource 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 IRoleEligibilitySchedulesOperations 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/RoleManagementPoliciesOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleManagementPoliciesOperations.cs new file mode 100644 index 000000000000..02283f08b42a --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleManagementPoliciesOperations.cs @@ -0,0 +1,967 @@ +// +// 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; + + /// + /// RoleManagementPoliciesOperations operations. + /// + internal partial class RoleManagementPoliciesOperations : IServiceOperations, IRoleManagementPoliciesOperations + { + /// + /// Initializes a new instance of the RoleManagementPoliciesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal RoleManagementPoliciesOperations(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 the specified role management policy for a resource scope + /// + /// + /// The scope of the role management policy. + /// + /// + /// The name (guid) of the role management policy 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 roleManagementPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleManagementPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleManagementPolicyName"); + } + string apiVersion = "2020-10-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("roleManagementPolicyName", roleManagementPolicyName); + 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/roleManagementPolicies/{roleManagementPolicyName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleManagementPolicyName}", System.Uri.EscapeDataString(roleManagementPolicyName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a role management policy + /// + /// + /// The scope of the role management policy to upsert. + /// + /// + /// The name (guid) of the role management policy to upsert. + /// + /// + /// Parameters for the role management policy. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string scope, string roleManagementPolicyName, RoleManagementPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleManagementPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleManagementPolicyName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2020-10-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("roleManagementPolicyName", roleManagementPolicyName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleManagementPolicyName}", System.Uri.EscapeDataString(roleManagementPolicyName)); + 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("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(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a role management policy + /// + /// + /// The scope of the role management policy to upsert. + /// + /// + /// The name (guid) of the role management policy to upsert. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string scope, string roleManagementPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleManagementPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleManagementPolicyName"); + } + string apiVersion = "2020-10-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("roleManagementPolicyName", roleManagementPolicyName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleManagementPolicyName}", System.Uri.EscapeDataString(roleManagementPolicyName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets role management policies for a resource scope. + /// + /// + /// The scope of the role management policy. + /// + /// + /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + string apiVersion = "2020-10-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("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/roleManagementPolicies").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets role management policies for a resource scope. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListForScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListForScopeNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleManagementPoliciesOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleManagementPoliciesOperationsExtensions.cs new file mode 100644 index 000000000000..70573a089eac --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleManagementPoliciesOperationsExtensions.cs @@ -0,0 +1,216 @@ +// +// 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 RoleManagementPoliciesOperations. + /// + public static partial class RoleManagementPoliciesOperationsExtensions + { + /// + /// Get the specified role management policy for a resource scope + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy. + /// + /// + /// The name (guid) of the role management policy to get. + /// + public static RoleManagementPolicy Get(this IRoleManagementPoliciesOperations operations, string scope, string roleManagementPolicyName) + { + return operations.GetAsync(scope, roleManagementPolicyName).GetAwaiter().GetResult(); + } + + /// + /// Get the specified role management policy for a resource scope + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy. + /// + /// + /// The name (guid) of the role management policy to get. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IRoleManagementPoliciesOperations operations, string scope, string roleManagementPolicyName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(scope, roleManagementPolicyName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a role management policy + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy to upsert. + /// + /// + /// The name (guid) of the role management policy to upsert. + /// + /// + /// Parameters for the role management policy. + /// + public static RoleManagementPolicy Update(this IRoleManagementPoliciesOperations operations, string scope, string roleManagementPolicyName, RoleManagementPolicy parameters) + { + return operations.UpdateAsync(scope, roleManagementPolicyName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Update a role management policy + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy to upsert. + /// + /// + /// The name (guid) of the role management policy to upsert. + /// + /// + /// Parameters for the role management policy. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IRoleManagementPoliciesOperations operations, string scope, string roleManagementPolicyName, RoleManagementPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(scope, roleManagementPolicyName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a role management policy + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy to upsert. + /// + /// + /// The name (guid) of the role management policy to upsert. + /// + public static void Delete(this IRoleManagementPoliciesOperations operations, string scope, string roleManagementPolicyName) + { + operations.DeleteAsync(scope, roleManagementPolicyName).GetAwaiter().GetResult(); + } + + /// + /// Delete a role management policy + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy to upsert. + /// + /// + /// The name (guid) of the role management policy to upsert. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IRoleManagementPoliciesOperations operations, string scope, string roleManagementPolicyName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(scope, roleManagementPolicyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets role management policies for a resource scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy. + /// + public static IPage ListForScope(this IRoleManagementPoliciesOperations operations, string scope) + { + return operations.ListForScopeAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// Gets role management policies for a resource scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy. + /// + /// + /// The cancellation token. + /// + public static async Task> ListForScopeAsync(this IRoleManagementPoliciesOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListForScopeWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets role management policies for a resource scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListForScopeNext(this IRoleManagementPoliciesOperations operations, string nextPageLink) + { + return operations.ListForScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets role management policies for a resource 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 IRoleManagementPoliciesOperations 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/RoleManagementPolicyAssignmentsOperations.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleManagementPolicyAssignmentsOperations.cs new file mode 100644 index 000000000000..60cca43b4a85 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleManagementPolicyAssignmentsOperations.cs @@ -0,0 +1,970 @@ +// +// 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; + + /// + /// RoleManagementPolicyAssignmentsOperations operations. + /// + internal partial class RoleManagementPolicyAssignmentsOperations : IServiceOperations, IRoleManagementPolicyAssignmentsOperations + { + /// + /// Initializes a new instance of the RoleManagementPolicyAssignmentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal RoleManagementPolicyAssignmentsOperations(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 the specified role management policy assignment for a resource scope + /// + /// + /// The scope of the role management policy. + /// + /// + /// The name of format {guid_guid} the role management policy 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 roleManagementPolicyAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleManagementPolicyAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleManagementPolicyAssignmentName"); + } + string apiVersion = "2020-10-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("roleManagementPolicyAssignmentName", roleManagementPolicyAssignmentName); + 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/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleManagementPolicyAssignmentName}", System.Uri.EscapeDataString(roleManagementPolicyAssignmentName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create a role management policy assignment + /// + /// + /// The scope of the role management policy assignment to upsert. + /// + /// + /// The name of format {guid_guid} the role management policy assignment to + /// upsert. + /// + /// + /// Parameters for the role management policy 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 roleManagementPolicyAssignmentName, RoleManagementPolicyAssignment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleManagementPolicyAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleManagementPolicyAssignmentName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + string apiVersion = "2020-10-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("roleManagementPolicyAssignmentName", roleManagementPolicyAssignmentName); + 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/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleManagementPolicyAssignmentName}", System.Uri.EscapeDataString(roleManagementPolicyAssignmentName)); + 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 != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete a role management policy assignment + /// + /// + /// The scope of the role management policy assignment to delete. + /// + /// + /// The name of format {guid_guid} the role management policy assignment to + /// delete. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string scope, string roleManagementPolicyAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (roleManagementPolicyAssignmentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleManagementPolicyAssignmentName"); + } + string apiVersion = "2020-10-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("roleManagementPolicyAssignmentName", roleManagementPolicyAssignmentName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{roleManagementPolicyAssignmentName}", System.Uri.EscapeDataString(roleManagementPolicyAssignmentName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets role management assignment policies for a resource scope. + /// + /// + /// The scope of the role management policy. + /// + /// + /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + string apiVersion = "2020-10-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("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/roleManagementPolicyAssignments").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets role management assignment policies for a resource scope. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListForScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListForScopeNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleManagementPolicyAssignmentsOperationsExtensions.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleManagementPolicyAssignmentsOperationsExtensions.cs new file mode 100644 index 000000000000..91747d2faee8 --- /dev/null +++ b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/RoleManagementPolicyAssignmentsOperationsExtensions.cs @@ -0,0 +1,222 @@ +// +// 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 RoleManagementPolicyAssignmentsOperations. + /// + public static partial class RoleManagementPolicyAssignmentsOperationsExtensions + { + /// + /// Get the specified role management policy assignment for a resource scope + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy. + /// + /// + /// The name of format {guid_guid} the role management policy assignment to + /// get. + /// + public static RoleManagementPolicyAssignment Get(this IRoleManagementPolicyAssignmentsOperations operations, string scope, string roleManagementPolicyAssignmentName) + { + return operations.GetAsync(scope, roleManagementPolicyAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// Get the specified role management policy assignment for a resource scope + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy. + /// + /// + /// The name of format {guid_guid} the role management policy assignment to + /// get. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IRoleManagementPolicyAssignmentsOperations operations, string scope, string roleManagementPolicyAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(scope, roleManagementPolicyAssignmentName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a role management policy assignment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy assignment to upsert. + /// + /// + /// The name of format {guid_guid} the role management policy assignment to + /// upsert. + /// + /// + /// Parameters for the role management policy assignment. + /// + public static RoleManagementPolicyAssignment Create(this IRoleManagementPolicyAssignmentsOperations operations, string scope, string roleManagementPolicyAssignmentName, RoleManagementPolicyAssignment parameters) + { + return operations.CreateAsync(scope, roleManagementPolicyAssignmentName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create a role management policy assignment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy assignment to upsert. + /// + /// + /// The name of format {guid_guid} the role management policy assignment to + /// upsert. + /// + /// + /// Parameters for the role management policy assignment. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IRoleManagementPolicyAssignmentsOperations operations, string scope, string roleManagementPolicyAssignmentName, RoleManagementPolicyAssignment parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(scope, roleManagementPolicyAssignmentName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a role management policy assignment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy assignment to delete. + /// + /// + /// The name of format {guid_guid} the role management policy assignment to + /// delete. + /// + public static void Delete(this IRoleManagementPolicyAssignmentsOperations operations, string scope, string roleManagementPolicyAssignmentName) + { + operations.DeleteAsync(scope, roleManagementPolicyAssignmentName).GetAwaiter().GetResult(); + } + + /// + /// Delete a role management policy assignment + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy assignment to delete. + /// + /// + /// The name of format {guid_guid} the role management policy assignment to + /// delete. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IRoleManagementPolicyAssignmentsOperations operations, string scope, string roleManagementPolicyAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(scope, roleManagementPolicyAssignmentName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets role management assignment policies for a resource scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy. + /// + public static IPage ListForScope(this IRoleManagementPolicyAssignmentsOperations operations, string scope) + { + return operations.ListForScopeAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// Gets role management assignment policies for a resource scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The scope of the role management policy. + /// + /// + /// The cancellation token. + /// + public static async Task> ListForScopeAsync(this IRoleManagementPolicyAssignmentsOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListForScopeWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets role management assignment policies for a resource scope. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListForScopeNext(this IRoleManagementPolicyAssignmentsOperations operations, string nextPageLink) + { + return operations.ListForScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets role management assignment policies for a resource 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 IRoleManagementPolicyAssignmentsOperations 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/SdkInfo_AuthorizationManagementClient.cs b/sdk/authorization/Microsoft.Azure.Management.Authorization/src/Generated/SdkInfo_AuthorizationManagementClient.cs index cd3124bae587..9ec0ca17c44c 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,35 @@ public static IEnumerable> ApiInfo_AuthorizationMa { return new Tuple[] { - new Tuple("Authorization", "ClassicAdministrators", "2015-06-01"), + new Tuple("Authorization", "AccessReviewDefaultSettings", "2018-05-01-preview"), + new Tuple("Authorization", "AccessReviewInstance", "2018-05-01-preview"), + new Tuple("Authorization", "AccessReviewInstanceDecisions", "2018-05-01-preview"), + new Tuple("Authorization", "AccessReviewInstanceMyDecisions", "2018-05-01-preview"), + new Tuple("Authorization", "AccessReviewInstances", "2018-05-01-preview"), + new Tuple("Authorization", "AccessReviewInstancesAssignedForMyApproval", "2018-05-01-preview"), + new Tuple("Authorization", "AccessReviewScheduleDefinitions", "2018-05-01-preview"), + new Tuple("Authorization", "AccessReviewScheduleDefinitionsAssignedForMyApproval", "2018-05-01-preview"), new Tuple("Authorization", "DenyAssignments", "2018-07-01-preview"), - new Tuple("Authorization", "GlobalAdministrator", "2015-07-01"), + new Tuple("Authorization", "EligibleChildResources", "2020-10-01-preview"), + new Tuple("Authorization", "Operations", "2018-05-01-preview"), 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", "RoleAssignmentScheduleInstances", "2020-10-01-preview"), + new Tuple("Authorization", "RoleAssignmentScheduleRequests", "2020-10-01-preview"), + new Tuple("Authorization", "RoleAssignmentSchedules", "2020-10-01-preview"), + new Tuple("Authorization", "RoleAssignments", "2020-10-01-preview"), new Tuple("Authorization", "RoleDefinitions", "2018-01-01-preview"), + new Tuple("Authorization", "RoleEligibilityScheduleInstances", "2020-10-01-preview"), + new Tuple("Authorization", "RoleEligibilityScheduleRequests", "2020-10-01-preview"), + new Tuple("Authorization", "RoleEligibilitySchedules", "2020-10-01-preview"), + new Tuple("Authorization", "RoleManagementPolicies", "2020-10-01-preview"), + new Tuple("Authorization", "RoleManagementPolicyAssignments", "2020-10-01-preview"), new Tuple("AuthorizationManagementClient", "DenyAssignments", "2018-07-01-preview"), - new Tuple("AuthorizationManagementClient", "RoleAssignments", "2020-08-01-preview"), + new Tuple("AuthorizationManagementClient", "RoleAssignments", "2020-10-01-preview"), new Tuple("AuthorizationManagementClient", "RoleDefinitions", "2018-01-01-preview"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/authorization/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --tag=package-2020-08-01-preview --csharp-sdks-folder=C:\\GitHub\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "61e7148e9592c5efc95e5c16a5bb4f2dc26d6de0"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -